Changeset View
Changeset View
Standalone View
Standalone View
bin/pwait/tests/pwait_test.sh
| Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
| atf_test_case time_unit | atf_test_case time_unit | ||||
| time_unit_head() | time_unit_head() | ||||
| { | { | ||||
| atf_set "descr" "Test parsing the timeout unit and value" | atf_set "descr" "Test parsing the timeout unit and value" | ||||
| } | } | ||||
| time_unit_body() | time_unit_body() | ||||
| { | { | ||||
| init=1 | |||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e inline:"pwait: timeout unit\n" \ | -e inline:"pwait: timeout unit\n" \ | ||||
| -s exit:65 \ | -s exit:65 \ | ||||
| timeout --preserve-status 2 pwait -t 1d $init | timeout --preserve-status 2 pwait -t 1d $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e inline:"pwait: timeout unit\n" \ | -e inline:"pwait: timeout unit\n" \ | ||||
| -s exit:65 \ | -s exit:65 \ | ||||
| timeout --preserve-status 2 pwait -t 1d $init | timeout --preserve-status 2 pwait -t 1d $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e inline:"pwait: timeout value\n" \ | -e inline:"pwait: timeout value\n" \ | ||||
| -s exit:65 \ | -s exit:65 \ | ||||
| timeout --preserve-status 2 pwait -t -1 $init | timeout --preserve-status 2 pwait -t -1 $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e inline:"pwait: timeout value\n" \ | -e inline:"pwait: timeout value\n" \ | ||||
| -s exit:65 \ | -s exit:65 \ | ||||
| timeout --preserve-status 2 pwait -t 100000001 $init | timeout --preserve-status 2 pwait -t 100000001 $$ | ||||
| # These long duration cases are expected to timeout from the | # These long duration cases are expected to timeout from the | ||||
| # timeout utility rather than pwait -t. | # timeout utility rather than pwait -t. | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s signal:15 \ | -s signal:15 \ | ||||
| timeout --preserve-status 2 pwait -t 100000000 $init | timeout --preserve-status 2 pwait -t 100000000 $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s signal:15 \ | -s signal:15 \ | ||||
| timeout --preserve-status 2 pwait -t 1h $init | timeout --preserve-status 2 pwait -t 1h $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s signal:15 \ | -s signal:15 \ | ||||
| timeout --preserve-status 2 pwait -t 1.5h $init | timeout --preserve-status 2 pwait -t 1.5h $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s signal:15 \ | -s signal:15 \ | ||||
| timeout --preserve-status 2 pwait -t 1m $init | timeout --preserve-status 2 pwait -t 1m $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s signal:15 \ | -s signal:15 \ | ||||
| timeout --preserve-status 2 pwait -t 1.5m $init | timeout --preserve-status 2 pwait -t 1.5m $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s signal:15 \ | -s signal:15 \ | ||||
| timeout --preserve-status 2 pwait -t 0 $init | timeout --preserve-status 2 pwait -t 0 $$ | ||||
| # The rest are fast enough that pwait -t is expected to trigger | # The rest are fast enough that pwait -t is expected to trigger | ||||
| # the timeout. | # the timeout. | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s exit:124 \ | -s exit:124 \ | ||||
| timeout --preserve-status 2 pwait -t 1s $init | timeout --preserve-status 2 pwait -t 1s $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s exit:124 \ | -s exit:124 \ | ||||
| timeout --preserve-status 2 pwait -t 1.5s $init | timeout --preserve-status 2 pwait -t 1.5s $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s exit:124 \ | -s exit:124 \ | ||||
| timeout --preserve-status 2 pwait -t 1 $init | timeout --preserve-status 2 pwait -t 1 $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s exit:124 \ | -s exit:124 \ | ||||
| timeout --preserve-status 2 pwait -t 1.5 $init | timeout --preserve-status 2 pwait -t 1.5 $$ | ||||
| atf_check \ | atf_check \ | ||||
| -o empty \ | -o empty \ | ||||
| -e empty \ | -e empty \ | ||||
| -s exit:124 \ | -s exit:124 \ | ||||
| timeout --preserve-status 2 pwait -t 0.5 $init | timeout --preserve-status 2 pwait -t 0.5 $$ | ||||
| } | } | ||||
| atf_test_case timeout_trigger_timeout | atf_test_case timeout_trigger_timeout | ||||
| timeout_trigger_timeout_head() | timeout_trigger_timeout_head() | ||||
| { | { | ||||
| atf_set "descr" "Test that exceeding the timeout is detected" | atf_set "descr" "Test that exceeding the timeout is detected" | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 198 Lines • Show Last 20 Lines | |||||