From 81887e23429bacb1d1f330f5aea706192901932a Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 13 Feb 2008 18:09:56 +0000 Subject: ash: add a testcase for recently fixed signal bug --- shell/ash_test/ash-redir/redir.tests | 6 ------ shell/ash_test/ash-signals/signal1.right | 20 ++++++++++++++++++++ shell/ash_test/ash-signals/signal1.tests | 24 ++++++++++++++++++++++++ shell/ash_test/run-all | 6 +++++- 4 files changed, 49 insertions(+), 7 deletions(-) delete mode 100644 shell/ash_test/ash-redir/redir.tests create mode 100644 shell/ash_test/ash-signals/signal1.right create mode 100755 shell/ash_test/ash-signals/signal1.tests diff --git a/shell/ash_test/ash-redir/redir.tests b/shell/ash_test/ash-redir/redir.tests deleted file mode 100644 index 7a1a66806..000000000 --- a/shell/ash_test/ash-redir/redir.tests +++ /dev/null @@ -1,6 +0,0 @@ -# test: closed fds should stay closed -exec 1>&- -echo TEST >TEST -echo JUNK # lost: stdout is closed -cat TEST >&2 -rm TEST diff --git a/shell/ash_test/ash-signals/signal1.right b/shell/ash_test/ash-signals/signal1.right new file mode 100644 index 000000000..66c30a5f0 --- /dev/null +++ b/shell/ash_test/ash-signals/signal1.right @@ -0,0 +1,20 @@ +got signal +trap -- 'echo got signal' USR1 +sent 1 signal +got signal +sleep interrupted +trap -- 'echo got signal' USR1 +sent 2 signal +got signal +sleep interrupted +trap -- 'echo got signal' USR1 +sent 3 signal +got signal +sleep interrupted +trap -- 'echo got signal' USR1 +sent 4 signal +got signal +sleep interrupted +trap -- 'echo got signal' USR1 +sent 5 signal +sleep completed diff --git a/shell/ash_test/ash-signals/signal1.tests b/shell/ash_test/ash-signals/signal1.tests new file mode 100755 index 000000000..49a395bad --- /dev/null +++ b/shell/ash_test/ash-signals/signal1.tests @@ -0,0 +1,24 @@ +sleeping=true + +trap "echo got signal" USR1 + +for try in 1 2 3 4 5; do + kill -USR1 $$ + sleep 1 + echo sent $try signal +done & + +sleep 10 & + +while $sleeping; do + trap + if wait %%; then + echo sleep completed + sleeping=false + elif [ $? == 127 ]; then + echo no sleep tonite + sleeping=false + else + echo sleep interrupted; + fi +done diff --git a/shell/ash_test/run-all b/shell/ash_test/run-all index 02f6d2a9d..416900aa2 100755 --- a/shell/ash_test/run-all +++ b/shell/ash_test/run-all @@ -1,6 +1,9 @@ #!/bin/sh -test -x ash || { echo "No ./ash?!"; exit; } +test -x ash || { + echo "No ./ash?! Perhaps you want to run 'ln -s ../../busybox ash'" + exit +} test -x printenv || gcc -O2 -o printenv printenv.c || exit $? test -x recho || gcc -O2 -o recho recho.c || exit $? test -x zecho || gcc -O2 -o zecho zecho.c || exit $? @@ -50,6 +53,7 @@ if [ $# -lt 1 ]; then modules=`ls -d ash-*` for module in $modules; do + echo do_test $module do_test $module done else -- cgit v1.2.3