From 3ed7e2749a3f9fd315d8f46a3b0a25ff10caf726 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 1 Oct 2016 22:36:14 +0200 Subject: ash testsuite: add return_in_trap1.tests Currently it fails Signed-off-by: Denys Vlasenko --- shell/ash_test/ash-signals/return_in_trap1.right | 4 +++ shell/ash_test/ash-signals/return_in_trap1.tests | 18 ++++++++++++ shell/hush_test/hush-signals/catch.right | 5 ++++ shell/hush_test/hush-signals/catch.tests | 20 +++++++++++++ shell/hush_test/hush-signals/exit.right | 12 ++++++++ shell/hush_test/hush-signals/exit.tests | 34 ++++++++++++++++++++++ shell/hush_test/hush-signals/return_in_trap1.right | 4 +++ shell/hush_test/hush-signals/return_in_trap1.tests | 18 ++++++++++++ shell/hush_test/hush-signals/save-ret.right | 2 ++ shell/hush_test/hush-signals/save-ret.tests | 4 +++ shell/hush_test/hush-signals/savetrap.right | 8 +++++ shell/hush_test/hush-signals/savetrap.tests | 9 ++++++ shell/hush_test/hush-signals/signal7.right | 1 + shell/hush_test/hush-signals/signal7.tests | 18 ++++++++++++ shell/hush_test/hush-signals/signal_read1.right | 1 + shell/hush_test/hush-signals/signal_read1.tests | 5 ++++ shell/hush_test/hush-signals/signal_read2.right | 2 ++ shell/hush_test/hush-signals/signal_read2.tests | 7 +++++ shell/hush_test/hush-signals/subshell.right | 21 +++++++++++++ shell/hush_test/hush-signals/subshell.tests | 19 ++++++++++++ shell/hush_test/hush-signals/usage.right | 14 +++++++++ shell/hush_test/hush-signals/usage.tests | 23 +++++++++++++++ shell/hush_test/hush-trap/catch.right | 5 ---- shell/hush_test/hush-trap/catch.tests | 20 ------------- shell/hush_test/hush-trap/exit.right | 12 -------- shell/hush_test/hush-trap/exit.tests | 34 ---------------------- shell/hush_test/hush-trap/return_in_trap1.right | 4 --- shell/hush_test/hush-trap/return_in_trap1.tests | 18 ------------ shell/hush_test/hush-trap/save-ret.right | 2 -- shell/hush_test/hush-trap/save-ret.tests | 4 --- shell/hush_test/hush-trap/savetrap.right | 8 ----- shell/hush_test/hush-trap/savetrap.tests | 9 ------ shell/hush_test/hush-trap/signal7.right | 1 - shell/hush_test/hush-trap/signal7.tests | 18 ------------ shell/hush_test/hush-trap/signal_read1.right | 1 - shell/hush_test/hush-trap/signal_read1.tests | 5 ---- shell/hush_test/hush-trap/signal_read2.right | 2 -- shell/hush_test/hush-trap/signal_read2.tests | 7 ----- shell/hush_test/hush-trap/subshell.right | 21 ------------- shell/hush_test/hush-trap/subshell.tests | 19 ------------ shell/hush_test/hush-trap/usage.right | 14 --------- shell/hush_test/hush-trap/usage.tests | 23 --------------- 42 files changed, 249 insertions(+), 227 deletions(-) create mode 100644 shell/ash_test/ash-signals/return_in_trap1.right create mode 100755 shell/ash_test/ash-signals/return_in_trap1.tests create mode 100644 shell/hush_test/hush-signals/catch.right create mode 100755 shell/hush_test/hush-signals/catch.tests create mode 100644 shell/hush_test/hush-signals/exit.right create mode 100755 shell/hush_test/hush-signals/exit.tests create mode 100644 shell/hush_test/hush-signals/return_in_trap1.right create mode 100755 shell/hush_test/hush-signals/return_in_trap1.tests create mode 100644 shell/hush_test/hush-signals/save-ret.right create mode 100755 shell/hush_test/hush-signals/save-ret.tests create mode 100644 shell/hush_test/hush-signals/savetrap.right create mode 100755 shell/hush_test/hush-signals/savetrap.tests create mode 100644 shell/hush_test/hush-signals/signal7.right create mode 100755 shell/hush_test/hush-signals/signal7.tests create mode 100644 shell/hush_test/hush-signals/signal_read1.right create mode 100755 shell/hush_test/hush-signals/signal_read1.tests create mode 100644 shell/hush_test/hush-signals/signal_read2.right create mode 100755 shell/hush_test/hush-signals/signal_read2.tests create mode 100644 shell/hush_test/hush-signals/subshell.right create mode 100755 shell/hush_test/hush-signals/subshell.tests create mode 100644 shell/hush_test/hush-signals/usage.right create mode 100755 shell/hush_test/hush-signals/usage.tests delete mode 100644 shell/hush_test/hush-trap/catch.right delete mode 100755 shell/hush_test/hush-trap/catch.tests delete mode 100644 shell/hush_test/hush-trap/exit.right delete mode 100755 shell/hush_test/hush-trap/exit.tests delete mode 100644 shell/hush_test/hush-trap/return_in_trap1.right delete mode 100755 shell/hush_test/hush-trap/return_in_trap1.tests delete mode 100644 shell/hush_test/hush-trap/save-ret.right delete mode 100755 shell/hush_test/hush-trap/save-ret.tests delete mode 100644 shell/hush_test/hush-trap/savetrap.right delete mode 100755 shell/hush_test/hush-trap/savetrap.tests delete mode 100644 shell/hush_test/hush-trap/signal7.right delete mode 100755 shell/hush_test/hush-trap/signal7.tests delete mode 100644 shell/hush_test/hush-trap/signal_read1.right delete mode 100755 shell/hush_test/hush-trap/signal_read1.tests delete mode 100644 shell/hush_test/hush-trap/signal_read2.right delete mode 100755 shell/hush_test/hush-trap/signal_read2.tests delete mode 100644 shell/hush_test/hush-trap/subshell.right delete mode 100755 shell/hush_test/hush-trap/subshell.tests delete mode 100644 shell/hush_test/hush-trap/usage.right delete mode 100755 shell/hush_test/hush-trap/usage.tests diff --git a/shell/ash_test/ash-signals/return_in_trap1.right b/shell/ash_test/ash-signals/return_in_trap1.right new file mode 100644 index 0000000..a6e6378 --- /dev/null +++ b/shell/ash_test/ash-signals/return_in_trap1.right @@ -0,0 +1,4 @@ +a:2 +b:0 +Trap +d:3 diff --git a/shell/ash_test/ash-signals/return_in_trap1.tests b/shell/ash_test/ash-signals/return_in_trap1.tests new file mode 100755 index 0000000..f249802 --- /dev/null +++ b/shell/ash_test/ash-signals/return_in_trap1.tests @@ -0,0 +1,18 @@ +a() { + (exit 2) + echo a:$? + (kill -s USR1 $$; echo b:$?; exit 3) + echo c:$? # does not execute + (exit 4) +} + +trap "echo Trap; return" USR1 +a + +echo d:$? +# It's debatable what is the correct value above. +# Does 'return' in trap sees $? == 2 or $? == 3? +# IOW: after (kill..), does shell first wait for its completion +# and sets $?, then checks pending signals and runs a trap handler, +# or does it first checks pending signals and runs handler? +# hush does the former, and prints 3. diff --git a/shell/hush_test/hush-signals/catch.right b/shell/hush_test/hush-signals/catch.right new file mode 100644 index 0000000..80a062c --- /dev/null +++ b/shell/hush_test/hush-signals/catch.right @@ -0,0 +1,5 @@ +sending USR2 +caught +sending USR2 +sending USR2 +USR2 diff --git a/shell/hush_test/hush-signals/catch.tests b/shell/hush_test/hush-signals/catch.tests new file mode 100755 index 0000000..d2a21d1 --- /dev/null +++ b/shell/hush_test/hush-signals/catch.tests @@ -0,0 +1,20 @@ +# avoid ugly warnings about signals not being caught +trap ":" USR1 USR2 + +"$THIS_SH" -c ' +trap "echo caught" USR2 +echo "sending USR2" +kill -USR2 $$ + +trap "" USR2 +echo "sending USR2" +kill -USR2 $$ + +trap "-" USR2 +echo "sending USR2" +kill -USR2 $$ + +echo "not reached" +' + +trap "-" USR1 USR2 diff --git a/shell/hush_test/hush-signals/exit.right b/shell/hush_test/hush-signals/exit.right new file mode 100644 index 0000000..3d00725 --- /dev/null +++ b/shell/hush_test/hush-signals/exit.right @@ -0,0 +1,12 @@ +cow +moo +Traps1: +trap -- 'exitfunc' EXIT +Traps2: +trap -- 'echo Should not run' EXIT +Check1: 42 +Traps1: +trap -- 'exitfunc' EXIT +Traps2: +trap -- 'echo Should not run' EXIT +Check2: 42 diff --git a/shell/hush_test/hush-signals/exit.tests b/shell/hush_test/hush-signals/exit.tests new file mode 100755 index 0000000..2061105 --- /dev/null +++ b/shell/hush_test/hush-signals/exit.tests @@ -0,0 +1,34 @@ +"$THIS_SH" -c 'trap "echo cow" 0' +"$THIS_SH" -c 'trap "echo moo" EXIT' +"$THIS_SH" -c 'trap "echo no" 0; trap 0' + +( +exitfunc() { + echo "Traps1:" + trap + # EXIT trap is disabled after it is triggered, + # it can not be "re-armed" like this: + trap "echo Should not run" EXIT + echo "Traps2:" + trap +} +trap 'exitfunc' EXIT +exit 42 +) +echo Check1: $? + +( +exitfunc() { + echo "Traps1:" + trap + # EXIT trap is disabled after it is triggered, + # it can not be "re-armed" like this: + trap "echo Should not run" EXIT + echo "Traps2:" + trap + exit 42 +} +trap 'exitfunc' EXIT +exit 66 +) +echo Check2: $? diff --git a/shell/hush_test/hush-signals/return_in_trap1.right b/shell/hush_test/hush-signals/return_in_trap1.right new file mode 100644 index 0000000..a6e6378 --- /dev/null +++ b/shell/hush_test/hush-signals/return_in_trap1.right @@ -0,0 +1,4 @@ +a:2 +b:0 +Trap +d:3 diff --git a/shell/hush_test/hush-signals/return_in_trap1.tests b/shell/hush_test/hush-signals/return_in_trap1.tests new file mode 100755 index 0000000..f249802 --- /dev/null +++ b/shell/hush_test/hush-signals/return_in_trap1.tests @@ -0,0 +1,18 @@ +a() { + (exit 2) + echo a:$? + (kill -s USR1 $$; echo b:$?; exit 3) + echo c:$? # does not execute + (exit 4) +} + +trap "echo Trap; return" USR1 +a + +echo d:$? +# It's debatable what is the correct value above. +# Does 'return' in trap sees $? == 2 or $? == 3? +# IOW: after (kill..), does shell first wait for its completion +# and sets $?, then checks pending signals and runs a trap handler, +# or does it first checks pending signals and runs handler? +# hush does the former, and prints 3. diff --git a/shell/hush_test/hush-signals/save-ret.right b/shell/hush_test/hush-signals/save-ret.right new file mode 100644 index 0000000..a3e12ce --- /dev/null +++ b/shell/hush_test/hush-signals/save-ret.right @@ -0,0 +1,2 @@ +YEAH +0 diff --git a/shell/hush_test/hush-signals/save-ret.tests b/shell/hush_test/hush-signals/save-ret.tests new file mode 100755 index 0000000..0786b6d --- /dev/null +++ b/shell/hush_test/hush-signals/save-ret.tests @@ -0,0 +1,4 @@ +# make sure we do not corrupt $? across traps +trap "echo YEAH; false" USR1 +kill -USR1 $$ +echo $? diff --git a/shell/hush_test/hush-signals/savetrap.right b/shell/hush_test/hush-signals/savetrap.right new file mode 100644 index 0000000..a59225b --- /dev/null +++ b/shell/hush_test/hush-signals/savetrap.right @@ -0,0 +1,8 @@ +trap -- 'echo Exiting' EXIT +trap -- 'echo WINCH!' WINCH +trap -- 'echo Exiting' EXIT +trap -- 'echo WINCH!' WINCH +trap -- 'echo Exiting' EXIT +trap -- 'echo WINCH!' WINCH +Done +Exiting diff --git a/shell/hush_test/hush-signals/savetrap.tests b/shell/hush_test/hush-signals/savetrap.tests new file mode 100755 index 0000000..c2b312f --- /dev/null +++ b/shell/hush_test/hush-signals/savetrap.tests @@ -0,0 +1,9 @@ +trap 'echo Exiting' EXIT +trap 'echo WINCH!' SIGWINCH +v=` trap ` +echo "$v" +v=$( trap ) +echo "$v" +v=`trap` +echo "$v" +echo Done diff --git a/shell/hush_test/hush-signals/signal7.right b/shell/hush_test/hush-signals/signal7.right new file mode 100644 index 0000000..ba7453e --- /dev/null +++ b/shell/hush_test/hush-signals/signal7.right @@ -0,0 +1 @@ +Bug detected: 0 diff --git a/shell/hush_test/hush-signals/signal7.tests b/shell/hush_test/hush-signals/signal7.tests new file mode 100755 index 0000000..c2b1381 --- /dev/null +++ b/shell/hush_test/hush-signals/signal7.tests @@ -0,0 +1,18 @@ +bug() { + trap : exit + # Bug was causing sh to be run in subshell, + # as if this line is replaced with (sh -c ...; exit $?) & + # here: + sh -c 'echo REAL_CHILD=$$' & + echo PARENTS_IDEA_OF_CHILD=$! + wait # make sure bkgd shell completes +} + +bug | { +while read varval; do + eval $varval +done +test x"$REAL_CHILD" != x"" \ +&& test x"$REAL_CHILD" = x"$PARENTS_IDEA_OF_CHILD" +echo "Bug detected: $?" +} diff --git a/shell/hush_test/hush-signals/signal_read1.right b/shell/hush_test/hush-signals/signal_read1.right new file mode 100644 index 0000000..2870a8e --- /dev/null +++ b/shell/hush_test/hush-signals/signal_read1.right @@ -0,0 +1 @@ +Got HUP:0 diff --git a/shell/hush_test/hush-signals/signal_read1.tests b/shell/hush_test/hush-signals/signal_read1.tests new file mode 100755 index 0000000..1105479 --- /dev/null +++ b/shell/hush_test/hush-signals/signal_read1.tests @@ -0,0 +1,5 @@ +(sleep 1; kill -HUP $$) & +trap 'echo "Got HUP:$?"; exit' HUP +while true; do + read ignored +done diff --git a/shell/hush_test/hush-signals/signal_read2.right b/shell/hush_test/hush-signals/signal_read2.right new file mode 100644 index 0000000..71a6bc1 --- /dev/null +++ b/shell/hush_test/hush-signals/signal_read2.right @@ -0,0 +1,2 @@ +HUP +Done:129 diff --git a/shell/hush_test/hush-signals/signal_read2.tests b/shell/hush_test/hush-signals/signal_read2.tests new file mode 100755 index 0000000..eab5b9b --- /dev/null +++ b/shell/hush_test/hush-signals/signal_read2.tests @@ -0,0 +1,7 @@ +$THIS_SH -c ' +(sleep 1; kill -HUP $$) & +while true; do + read ignored +done +' +echo "Done:$?" diff --git a/shell/hush_test/hush-signals/subshell.right b/shell/hush_test/hush-signals/subshell.right new file mode 100644 index 0000000..f865b93 --- /dev/null +++ b/shell/hush_test/hush-signals/subshell.right @@ -0,0 +1,21 @@ +trap -- '' HUP +trap -- '' QUIT +trap -- '' SYS +Ok +trap -- '' HUP +trap -- '' QUIT +trap -- '' SYS +Ok +trap -- '' HUP +trap -- '' QUIT +trap -- '' SYS +Ok +trap -- '' HUP +trap -- '' QUIT +trap -- '' SYS +Ok +trap -- '' HUP +trap -- '' QUIT +trap -- '' SYS +TERM +Done diff --git a/shell/hush_test/hush-signals/subshell.tests b/shell/hush_test/hush-signals/subshell.tests new file mode 100755 index 0000000..d877f2b --- /dev/null +++ b/shell/hush_test/hush-signals/subshell.tests @@ -0,0 +1,19 @@ +# Non-empty traps should be reset in subshell + +# HUP is special in interactive shells +trap '' HUP +# QUIT is always special +trap '' QUIT +# SYS is not special +trap '' SYS +# WINCH is harmless +trap 'bad: caught WINCH' WINCH +# With TERM we'll check whether it is reset +trap 'bad: caught TERM' TERM + +(trap; "$THIS_SH" -c 'kill -HUP $PPID'; echo Ok) +(trap; "$THIS_SH" -c 'kill -QUIT $PPID'; echo Ok) +(trap; "$THIS_SH" -c 'kill -SYS $PPID'; echo Ok) +(trap; "$THIS_SH" -c 'kill -WINCH $PPID'; echo Ok) +(trap; "$THIS_SH" -c 'kill -TERM $PPID'; echo Bad: TERM is not reset) +echo Done diff --git a/shell/hush_test/hush-signals/usage.right b/shell/hush_test/hush-signals/usage.right new file mode 100644 index 0000000..c0dbd6c --- /dev/null +++ b/shell/hush_test/hush-signals/usage.right @@ -0,0 +1,14 @@ +___ +___ +___ +trap -- 'a' EXIT +trap -- 'a' INT +trap -- 'a' USR1 +trap -- 'a' USR2 +___ +___ +trap -- 'a' USR1 +trap -- 'a' USR2 +___ +___ +trap -- 'a' USR2 diff --git a/shell/hush_test/hush-signals/usage.tests b/shell/hush_test/hush-signals/usage.tests new file mode 100755 index 0000000..d29c6e7 --- /dev/null +++ b/shell/hush_test/hush-signals/usage.tests @@ -0,0 +1,23 @@ +# no output -- default state +echo ___ +trap + +# assign some traps +echo ___ +trap "a" EXIT INT USR1 USR2 + +# show them all +echo ___ +trap + +# clear one +echo ___ +trap 0 INT +echo ___ +trap + +# clear another +echo ___ +trap "-" USR1 +echo ___ +trap diff --git a/shell/hush_test/hush-trap/catch.right b/shell/hush_test/hush-trap/catch.right deleted file mode 100644 index 80a062c..0000000 --- a/shell/hush_test/hush-trap/catch.right +++ /dev/null @@ -1,5 +0,0 @@ -sending USR2 -caught -sending USR2 -sending USR2 -USR2 diff --git a/shell/hush_test/hush-trap/catch.tests b/shell/hush_test/hush-trap/catch.tests deleted file mode 100755 index d2a21d1..0000000 --- a/shell/hush_test/hush-trap/catch.tests +++ /dev/null @@ -1,20 +0,0 @@ -# avoid ugly warnings about signals not being caught -trap ":" USR1 USR2 - -"$THIS_SH" -c ' -trap "echo caught" USR2 -echo "sending USR2" -kill -USR2 $$ - -trap "" USR2 -echo "sending USR2" -kill -USR2 $$ - -trap "-" USR2 -echo "sending USR2" -kill -USR2 $$ - -echo "not reached" -' - -trap "-" USR1 USR2 diff --git a/shell/hush_test/hush-trap/exit.right b/shell/hush_test/hush-trap/exit.right deleted file mode 100644 index 3d00725..0000000 --- a/shell/hush_test/hush-trap/exit.right +++ /dev/null @@ -1,12 +0,0 @@ -cow -moo -Traps1: -trap -- 'exitfunc' EXIT -Traps2: -trap -- 'echo Should not run' EXIT -Check1: 42 -Traps1: -trap -- 'exitfunc' EXIT -Traps2: -trap -- 'echo Should not run' EXIT -Check2: 42 diff --git a/shell/hush_test/hush-trap/exit.tests b/shell/hush_test/hush-trap/exit.tests deleted file mode 100755 index 2061105..0000000 --- a/shell/hush_test/hush-trap/exit.tests +++ /dev/null @@ -1,34 +0,0 @@ -"$THIS_SH" -c 'trap "echo cow" 0' -"$THIS_SH" -c 'trap "echo moo" EXIT' -"$THIS_SH" -c 'trap "echo no" 0; trap 0' - -( -exitfunc() { - echo "Traps1:" - trap - # EXIT trap is disabled after it is triggered, - # it can not be "re-armed" like this: - trap "echo Should not run" EXIT - echo "Traps2:" - trap -} -trap 'exitfunc' EXIT -exit 42 -) -echo Check1: $? - -( -exitfunc() { - echo "Traps1:" - trap - # EXIT trap is disabled after it is triggered, - # it can not be "re-armed" like this: - trap "echo Should not run" EXIT - echo "Traps2:" - trap - exit 42 -} -trap 'exitfunc' EXIT -exit 66 -) -echo Check2: $? diff --git a/shell/hush_test/hush-trap/return_in_trap1.right b/shell/hush_test/hush-trap/return_in_trap1.right deleted file mode 100644 index a6e6378..0000000 --- a/shell/hush_test/hush-trap/return_in_trap1.right +++ /dev/null @@ -1,4 +0,0 @@ -a:2 -b:0 -Trap -d:3 diff --git a/shell/hush_test/hush-trap/return_in_trap1.tests b/shell/hush_test/hush-trap/return_in_trap1.tests deleted file mode 100755 index f249802..0000000 --- a/shell/hush_test/hush-trap/return_in_trap1.tests +++ /dev/null @@ -1,18 +0,0 @@ -a() { - (exit 2) - echo a:$? - (kill -s USR1 $$; echo b:$?; exit 3) - echo c:$? # does not execute - (exit 4) -} - -trap "echo Trap; return" USR1 -a - -echo d:$? -# It's debatable what is the correct value above. -# Does 'return' in trap sees $? == 2 or $? == 3? -# IOW: after (kill..), does shell first wait for its completion -# and sets $?, then checks pending signals and runs a trap handler, -# or does it first checks pending signals and runs handler? -# hush does the former, and prints 3. diff --git a/shell/hush_test/hush-trap/save-ret.right b/shell/hush_test/hush-trap/save-ret.right deleted file mode 100644 index a3e12ce..0000000 --- a/shell/hush_test/hush-trap/save-ret.right +++ /dev/null @@ -1,2 +0,0 @@ -YEAH -0 diff --git a/shell/hush_test/hush-trap/save-ret.tests b/shell/hush_test/hush-trap/save-ret.tests deleted file mode 100755 index 0786b6d..0000000 --- a/shell/hush_test/hush-trap/save-ret.tests +++ /dev/null @@ -1,4 +0,0 @@ -# make sure we do not corrupt $? across traps -trap "echo YEAH; false" USR1 -kill -USR1 $$ -echo $? diff --git a/shell/hush_test/hush-trap/savetrap.right b/shell/hush_test/hush-trap/savetrap.right deleted file mode 100644 index a59225b..0000000 --- a/shell/hush_test/hush-trap/savetrap.right +++ /dev/null @@ -1,8 +0,0 @@ -trap -- 'echo Exiting' EXIT -trap -- 'echo WINCH!' WINCH -trap -- 'echo Exiting' EXIT -trap -- 'echo WINCH!' WINCH -trap -- 'echo Exiting' EXIT -trap -- 'echo WINCH!' WINCH -Done -Exiting diff --git a/shell/hush_test/hush-trap/savetrap.tests b/shell/hush_test/hush-trap/savetrap.tests deleted file mode 100755 index c2b312f..0000000 --- a/shell/hush_test/hush-trap/savetrap.tests +++ /dev/null @@ -1,9 +0,0 @@ -trap 'echo Exiting' EXIT -trap 'echo WINCH!' SIGWINCH -v=` trap ` -echo "$v" -v=$( trap ) -echo "$v" -v=`trap` -echo "$v" -echo Done diff --git a/shell/hush_test/hush-trap/signal7.right b/shell/hush_test/hush-trap/signal7.right deleted file mode 100644 index ba7453e..0000000 --- a/shell/hush_test/hush-trap/signal7.right +++ /dev/null @@ -1 +0,0 @@ -Bug detected: 0 diff --git a/shell/hush_test/hush-trap/signal7.tests b/shell/hush_test/hush-trap/signal7.tests deleted file mode 100755 index c2b1381..0000000 --- a/shell/hush_test/hush-trap/signal7.tests +++ /dev/null @@ -1,18 +0,0 @@ -bug() { - trap : exit - # Bug was causing sh to be run in subshell, - # as if this line is replaced with (sh -c ...; exit $?) & - # here: - sh -c 'echo REAL_CHILD=$$' & - echo PARENTS_IDEA_OF_CHILD=$! - wait # make sure bkgd shell completes -} - -bug | { -while read varval; do - eval $varval -done -test x"$REAL_CHILD" != x"" \ -&& test x"$REAL_CHILD" = x"$PARENTS_IDEA_OF_CHILD" -echo "Bug detected: $?" -} diff --git a/shell/hush_test/hush-trap/signal_read1.right b/shell/hush_test/hush-trap/signal_read1.right deleted file mode 100644 index 2870a8e..0000000 --- a/shell/hush_test/hush-trap/signal_read1.right +++ /dev/null @@ -1 +0,0 @@ -Got HUP:0 diff --git a/shell/hush_test/hush-trap/signal_read1.tests b/shell/hush_test/hush-trap/signal_read1.tests deleted file mode 100755 index 1105479..0000000 --- a/shell/hush_test/hush-trap/signal_read1.tests +++ /dev/null @@ -1,5 +0,0 @@ -(sleep 1; kill -HUP $$) & -trap 'echo "Got HUP:$?"; exit' HUP -while true; do - read ignored -done diff --git a/shell/hush_test/hush-trap/signal_read2.right b/shell/hush_test/hush-trap/signal_read2.right deleted file mode 100644 index 71a6bc1..0000000 --- a/shell/hush_test/hush-trap/signal_read2.right +++ /dev/null @@ -1,2 +0,0 @@ -HUP -Done:129 diff --git a/shell/hush_test/hush-trap/signal_read2.tests b/shell/hush_test/hush-trap/signal_read2.tests deleted file mode 100755 index eab5b9b..0000000 --- a/shell/hush_test/hush-trap/signal_read2.tests +++ /dev/null @@ -1,7 +0,0 @@ -$THIS_SH -c ' -(sleep 1; kill -HUP $$) & -while true; do - read ignored -done -' -echo "Done:$?" diff --git a/shell/hush_test/hush-trap/subshell.right b/shell/hush_test/hush-trap/subshell.right deleted file mode 100644 index f865b93..0000000 --- a/shell/hush_test/hush-trap/subshell.right +++ /dev/null @@ -1,21 +0,0 @@ -trap -- '' HUP -trap -- '' QUIT -trap -- '' SYS -Ok -trap -- '' HUP -trap -- '' QUIT -trap -- '' SYS -Ok -trap -- '' HUP -trap -- '' QUIT -trap -- '' SYS -Ok -trap -- '' HUP -trap -- '' QUIT -trap -- '' SYS -Ok -trap -- '' HUP -trap -- '' QUIT -trap -- '' SYS -TERM -Done diff --git a/shell/hush_test/hush-trap/subshell.tests b/shell/hush_test/hush-trap/subshell.tests deleted file mode 100755 index d877f2b..0000000 --- a/shell/hush_test/hush-trap/subshell.tests +++ /dev/null @@ -1,19 +0,0 @@ -# Non-empty traps should be reset in subshell - -# HUP is special in interactive shells -trap '' HUP -# QUIT is always special -trap '' QUIT -# SYS is not special -trap '' SYS -# WINCH is harmless -trap 'bad: caught WINCH' WINCH -# With TERM we'll check whether it is reset -trap 'bad: caught TERM' TERM - -(trap; "$THIS_SH" -c 'kill -HUP $PPID'; echo Ok) -(trap; "$THIS_SH" -c 'kill -QUIT $PPID'; echo Ok) -(trap; "$THIS_SH" -c 'kill -SYS $PPID'; echo Ok) -(trap; "$THIS_SH" -c 'kill -WINCH $PPID'; echo Ok) -(trap; "$THIS_SH" -c 'kill -TERM $PPID'; echo Bad: TERM is not reset) -echo Done diff --git a/shell/hush_test/hush-trap/usage.right b/shell/hush_test/hush-trap/usage.right deleted file mode 100644 index c0dbd6c..0000000 --- a/shell/hush_test/hush-trap/usage.right +++ /dev/null @@ -1,14 +0,0 @@ -___ -___ -___ -trap -- 'a' EXIT -trap -- 'a' INT -trap -- 'a' USR1 -trap -- 'a' USR2 -___ -___ -trap -- 'a' USR1 -trap -- 'a' USR2 -___ -___ -trap -- 'a' USR2 diff --git a/shell/hush_test/hush-trap/usage.tests b/shell/hush_test/hush-trap/usage.tests deleted file mode 100755 index d29c6e7..0000000 --- a/shell/hush_test/hush-trap/usage.tests +++ /dev/null @@ -1,23 +0,0 @@ -# no output -- default state -echo ___ -trap - -# assign some traps -echo ___ -trap "a" EXIT INT USR1 USR2 - -# show them all -echo ___ -trap - -# clear one -echo ___ -trap 0 INT -echo ___ -trap - -# clear another -echo ___ -trap "-" USR1 -echo ___ -trap -- cgit v1.1