hush: add tests for interrupting read
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
54e9e1217c
commit
bcf1fa80f3
1
shell/hush_test/hush-trap/signal_read1.right
Normal file
1
shell/hush_test/hush-trap/signal_read1.right
Normal file
@ -0,0 +1 @@
|
|||||||
|
Got HUP:0
|
5
shell/hush_test/hush-trap/signal_read1.tests
Executable file
5
shell/hush_test/hush-trap/signal_read1.tests
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
(sleep 1; kill -HUP $$) &
|
||||||
|
trap 'echo "Got HUP:$?"; exit' HUP
|
||||||
|
while true; do
|
||||||
|
read ignored
|
||||||
|
done
|
2
shell/hush_test/hush-trap/signal_read2.right
Normal file
2
shell/hush_test/hush-trap/signal_read2.right
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
HUP
|
||||||
|
Done:129
|
7
shell/hush_test/hush-trap/signal_read2.tests
Executable file
7
shell/hush_test/hush-trap/signal_read2.tests
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
$THIS_SH -c '
|
||||||
|
(sleep 1; kill -HUP $$) &
|
||||||
|
while true; do
|
||||||
|
read ignored
|
||||||
|
done
|
||||||
|
'
|
||||||
|
echo "Done:$?"
|
@ -48,8 +48,9 @@ do_test()
|
|||||||
*.orig|*~) ;;
|
*.orig|*~) ;;
|
||||||
#*) echo $x ; sh $x ;;
|
#*) echo $x ; sh $x ;;
|
||||||
*)
|
*)
|
||||||
|
echo -n "$1/$x:"
|
||||||
sh "$x" >"../$1-$x.fail" 2>&1 && \
|
sh "$x" >"../$1-$x.fail" 2>&1 && \
|
||||||
{ echo "$1/$x: ok"; rm "../$1-$x.fail"; } || echo "$1/$x: fail";
|
{ { echo " ok"; rm "../$1-$x.fail"; } || echo " fail"; }
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -60,6 +61,7 @@ do_test()
|
|||||||
name="${x%%.tests}"
|
name="${x%%.tests}"
|
||||||
test -f "$name.right" || continue
|
test -f "$name.right" || continue
|
||||||
# echo Running test: "$x"
|
# echo Running test: "$x"
|
||||||
|
echo -n "$1/$x:"
|
||||||
(
|
(
|
||||||
"$THIS_SH" "./$x" >"$name.xx" 2>&1
|
"$THIS_SH" "./$x" >"$name.xx" 2>&1
|
||||||
# filter C library differences
|
# filter C library differences
|
||||||
@ -70,9 +72,9 @@ do_test()
|
|||||||
diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
|
diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail"
|
||||||
)
|
)
|
||||||
case $? in
|
case $? in
|
||||||
0) echo "$1/$x: ok";;
|
0) echo " ok";;
|
||||||
77) echo "$1/$x: skip (feature disabled)";;
|
77) echo " skip (feature disabled)";;
|
||||||
*) echo "$1/$x: fail"; tret=1;;
|
*) echo " fail"; tret=1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
exit ${tret}
|
exit ${tret}
|
||||||
|
Loading…
Reference in New Issue
Block a user