diff options
-rw-r--r-- | init.cfg | 14 | ||||
-rwxr-xr-x | tests/dd/stats.sh | 3 | ||||
-rwxr-xr-x | tests/du/move-dir-while-traversing.sh | 1 | ||||
-rwxr-xr-x | tests/install/trap.sh | 4 | ||||
-rwxr-xr-x | tests/misc/sort-compress.sh | 4 | ||||
-rwxr-xr-x | tests/misc/stty-invalid.sh | 2 | ||||
-rwxr-xr-x | tests/misc/stty-pairs.sh | 2 | ||||
-rwxr-xr-x | tests/misc/stty-row-col.sh | 2 | ||||
-rwxr-xr-x | tests/misc/stty.sh | 2 | ||||
-rwxr-xr-x | tests/misc/timeout-group.sh | 5 | ||||
-rwxr-xr-x | tests/misc/timeout.sh | 4 |
11 files changed, 34 insertions, 9 deletions
@@ -470,6 +470,20 @@ require_proc_pid_status_() kill $pid } +# Does trap support signal names? +# Old versions of ash did not. +require_trap_signame_() +{ + (trap '' CHLD) || skip_ 'requires trap with signal name support' +} + +# Does kill support sending signal to whole group? +# dash 0.5.8 at least does not. +require_kill_group_() +{ + kill -0 -- -1 || skip_ 'requires kill with group signalling support' +} + # Return nonzero if the specified path is on a file system for # which FIEMAP support exists. Note some file systems (like ext3 and btrfs) # only support FIEMAP for files, not directories. diff --git a/tests/dd/stats.sh b/tests/dd/stats.sh index a82c66d20..da2c2d25f 100755 --- a/tests/dd/stats.sh +++ b/tests/dd/stats.sh @@ -18,8 +18,9 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ dd +require_trap_signame_ -env kill -l | grep '^INFO$' && SIGINFO='INFO' || SIGINFO='USR1' +kill -l | grep 'INFO' && SIGINFO='INFO' || SIGINFO='USR1' # This to avoid races in the USR1 case # as the dd process will terminate by default until diff --git a/tests/du/move-dir-while-traversing.sh b/tests/du/move-dir-while-traversing.sh index 67bb34580..a90f1c4f8 100755 --- a/tests/du/move-dir-while-traversing.sh +++ b/tests/du/move-dir-while-traversing.sh @@ -18,6 +18,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ du +require_trap_signame_ # We use a python-inotify script, so... python -m pyinotify -h > /dev/null \ diff --git a/tests/install/trap.sh b/tests/install/trap.sh index 0851ba623..157d1bc1f 100755 --- a/tests/install/trap.sh +++ b/tests/install/trap.sh @@ -19,12 +19,12 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ ginstall +require_trap_signame_ # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh. ( - # ash doesn't support "trap '' CHLD"; it knows only signal numbers. - sig=$(env kill -l CHLD 2>/dev/null) && trap '' $sig + trap '' CHLD # Before 2004-04-21, install would infloop, in the 'while (wait...' loop: exec ginstall -s "$abs_top_builddir/src/ginstall$EXEEXT" . diff --git a/tests/misc/sort-compress.sh b/tests/misc/sort-compress.sh index 584110e12..7cb5df835 100755 --- a/tests/misc/sort-compress.sh +++ b/tests/misc/sort-compress.sh @@ -18,6 +18,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ sort +require_trap_signame_ seq -w 2000 > exp || framework_failure_ tac exp > in || framework_failure_ @@ -38,8 +39,7 @@ chmod +x gzip # Ensure 'sort' is immune to parent's SIGCHLD handler # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh. ( - # ash doesn't support "trap '' CHLD"; it knows only signal numbers. - sig=$(env kill -l CHLD 2>/dev/null) && trap '' $sig + trap '' CHLD # This should force the use of child processes for "compression" PATH=.:$PATH exec sort -S 1k --compress-program=gzip in > /dev/null diff --git a/tests/misc/stty-invalid.sh b/tests/misc/stty-invalid.sh index 881146f65..49c208622 100755 --- a/tests/misc/stty-invalid.sh +++ b/tests/misc/stty-invalid.sh @@ -19,6 +19,8 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ stty require_controlling_input_terminal_ +require_trap_signame_ + trap '' TTOU # Ignore SIGTTOU diff --git a/tests/misc/stty-pairs.sh b/tests/misc/stty-pairs.sh index 129c22f0f..0494343d7 100755 --- a/tests/misc/stty-pairs.sh +++ b/tests/misc/stty-pairs.sh @@ -23,6 +23,8 @@ expensive_ # Make sure there's a tty on stdin. require_controlling_input_terminal_ +require_trap_signame_ + trap '' TTOU # Ignore SIGTTOU # Get the reversible settings from stty.c. diff --git a/tests/misc/stty-row-col.sh b/tests/misc/stty-row-col.sh index 0616812ee..8c18df661 100755 --- a/tests/misc/stty-row-col.sh +++ b/tests/misc/stty-row-col.sh @@ -32,6 +32,8 @@ export LC_ALL print_ver_ stty require_controlling_input_terminal_ +require_trap_signame_ + trap '' TTOU # Ignore SIGTTOU # Versions of GNU stty from shellutils-1.9.2c and earlier failed diff --git a/tests/misc/stty.sh b/tests/misc/stty.sh index 5e39b72e5..217891a1a 100755 --- a/tests/misc/stty.sh +++ b/tests/misc/stty.sh @@ -21,6 +21,8 @@ print_ver_ stty require_controlling_input_terminal_ +require_trap_signame_ + trap '' TTOU # Ignore SIGTTOU # Get the reversible settings from stty.c. diff --git a/tests/misc/timeout-group.sh b/tests/misc/timeout-group.sh index d47f0dc83..029048f40 100755 --- a/tests/misc/timeout-group.sh +++ b/tests/misc/timeout-group.sh @@ -18,6 +18,8 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ timeout +require_trap_signame_ +require_kill_group_ # construct a program group hierarchy as follows: # timeout-group - foreground group @@ -66,8 +68,7 @@ setsid ./group.sh & pid=$! # Wait 6.3s for timeout.cmd to start retry_delay_ check_timeout_cmd_running .1 6 || fail=1 # Simulate a Ctrl-C to the group to test timely exit -# Note dash doesn't support signalling groups (a leading -) -env kill -INT -- -$pid +kill -INT -- -$pid wait test -e int.received || fail=1 diff --git a/tests/misc/timeout.sh b/tests/misc/timeout.sh index 3cebd3302..ec77d61e8 100755 --- a/tests/misc/timeout.sh +++ b/tests/misc/timeout.sh @@ -18,6 +18,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ timeout +require_trap_signame_ # no timeout timeout 10 true || fail=1 @@ -50,8 +51,7 @@ test $? = 124 && fail=1 # Ensure 'timeout' is immune to parent's SIGCHLD handler # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh. ( - # ash doesn't support "trap '' CHLD"; it knows only signal numbers. - sig=$(env kill -l CHLD 2>/dev/null) && trap '' $sig + trap '' CHLD exec timeout 10 true ) || fail=1 |