summaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-signals
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ash_test/ash-signals')
-rw-r--r--shell/ash_test/ash-signals/signal1.right20
-rwxr-xr-xshell/ash_test/ash-signals/signal1.tests24
2 files changed, 44 insertions, 0 deletions
diff --git a/shell/ash_test/ash-signals/signal1.right b/shell/ash_test/ash-signals/signal1.right
new file mode 100644
index 0000000..66c30a5
--- /dev/null
+++ b/shell/ash_test/ash-signals/signal1.right
@@ -0,0 +1,20 @@
+got signal
+trap -- 'echo got signal' USR1
+sent 1 signal
+got signal
+sleep interrupted
+trap -- 'echo got signal' USR1
+sent 2 signal
+got signal
+sleep interrupted
+trap -- 'echo got signal' USR1
+sent 3 signal
+got signal
+sleep interrupted
+trap -- 'echo got signal' USR1
+sent 4 signal
+got signal
+sleep interrupted
+trap -- 'echo got signal' USR1
+sent 5 signal
+sleep completed
diff --git a/shell/ash_test/ash-signals/signal1.tests b/shell/ash_test/ash-signals/signal1.tests
new file mode 100755
index 0000000..49a395b
--- /dev/null
+++ b/shell/ash_test/ash-signals/signal1.tests
@@ -0,0 +1,24 @@
+sleeping=true
+
+trap "echo got signal" USR1
+
+for try in 1 2 3 4 5; do
+ kill -USR1 $$
+ sleep 1
+ echo sent $try signal
+done &
+
+sleep 10 &
+
+while $sleeping; do
+ trap
+ if wait %%; then
+ echo sleep completed
+ sleeping=false
+ elif [ $? == 127 ]; then
+ echo no sleep tonite
+ sleeping=false
+ else
+ echo sleep interrupted;
+ fi
+done