Index: head/bin/pwait/tests/pwait.sh =================================================================== --- head/bin/pwait/tests/pwait.sh (revision 314942) +++ head/bin/pwait/tests/pwait.sh (revision 314943) @@ -1,242 +1,242 @@ # $FreeBSD$ atf_test_case basic basic_head() { atf_set "descr" "Basic tests on pwait(1) utility" } basic_body() { sleep 1 & p1=$! sleep 5 & p5=$! sleep 10 & p10=$! atf_check \ -o empty \ -e empty \ -s exit:0 \ - -x timeout --preserve-status 15 pwait $p1 $p5 $p10 + timeout --preserve-status 15 pwait $p1 $p5 $p10 atf_check \ -o empty \ -e inline:"kill: $p1: No such process\n" \ -s exit:1 \ - -x kill -0 $p1 + kill -0 $p1 atf_check \ -o empty \ -e inline:"kill: $p5: No such process\n" \ -s exit:1 \ - -x kill -0 $p5 + kill -0 $p5 atf_check \ -o empty \ -e inline:"kill: $p10: No such process\n" \ -s exit:1 \ - -x kill -0 $p10 + kill -0 $p10 } basic_cleanup() { kill $p1 $p5 $p10 >/dev/null 2>&1 wait $p1 $p5 $p10 >/dev/null 2>&1 } atf_test_case time_unit time_unit_head() { atf_set "descr" "Test parsing the timeout unit and value" } time_unit_body() { init=1 atf_check \ -o empty \ -e inline:"pwait: timeout unit\n" \ -s exit:65 \ - -x timeout --preserve-status 2 pwait -t 1d $init + timeout --preserve-status 2 pwait -t 1d $init atf_check \ -o empty \ -e inline:"pwait: timeout unit\n" \ -s exit:65 \ - -x timeout --preserve-status 2 pwait -t 1d $init + timeout --preserve-status 2 pwait -t 1d $init atf_check \ -o empty \ -e inline:"pwait: timeout value\n" \ -s exit:65 \ - -x timeout --preserve-status 2 pwait -t -1 $init + timeout --preserve-status 2 pwait -t -1 $init atf_check \ -o empty \ -e inline:"pwait: timeout value\n" \ -s exit:65 \ - -x timeout --preserve-status 2 pwait -t 100000001 $init + timeout --preserve-status 2 pwait -t 100000001 $init # These long duration cases are expected to timeout from the # timeout utility rather than pwait -t. atf_check \ -o empty \ -e empty \ -s exit:143 \ - -x timeout --preserve-status 2 pwait -t 100000000 $init + timeout --preserve-status 2 pwait -t 100000000 $init atf_check \ -o empty \ -e empty \ -s exit:143 \ - -x timeout --preserve-status 2 pwait -t 1h $init + timeout --preserve-status 2 pwait -t 1h $init atf_check \ -o empty \ -e empty \ -s exit:143 \ - -x timeout --preserve-status 2 pwait -t 1.5h $init + timeout --preserve-status 2 pwait -t 1.5h $init atf_check \ -o empty \ -e empty \ -s exit:143 \ - -x timeout --preserve-status 2 pwait -t 1m $init + timeout --preserve-status 2 pwait -t 1m $init atf_check \ -o empty \ -e empty \ -s exit:143 \ - -x timeout --preserve-status 2 pwait -t 1.5m $init + timeout --preserve-status 2 pwait -t 1.5m $init atf_check \ -o empty \ -e empty \ -s exit:143 \ - -x timeout --preserve-status 2 pwait -t 0 $init + timeout --preserve-status 2 pwait -t 0 $init # The rest are fast enough that pwait -t is expected to trigger # the timeout. atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout --preserve-status 2 pwait -t 1s $init + timeout --preserve-status 2 pwait -t 1s $init atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout --preserve-status 2 pwait -t 1.5s $init + timeout --preserve-status 2 pwait -t 1.5s $init atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout --preserve-status 2 pwait -t 1 $init + timeout --preserve-status 2 pwait -t 1 $init atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout --preserve-status 2 pwait -t 1.5 $init + timeout --preserve-status 2 pwait -t 1.5 $init atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout --preserve-status 2 pwait -t 0.5 $init + timeout --preserve-status 2 pwait -t 0.5 $init } atf_test_case timeout_trigger_timeout timeout_trigger_timeout_head() { atf_set "descr" "Test that exceeding the timeout is detected" } timeout_trigger_timeout_body() { sleep 10 & p10=$! atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout --preserve-status 6.5 pwait -t 5 $p10 + timeout --preserve-status 6.5 pwait -t 5 $p10 } timeout_trigger_timeout_cleanup() { kill $p10 >/dev/null 2>&1 wait $p10 >/dev/null 2>&1 } atf_test_case timeout_no_timeout timeout_no_timeout_head() { atf_set "descr" "Test that not exceeding the timeout continues to wait" } timeout_no_timeout_body() { sleep 10 & p10=$! atf_check \ -o empty \ -e empty \ -s exit:0 \ - -x timeout --preserve-status 11.5 pwait -t 12 $p10 + timeout --preserve-status 11.5 pwait -t 12 $p10 } timeout_no_timeout_cleanup() { kill $p10 >/dev/null 2>&1 wait $p10 >/dev/null 2>&1 } atf_test_case timeout_many timeout_many_head() { atf_set "descr" "Test timeout on many processes" } timeout_many_body() { sleep 1 & p1=$! sleep 5 & p5=$! sleep 10 & p10=$! atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout --preserve-status 7.5 pwait -t 6 $p1 $p5 $p10 + timeout --preserve-status 7.5 pwait -t 6 $p1 $p5 $p10 } timeout_many_cleanup() { kill $p1 $p5 $p10 >/dev/null 2>&1 wait $p1 $p5 $p10 >/dev/null 2>&1 } atf_init_test_cases() { atf_add_test_case basic atf_add_test_case time_unit atf_add_test_case timeout_trigger_timeout atf_add_test_case timeout_no_timeout atf_add_test_case timeout_many } Index: head/usr.bin/timeout/tests/timeout.sh =================================================================== --- head/usr.bin/timeout/tests/timeout.sh (revision 314942) +++ head/usr.bin/timeout/tests/timeout.sh (revision 314943) @@ -1,215 +1,215 @@ # $FreeBSD$ atf_test_case nominal nominal_head() { atf_set "descr" "Basic tests on timeout(1) utility" } nominal_body() { atf_check \ -o empty \ -e empty \ -s exit:0 \ - -x timeout 5 true + timeout 5 true } atf_test_case time_unit time_unit_head() { atf_set "descr" "Test parsing the default time unit" } time_unit_body() { atf_check \ -o empty \ -e empty \ -s exit:0 \ - -x timeout 1d true + timeout 1d true atf_check \ -o empty \ -e empty \ -s exit:0 \ - -x timeout 1h true + timeout 1h true atf_check \ -o empty \ -e empty \ -s exit:0 \ - -x timeout 1m true + timeout 1m true atf_check \ -o empty \ -e empty \ -s exit:0 \ - -x timeout 1s true + timeout 1s true } atf_test_case no_timeout no_timeout_head() { atf_set "descr" "Test disabled timeout" } no_timeout_body() { atf_check \ -o empty \ -e empty \ -s exit:0 \ - -x timeout 0 true + timeout 0 true } atf_test_case exit_numbers exit_numbers_head() { atf_set "descr" "Test exit numbers" } exit_numbers_body() { atf_check \ -o empty \ -e empty \ -s exit:2 \ -x timeout 5 sh -c \'exit 2\' atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout .1 sleep 1 + timeout .1 sleep 1 # With preserv status exit should be 128 + TERM aka 143 atf_check \ -o empty \ -e empty \ -s exit:143 \ - -x timeout --preserve-status .1 sleep 10 + timeout --preserve-status .1 sleep 10 atf_check \ -o empty \ -e empty \ -s exit:124 \ - -x timeout -s1 -k1 .1 sleep 10 + timeout -s1 -k1 .1 sleep 10 atf_check \ -o empty \ -e empty \ -s exit:0 \ -x sh -c 'trap "" CHLD; exec timeout 10 true' } atf_test_case with_a_child with_a_child_head() { atf_set "descr" "When starting with a child (coreutils bug#9098)" } with_a_child_body() { out=$(sleep .1 & exec timeout .5 sh -c 'sleep 2; echo foo') status=$? test "$out" = "" && test $status = 124 || atf_fail } atf_test_case invalid_timeout invalid_timeout_head() { atf_set "descr" "Invalid timeout" } invalid_timeout_body() { atf_check \ -o empty \ -e inline:"timeout: invalid duration\n" \ -s exit:125 \ - -x timeout invalid sleep 0 + timeout invalid sleep 0 atf_check \ -o empty \ -e inline:"timeout: invalid duration\n" \ -s exit:125 \ - -x timeout --kill-after=invalid 1 sleep 0 + timeout --kill-after=invalid 1 sleep 0 atf_check \ -o empty \ -e inline:"timeout: invalid duration\n" \ -s exit:125 \ - -x timeout 42D sleep 0 + timeout 42D sleep 0 atf_check \ -o empty \ -e inline:"timeout: invalid duration\n" \ -s exit:125 \ - -x timeout 999999999999999999999999999999999999999999999999999999999999d sleep 0 + timeout 999999999999999999999999999999999999999999999999999999999999d sleep 0 atf_check \ -o empty \ -e inline:"timeout: invalid duration\n" \ -s exit:125 \ - -x timeout 2.34e+5d sleep 0 + timeout 2.34e+5d sleep 0 } atf_test_case invalid_signal invalid_signal_head() { atf_set "descr" "Invalid signal" } invalid_signal_body() { atf_check \ -o empty \ -e inline:"timeout: invalid signal\n" \ -s exit:125 \ - -x timeout --signal=invalid 1 sleep 0 + timeout --signal=invalid 1 sleep 0 } atf_test_case invalid_command invalid_command_head() { atf_set "descr" "Invalid command" } invalid_command_body() { atf_check \ -o empty \ -e inline:"timeout: exec(.): Permission denied\n" \ -s exit:126 \ - -x timeout 10 . + timeout 10 . } atf_test_case no_such_command no_such_command_head() { atf_set "descr" "No such command" } no_such_command_body() { atf_check \ -o empty \ -e inline:"timeout: exec(enoexists): No such file or directory\n" \ -s exit:127 \ - -x timeout 10 enoexists + timeout 10 enoexists } atf_init_test_cases() { atf_add_test_case nominal atf_add_test_case time_unit atf_add_test_case no_timeout atf_add_test_case exit_numbers atf_add_test_case with_a_child atf_add_test_case invalid_timeout atf_add_test_case invalid_signal atf_add_test_case invalid_command atf_add_test_case no_such_command }