aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-13 18:09:56 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-13 18:09:56 +0000
commit81887e23429bacb1d1f330f5aea706192901932a (patch)
tree1c3d7e3936eab3ec8139a45814478f26b71252bf
parent23ffb6a4a2a01fe41abe4e42d46fa16bdc2603fd (diff)
downloadbusybox-w32-81887e23429bacb1d1f330f5aea706192901932a.tar.gz
busybox-w32-81887e23429bacb1d1f330f5aea706192901932a.tar.bz2
busybox-w32-81887e23429bacb1d1f330f5aea706192901932a.zip
ash: add a testcase for recently fixed signal bug
-rw-r--r--shell/ash_test/ash-redir/redir.tests6
-rw-r--r--shell/ash_test/ash-signals/signal1.right20
-rwxr-xr-xshell/ash_test/ash-signals/signal1.tests24
-rwxr-xr-xshell/ash_test/run-all6
4 files changed, 49 insertions, 7 deletions
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 @@
1# test: closed fds should stay closed
2exec 1>&-
3echo TEST >TEST
4echo JUNK # lost: stdout is closed
5cat TEST >&2
6rm 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 @@
1got signal
2trap -- 'echo got signal' USR1
3sent 1 signal
4got signal
5sleep interrupted
6trap -- 'echo got signal' USR1
7sent 2 signal
8got signal
9sleep interrupted
10trap -- 'echo got signal' USR1
11sent 3 signal
12got signal
13sleep interrupted
14trap -- 'echo got signal' USR1
15sent 4 signal
16got signal
17sleep interrupted
18trap -- 'echo got signal' USR1
19sent 5 signal
20sleep 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 @@
1sleeping=true
2
3trap "echo got signal" USR1
4
5for try in 1 2 3 4 5; do
6 kill -USR1 $$
7 sleep 1
8 echo sent $try signal
9done &
10
11sleep 10 &
12
13while $sleeping; do
14 trap
15 if wait %%; then
16 echo sleep completed
17 sleeping=false
18 elif [ $? == 127 ]; then
19 echo no sleep tonite
20 sleeping=false
21 else
22 echo sleep interrupted;
23 fi
24done
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 @@
1#!/bin/sh 1#!/bin/sh
2 2
3test -x ash || { echo "No ./ash?!"; exit; } 3test -x ash || {
4 echo "No ./ash?! Perhaps you want to run 'ln -s ../../busybox ash'"
5 exit
6}
4test -x printenv || gcc -O2 -o printenv printenv.c || exit $? 7test -x printenv || gcc -O2 -o printenv printenv.c || exit $?
5test -x recho || gcc -O2 -o recho recho.c || exit $? 8test -x recho || gcc -O2 -o recho recho.c || exit $?
6test -x zecho || gcc -O2 -o zecho zecho.c || exit $? 9test -x zecho || gcc -O2 -o zecho zecho.c || exit $?
@@ -50,6 +53,7 @@ if [ $# -lt 1 ]; then
50 modules=`ls -d ash-*` 53 modules=`ls -d ash-*`
51 54
52 for module in $modules; do 55 for module in $modules; do
56 echo do_test $module
53 do_test $module 57 do_test $module
54 done 58 done
55else 59else