diff options
author | Enji Cooper <ngie@FreeBSD.org> | 2015-05-21 03:26:46 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2015-05-21 03:26:46 +0000 |
commit | 9b124abcbb2224853e26bab4193764dd77eef4c3 (patch) | |
tree | 5913920a055bbc54e56a5f97a84f8e65a3b5a929 | |
parent | 94d25974a7773307f930a633881744ad9d6d2777 (diff) |
Notes
-rw-r--r-- | atf-sh/atf_check_test.sh | 20 | ||||
-rw-r--r-- | atf-sh/misc_helpers.sh | 16 |
2 files changed, 22 insertions, 14 deletions
diff --git a/atf-sh/atf_check_test.sh b/atf-sh/atf_check_test.sh index 163e905f1ab0e..9e3cfb955f68a 100644 --- a/atf-sh/atf_check_test.sh +++ b/atf-sh/atf_check_test.sh @@ -164,18 +164,22 @@ equal_body() grep '^failed: \${x} != \${y} (a != b)$' resfile } -atf_test_case flush_stdout_on_timeout -flush_stdout_on_timeout_body() +atf_test_case flush_stdout_on_death +flush_stdout_on_death_body() { - "$(atf_get_srcdir)/misc_helpers" -s "$(atf_get_srcdir)" atf_check_timeout \ - >out 2>err & + CONTROL_FILE="$(pwd)/done" "$(atf_get_srcdir)/misc_helpers" \ + -s "$(atf_get_srcdir)" atf_check_flush_stdout >out 2>err & pid="${!}" - sleep 1 - kill "${pid}" + while [ ! -f ./done ]; do + echo "Still waiting for helper to create control file" + ls + sleep 1 + done + kill -9 "${pid}" grep 'Executing command.*true' out \ || atf_fail 'First command not in output' - grep 'Executing command.*sleep 42' out \ + grep 'Executing command.*false' out \ || atf_fail 'Second command not in output' } @@ -187,7 +191,7 @@ atf_init_test_cases() atf_add_test_case null_stdout atf_add_test_case null_stderr atf_add_test_case equal - atf_add_test_case flush_stdout_on_timeout + atf_add_test_case flush_stdout_on_death } # vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4 diff --git a/atf-sh/misc_helpers.sh b/atf-sh/misc_helpers.sh index 62d658053640e..ca0f4650d99b6 100644 --- a/atf-sh/misc_helpers.sh +++ b/atf-sh/misc_helpers.sh @@ -139,16 +139,20 @@ atf_check_equal_eval_fail_body() atf_check_equal '${x}' '${y}' } -atf_test_case atf_check_timeout -atf_check_timeout_head() +atf_test_case atf_check_flush_stdout +atf_check_flush_stdout_head() { atf_set "descr" "Helper test case for the t_atf_check test program" - atf_set "timeout" 1 + atf_set "timeout" "30" } -atf_check_timeout_body() +atf_check_flush_stdout_body() { atf_check true - atf_check sleep 42 + atf_check -s exit:1 false + touch "${CONTROL_FILE:-done}" + while :; do + sleep 1 + done } # ------------------------------------------------------------------------- @@ -281,7 +285,7 @@ atf_init_test_cases() atf_add_test_case atf_check_equal_fail atf_add_test_case atf_check_equal_eval_ok atf_add_test_case atf_check_equal_eval_fail - atf_add_test_case atf_check_timeout + atf_add_test_case atf_check_flush_stdout # Add helper tests for t_config. atf_add_test_case config_get |