[git commit] hush: add tests for interrupting read

Denys Vlasenko vda.linux at googlemail.com
Sun May 8 23:05:33 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=bcf1fa80f31468a2299b681dd096d41a0b5ed7f4
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 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/run-all                      |   10 ++++++----
 5 files changed, 21 insertions(+), 4 deletions(-)
 create mode 100644 shell/hush_test/hush-trap/signal_read1.right
 create mode 100755 shell/hush_test/hush-trap/signal_read1.tests
 create mode 100644 shell/hush_test/hush-trap/signal_read2.right
 create mode 100755 shell/hush_test/hush-trap/signal_read2.tests

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 0000000..2870a8e
--- /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 0000000..1105479
--- /dev/null
+++ b/shell/hush_test/hush-trap/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-trap/signal_read2.right b/shell/hush_test/hush-trap/signal_read2.right
new file mode 100644
index 0000000..71a6bc1
--- /dev/null
+++ b/shell/hush_test/hush-trap/signal_read2.right
@@ -0,0 +1,2 @@
+HUP
+Done: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 0000000..eab5b9b
--- /dev/null
+++ b/shell/hush_test/hush-trap/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/run-all b/shell/hush_test/run-all
index 256f152..64a7abc 100755
--- a/shell/hush_test/run-all
+++ b/shell/hush_test/run-all
@@ -48,8 +48,9 @@ do_test()
 			*.orig|*~) ;;
 			#*) echo $x ; sh $x ;;
 			*)
+			echo -n "$1/$x:"
 			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
 	done
@@ -60,6 +61,7 @@ do_test()
 	name="${x%%.tests}"
 	test -f "$name.right" || continue
 #	echo Running test: "$x"
+	echo -n "$1/$x:"
 	(
 		"$THIS_SH" "./$x" >"$name.xx" 2>&1
 		# 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"
 	)
 	case $? in
-		0)  echo "$1/$x: ok";;
-		77) echo "$1/$x: skip (feature disabled)";;
-		*)  echo "$1/$x: fail"; tret=1;;
+		0)  echo " ok";;
+		77) echo " skip (feature disabled)";;
+		*)  echo " fail"; tret=1;;
 	esac
 	done
 	exit ${tret}
-- 
1.7.3.4



More information about the busybox-cvs mailing list