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.
This commit is contained in:
dholland 2010-06-06 04:51:13 +00:00
parent bd01b4a30e
commit 319ed136d2
1 changed files with 43 additions and 5 deletions

View File

@ -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 @@ all_body() {
# 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,12 +137,18 @@ all_body() {
# 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; false && false; echo ERR); echo OK' 'ERR 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'
# A failure that is not reached because of short-circuit
# evaluation should not cause an exit, however.
dcheck '(set -e; true || false; echo OK); echo OK' 'OK OK'
@ -174,6 +184,10 @@ all_body() {
# 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 @@ all_body() {
# 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 @@ all_body() {
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'