aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-05-09 01:05:33 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-05-09 01:05:33 +0200
commitbcf1fa80f31468a2299b681dd096d41a0b5ed7f4 (patch)
tree38b0b3756b33195b56bb9e98f53c02eeb2ac2f31
parent54e9e1217c67563d70d6e2b14021293f707d7927 (diff)
downloadbusybox-w32-bcf1fa80f31468a2299b681dd096d41a0b5ed7f4.tar.gz
busybox-w32-bcf1fa80f31468a2299b681dd096d41a0b5ed7f4.tar.bz2
busybox-w32-bcf1fa80f31468a2299b681dd096d41a0b5ed7f4.zip
hush: add tests for interrupting read
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush_test/hush-trap/signal_read1.right1
-rwxr-xr-xshell/hush_test/hush-trap/signal_read1.tests5
-rw-r--r--shell/hush_test/hush-trap/signal_read2.right2
-rwxr-xr-xshell/hush_test/hush-trap/signal_read2.tests7
-rwxr-xr-xshell/hush_test/run-all10
5 files changed, 21 insertions, 4 deletions
diff --git a/shell/hush_test/hush-trap/signal_read1.right b/shell/hush_test/hush-trap/signal_read1.right
new file mode 100644
index 000000000..2870a8e70
--- /dev/null
+++ b/shell/hush_test/hush-trap/signal_read1.right
@@ -0,0 +1 @@
Got HUP:0
diff --git a/shell/hush_test/hush-trap/signal_read1.tests b/shell/hush_test/hush-trap/signal_read1.tests
new file mode 100755
index 000000000..1105479a3
--- /dev/null
+++ b/shell/hush_test/hush-trap/signal_read1.tests
@@ -0,0 +1,5 @@
1(sleep 1; kill -HUP $$) &
2trap 'echo "Got HUP:$?"; exit' HUP
3while true; do
4 read ignored
5done
diff --git a/shell/hush_test/hush-trap/signal_read2.right b/shell/hush_test/hush-trap/signal_read2.right
new file mode 100644
index 000000000..71a6bc16d
--- /dev/null
+++ b/shell/hush_test/hush-trap/signal_read2.right
@@ -0,0 +1,2 @@
1HUP
2Done:129
diff --git a/shell/hush_test/hush-trap/signal_read2.tests b/shell/hush_test/hush-trap/signal_read2.tests
new file mode 100755
index 000000000..eab5b9b5b
--- /dev/null
+++ b/shell/hush_test/hush-trap/signal_read2.tests
@@ -0,0 +1,7 @@
1$THIS_SH -c '
2(sleep 1; kill -HUP $$) &
3while true; do
4 read ignored
5done
6'
7echo "Done:$?"
diff --git a/shell/hush_test/run-all b/shell/hush_test/run-all
index 256f152dc..64a7abc47 100755
--- a/shell/hush_test/run-all
+++ b/shell/hush_test/run-all
@@ -48,8 +48,9 @@ do_test()
48 *.orig|*~) ;; 48 *.orig|*~) ;;
49 #*) echo $x ; sh $x ;; 49 #*) echo $x ; sh $x ;;
50 *) 50 *)
51 echo -n "$1/$x:"
51 sh "$x" >"../$1-$x.fail" 2>&1 && \ 52 sh "$x" >"../$1-$x.fail" 2>&1 && \
52 { echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail"; 53 { { echo " ok"; rm "../$1-$x.fail"; } || echo " fail"; }
53 ;; 54 ;;
54 esac 55 esac
55 done 56 done
@@ -60,6 +61,7 @@ do_test()
60 name="${x%%.tests}" 61 name="${x%%.tests}"
61 test -f "$name.right" || continue 62 test -f "$name.right" || continue
62# echo Running test: "$x" 63# echo Running test: "$x"
64 echo -n "$1/$x:"
63 ( 65 (
64 "$THIS_SH" "./$x" >"$name.xx" 2>&1 66 "$THIS_SH" "./$x" >"$name.xx" 2>&1
65 # filter C library differences 67 # filter C library differences
@@ -70,9 +72,9 @@ do_test()
70 diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" 72 diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
71 ) 73 )
72 case $? in 74 case $? in
73 0) echo "$1/$x: ok";; 75 0) echo " ok";;
74 77) echo "$1/$x: skip (feature disabled)";; 76 77) echo " skip (feature disabled)";;
75 *) echo "$1/$x: fail"; tret=1;; 77 *) echo " fail"; tret=1;;
76 esac 78 esac
77 done 79 done
78 exit ${tret} 80 exit ${tret}