aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-signals
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-10-24 04:26:43 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2020-10-24 04:26:43 +0200
commite16f7eb5967b9a960f4600c20690af63fb830b60 (patch)
tree3a07d75e1bb30874324816aa3ec1e7a6cfc898dc /shell/hush_test/hush-signals
parentb65d6cb00fa0ea51bac4c4e62b576b43ae2c996b (diff)
downloadbusybox-e16f7eb5967b9a960f4600c20690af63fb830b60.tar.gz
hush: output bash-compat killing signal names
This significantly syncronises ash-signals and hush-signals tests. function old new delta process_wait_result 449 450 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-signals')
-rw-r--r--shell/hush_test/hush-signals/catch.right2
-rw-r--r--shell/hush_test/hush-signals/signal1.right20
-rwxr-xr-xshell/hush_test/hush-signals/signal1.tests28
-rw-r--r--shell/hush_test/hush-signals/signal_read2.right2
-rw-r--r--shell/hush_test/hush-signals/subshell.right2
5 files changed, 51 insertions, 3 deletions
diff --git a/shell/hush_test/hush-signals/catch.right b/shell/hush_test/hush-signals/catch.right
index 80a062c4b..68530c6e7 100644
--- a/shell/hush_test/hush-signals/catch.right
+++ b/shell/hush_test/hush-signals/catch.right
@@ -2,4 +2,4 @@ sending USR2
caught
sending USR2
sending USR2
-USR2
+User defined signal 2
diff --git a/shell/hush_test/hush-signals/signal1.right b/shell/hush_test/hush-signals/signal1.right
new file mode 100644
index 000000000..cf403ac62
--- /dev/null
+++ b/shell/hush_test/hush-signals/signal1.right
@@ -0,0 +1,20 @@
+got signal
+trap -- 'echo got signal' USR1
+sent 1 signal
+got signal
+wait interrupted
+trap -- 'echo got signal' USR1
+sent 2 signal
+got signal
+wait interrupted
+trap -- 'echo got signal' USR1
+sent 3 signal
+got signal
+wait interrupted
+trap -- 'echo got signal' USR1
+sent 4 signal
+got signal
+wait interrupted
+trap -- 'echo got signal' USR1
+sent 5 signal
+sleep completed
diff --git a/shell/hush_test/hush-signals/signal1.tests b/shell/hush_test/hush-signals/signal1.tests
new file mode 100755
index 000000000..61943467a
--- /dev/null
+++ b/shell/hush_test/hush-signals/signal1.tests
@@ -0,0 +1,28 @@
+trap "echo got signal" USR1
+
+for try in 1 2 3 4 5; do
+ kill -USR1 $$
+ sleep 0.2
+ echo "sent $try signal"
+done &
+
+# Ensure "wait" has something to wait for
+sleep 2 &
+
+# Ensure we do not execute "trap" below before "kill -USR1" above
+# (was getting failure on loaded machine without this)
+sleep 0.1
+
+sleeping=true
+while $sleeping; do
+ trap
+ if wait %%; then
+ echo "sleep completed"
+ sleeping=false
+ elif [ $? = 127 ]; then
+ echo "BUG: no processes to wait for?!"
+ sleeping=false
+ else
+ echo "wait interrupted"
+ fi
+done
diff --git a/shell/hush_test/hush-signals/signal_read2.right b/shell/hush_test/hush-signals/signal_read2.right
index 71a6bc16d..87d8da304 100644
--- a/shell/hush_test/hush-signals/signal_read2.right
+++ b/shell/hush_test/hush-signals/signal_read2.right
@@ -1,2 +1,2 @@
-HUP
+Hangup
Done:129
diff --git a/shell/hush_test/hush-signals/subshell.right b/shell/hush_test/hush-signals/subshell.right
index f865b932b..248fcc41a 100644
--- a/shell/hush_test/hush-signals/subshell.right
+++ b/shell/hush_test/hush-signals/subshell.right
@@ -17,5 +17,5 @@ Ok
trap -- '' HUP
trap -- '' QUIT
trap -- '' SYS
-TERM
+Terminated
Done