diff --git a/tests/lib_sandbox.at b/tests/lib_sandbox.at index 48db842..e4a17fd 100644 --- a/tests/lib_sandbox.at +++ b/tests/lib_sandbox.at @@ -18,8 +18,10 @@ ATX_CHECK_LIB([ chmod +x $tmpdir/false.sh # Check both read-only and read/write mode. - check-util-lib sandbox -r -d $tmpdir - check-util-lib sandbox -d $tmpdir + ATX_RUN([ + check-util-lib sandbox -r -d $tmpdir + check-util-lib sandbox -d $tmpdir + ]) ]) AT_CLEANUP diff --git a/tests/lib_watcher.at b/tests/lib_watcher.at index 4831fda..00a6a23 100644 --- a/tests/lib_watcher.at +++ b/tests/lib_watcher.at @@ -14,7 +14,10 @@ ATX_CHECK_LIB([ tmpdir=./$(ath_fn_rand_u64_hex).tmp.d mkdir $tmpdir - check-util-lib watcher -d $tmpdir + + ATX_RUN([ + check-util-lib watcher -d $tmpdir + ]) ]) AT_CLEANUP diff --git a/tests/testsuite.at b/tests/testsuite.at index c78380c..54ad81b 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -46,12 +46,34 @@ m4_define([ATX_FEAT_PREREQ], [ fi ]) +dnl +dnl ATX_RUN_ONE(cmd) +dnl +dnl Run a pipeline of shell command(s). +dnl If it exits with a non-zero status, fail the current test. +dnl +m4_define([ATX_RUN_ONE], [ + m4_ifnblank([$1], [ + if $1; then : + else + echo "exit status: $?" + ATX_FAIL + fi + ]) +]) + +dnl +dnl ATX_RUN(cmd_list) +dnl +dnl Like ATX_RUN_ONE, but takes multiple pipelines, separated by newline. +dnl If any exits with a non-zero status, fail the current test. +dnl +m4_define([ATX_RUN], [ + m4_map([ATX_RUN_ONE], m4_split([$1], m4_newline([+]))) +]) + m4_define([ATX_CHECK_SIMPLE], [ - AT_CHECK([ - atx_line_start=$LINENO - trap 'echo "Error $? at line $(($LINENO-$atx_line_start))"; exit 1' ERR - $1 - ], , [ignore], [ignore]) + AT_CHECK([$1], , [ignore], [ignore]) ]) m4_define([ATX_CHECK_LIB], [