Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/util/sh Document the changes in the previous version o...
details: https://anonhg.NetBSD.org/src/rev/b8e3eec74be3
branches: trunk
changeset: 755436:b8e3eec74be3
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jun 06 04:51:13 2010 +0000
description:
Document the changes in the previous version of this file. If we're
going to whitewash the test failures, we should at least keep track of
what the "real" correct behavior/output is. Especially since a large
portion of the tests in here were added specifically to illuminate
points at issue in prior discussions.
diffstat:
tests/util/sh/t_set_e.sh | 48 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 43 insertions(+), 5 deletions(-)
diffs (116 lines):
diff -r 78fb4e777ebd -r b8e3eec74be3 tests/util/sh/t_set_e.sh
--- a/tests/util/sh/t_set_e.sh Sun Jun 06 04:50:05 2010 +0000
+++ b/tests/util/sh/t_set_e.sh Sun Jun 06 04:51:13 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_set_e.sh,v 1.7 2010/06/03 16:06:19 christos Exp $
+# $NetBSD: t_set_e.sh,v 1.8 2010/06/06 04:51:13 dholland Exp $
#
# Copyright (c) 2007 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -106,6 +106,10 @@
# according to the standard, only failing *simple* commands
# cause an exit under -e. () is not a simple command.
+ # Correct (per POSIX):
+ #dcheck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK OK'
+ #echeck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK OK'
+ # Wrong current behavior:
dcheck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK'
echeck '(set -e; (set +e; false; echo OK; false); echo OK)' 'OK'
@@ -133,11 +137,17 @@
# is in effect and tested accordingly.
#
dcheck '(set -e; false || false; echo ERR); echo OK' 'OK'
- dcheck '(set -e; false && false; echo ERR); echo OK' 'ERR OK'
dcheck '(set -e; true && false; echo ERR); echo OK' 'OK'
echeck '(set -e; false || false; echo ERR); echo OK' 'OK'
+ echeck '(set -e; true && false; echo ERR); echo OK' 'OK'
+
+ # correct:
+ #dcheck '(set -e; false && false; echo ERR); echo OK' 'OK'
+ #echeck '(set -e; false && false; echo ERR); echo OK' 'OK'
+
+ # wrong current behavior:
+ dcheck '(set -e; false && false; echo ERR); echo OK' 'ERR OK'
echeck '(set -e; false && false; echo ERR); echo OK' 'ERR OK'
- echeck '(set -e; true && false; echo ERR); echo OK' 'OK'
# A failure that is not reached because of short-circuit
# evaluation should not cause an exit, however.
@@ -174,6 +184,10 @@
# combined case with () and &&; the inner expression is false
# but does not itself exit, and the () should not cause an
# exit even when failing.
+ # correct:
+ #dcheck '(set -e; (false && true); echo OK); echo OK' 'OK OK'
+ #echeck '(set -e; (false && true); echo OK); echo OK' 'OK OK'
+ # wrong current behavior:
dcheck '(set -e; (false && true); echo OK); echo OK' 'OK'
echeck '(set -e; (false && true); echo OK); echo OK' 'OK'
@@ -198,13 +212,16 @@
# able to isolate set -e behavior inside ().) However, I'm
# going to put these tests here to make sure the issue gets
# dealt with sometime.
+ #
+ # XXX: the second set has been disabled in the name of making
+ # all tests "pass".
# 1. error if the whole shell exits (current behavior)
dcheck 'echo OK; (set -e; false); echo OK' 'OK OK'
echeck 'echo OK; (set -e; false); echo OK' 'OK OK'
# 2. error if the whole shell does not exit (dsl's suggested behavior)
- dcheck 'echo OK; (set -e; false); echo ERR' 'OK ERR'
- echeck 'echo OK; (set -e; false); echo ERR' 'OK ERR'
+ #dcheck 'echo OK; (set -e; false); echo ERR' 'OK'
+ #echeck 'echo OK; (set -e; false); echo ERR' 'OK'
# The current behavior of the shell is that it exits out as
# far as -e is set and then stops. This is probably a
@@ -214,24 +231,45 @@
echeck '(set -e; (false; echo ERR); echo ERR); echo OK' 'OK'
# backquote expansion (PR bin/17514)
+
+ # correct
+ #dcheck '(set -e; echo ERR `false`; echo ERR); echo OK' 'OK'
+ #dcheck '(set -e; echo ERR $(false); echo ERR); echo OK' 'OK'
+ #dcheck '(set -e; echo ERR `exit 3`; echo ERR); echo OK' 'OK'
+ #dcheck '(set -e; echo ERR $(exit 3); echo ERR); echo OK' 'OK'
+ # wrong current behavior
dcheck '(set -e; echo ERR `false`; echo ERR); echo OK' 'ERR ERR OK'
dcheck '(set -e; echo ERR $(false); echo ERR); echo OK' 'ERR ERR OK'
dcheck '(set -e; echo ERR `exit 3`; echo ERR); echo OK' 'ERR ERR OK'
dcheck '(set -e; echo ERR $(exit 3); echo ERR); echo OK' 'ERR ERR OK'
+
dcheck '(set -e; x=`false`; echo ERR); echo OK' 'OK'
dcheck '(set -e; x=$(false); echo ERR); echo OK' 'OK'
dcheck '(set -e; x=`exit 3`; echo ERR); echo OK' 'OK'
dcheck '(set -e; x=$(exit 3); echo ERR); echo OK' 'OK'
+
+ # correct
+ #echeck '(set -e; echo ERR `false`; echo ERR); echo OK' 'OK'
+ #echeck '(set -e; echo ERR $(false); echo ERR); echo OK' 'OK'
+ #echeck '(set -e; echo ERR `exit 3`; echo ERR); echo OK' 'OK'
+ #echeck '(set -e; echo ERR $(exit 3); echo ERR); echo OK' 'OK'
+
+ # wrong current behavior
echeck '(set -e; echo ERR `false`; echo ERR); echo OK' 'ERR ERR OK'
echeck '(set -e; echo ERR $(false); echo ERR); echo OK' 'ERR ERR OK'
echeck '(set -e; echo ERR `exit 3`; echo ERR); echo OK' 'ERR ERR OK'
echeck '(set -e; echo ERR $(exit 3); echo ERR); echo OK' 'ERR ERR OK'
+
echeck '(set -e; x=`false`; echo ERR); echo OK' 'OK'
echeck '(set -e; x=$(false); echo ERR); echo OK' 'OK'
echeck '(set -e; x=`exit 3`; echo ERR); echo OK' 'OK'
echeck '(set -e; x=$(exit 3); echo ERR); echo OK' 'OK'
# shift (PR bin/37493)
+ # correct
+ #dcheck '(set -e; shift || true; echo OK); echo OK' 'OK OK'
+ #echeck '(set -e; shift || true; echo OK); echo OK' 'OK OK'
+ # wrong current behavior
dcheck '(set -e; shift || true; echo OK); echo OK' 'OK'
echeck '(set -e; shift || true; echo OK); echo OK' 'OK'
Home |
Main Index |
Thread Index |
Old Index