svn commit: [25874] trunk/busybox/shell/hush_test: hush-trap
vapier at busybox.net
vapier at busybox.net
Sun Mar 29 09:54:41 UTC 2009
Author: vapier
Date: 2009-03-29 09:54:40 +0000 (Sun, 29 Mar 2009)
New Revision: 25874
Log:
add test cases for `trap` ... but disabled for now until trap support is committed
Added:
trunk/busybox/shell/hush_test/hush-trap/
trunk/busybox/shell/hush_test/hush-trap/catch.right
trunk/busybox/shell/hush_test/hush-trap/catch.tests
trunk/busybox/shell/hush_test/hush-trap/exit.right
trunk/busybox/shell/hush_test/hush-trap/exit.tests
trunk/busybox/shell/hush_test/hush-trap/save-ret.right
trunk/busybox/shell/hush_test/hush-trap/save-ret.tests
trunk/busybox/shell/hush_test/hush-trap/usage.right
trunk/busybox/shell/hush_test/hush-trap/usage.tests
Changeset:
Property changes on: trunk/busybox/shell/hush_test/hush-trap
___________________________________________________________________
Added: svn:ignore
+ *.xx
Added: trunk/busybox/shell/hush_test/hush-trap/catch.right
===================================================================
--- trunk/busybox/shell/hush_test/hush-trap/catch.right (rev 0)
+++ trunk/busybox/shell/hush_test/hush-trap/catch.right 2009-03-29 09:54:40 UTC (rev 25874)
@@ -0,0 +1,4 @@
+sending USR2
+caught
+sending USR2
+sending USR2
Added: trunk/busybox/shell/hush_test/hush-trap/catch.tests
===================================================================
--- trunk/busybox/shell/hush_test/hush-trap/catch.tests (rev 0)
+++ trunk/busybox/shell/hush_test/hush-trap/catch.tests 2009-03-29 09:54:40 UTC (rev 25874)
@@ -0,0 +1,20 @@
+# avoid ugly warnings about signals not being caught
+trap ":" USR1 USR2
+
+hush -c '
+trap "echo caught" USR2
+echo "sending USR2"
+kill -USR2 $$
+
+trap "" USR2
+echo "sending USR2"
+kill -USR2 $$
+
+trap "-" USR2
+echo "sending USR2"
+kill -USR2 $$
+
+echo "not reached"
+'
+
+trap "-" USR1 USR2
Added: trunk/busybox/shell/hush_test/hush-trap/exit.right
===================================================================
--- trunk/busybox/shell/hush_test/hush-trap/exit.right (rev 0)
+++ trunk/busybox/shell/hush_test/hush-trap/exit.right 2009-03-29 09:54:40 UTC (rev 25874)
@@ -0,0 +1,2 @@
+cow
+moo
Added: trunk/busybox/shell/hush_test/hush-trap/exit.tests
===================================================================
--- trunk/busybox/shell/hush_test/hush-trap/exit.tests (rev 0)
+++ trunk/busybox/shell/hush_test/hush-trap/exit.tests 2009-03-29 09:54:40 UTC (rev 25874)
@@ -0,0 +1,3 @@
+hush -c 'trap "echo cow" 0'
+hush -c 'trap "echo moo" EXIT'
+hush -c 'trap "echo no" 0; trap 0'
Added: trunk/busybox/shell/hush_test/hush-trap/save-ret.right
===================================================================
--- trunk/busybox/shell/hush_test/hush-trap/save-ret.right (rev 0)
+++ trunk/busybox/shell/hush_test/hush-trap/save-ret.right 2009-03-29 09:54:40 UTC (rev 25874)
@@ -0,0 +1,2 @@
+YEAH
+0
Added: trunk/busybox/shell/hush_test/hush-trap/save-ret.tests
===================================================================
--- trunk/busybox/shell/hush_test/hush-trap/save-ret.tests (rev 0)
+++ trunk/busybox/shell/hush_test/hush-trap/save-ret.tests 2009-03-29 09:54:40 UTC (rev 25874)
@@ -0,0 +1,4 @@
+# make sure we do not corrupt $? across traps
+trap "echo YEAH; false" USR1
+kill -USR1 $$
+echo $?
Added: trunk/busybox/shell/hush_test/hush-trap/usage.right
===================================================================
--- trunk/busybox/shell/hush_test/hush-trap/usage.right (rev 0)
+++ trunk/busybox/shell/hush_test/hush-trap/usage.right 2009-03-29 09:54:40 UTC (rev 25874)
@@ -0,0 +1,14 @@
+___
+___
+___
+trap -- 'a' EXIT
+trap -- 'a' INT
+trap -- 'a' USR1
+trap -- 'a' USR2
+___
+___
+trap -- 'a' USR1
+trap -- 'a' USR2
+___
+___
+trap -- 'a' USR2
Added: trunk/busybox/shell/hush_test/hush-trap/usage.tests
===================================================================
--- trunk/busybox/shell/hush_test/hush-trap/usage.tests (rev 0)
+++ trunk/busybox/shell/hush_test/hush-trap/usage.tests 2009-03-29 09:54:40 UTC (rev 25874)
@@ -0,0 +1,23 @@
+# no output -- default state
+echo ___
+trap
+
+# assign some traps
+echo ___
+trap "a" EXIT INT USR1 USR2
+
+# show them all
+echo ___
+trap
+
+# clear one
+echo ___
+trap 0 INT
+echo ___
+trap
+
+# clear another
+echo ___
+trap "-" USR1
+echo ___
+trap
More information about the busybox-cvs
mailing list