From e16f7eb5967b9a960f4600c20690af63fb830b60 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 24 Oct 2020 04:26:43 +0200 Subject: 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 --- shell/hush_test/hush-signals/catch.right | 2 +- shell/hush_test/hush-signals/signal1.right | 20 ++++++++++++++++++ shell/hush_test/hush-signals/signal1.tests | 28 +++++++++++++++++++++++++ shell/hush_test/hush-signals/signal_read2.right | 2 +- shell/hush_test/hush-signals/subshell.right | 2 +- 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 shell/hush_test/hush-signals/signal1.right create mode 100755 shell/hush_test/hush-signals/signal1.tests (limited to 'shell/hush_test/hush-signals') diff --git a/shell/hush_test/hush-signals/catch.right b/shell/hush_test/hush-signals/catch.right index 80a062c..68530c6 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 0000000..cf403ac --- /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 0000000..6194346 --- /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 71a6bc1..87d8da3 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 f865b93..248fcc4 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 -- cgit v1.1