diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2022-12-16 15:51:59 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2022-12-16 17:26:47 -0500 |
commit | e82a7f51d4b4e90df868e5410a0445b009b54ff2 (patch) | |
tree | c9efe94083800e3ea75721fc2c529729f9f691d2 | |
parent | e50c19f284dad6b4b7b79f91cc8576a97626be8a (diff) | |
download | bfs-e82a7f51d4b4e90df868e5410a0445b009b54ff2.tar.xz |
tests: Print the skip reason for --verbose=skipped
-rw-r--r-- | tests/bfs/execdir_plus.sh | 5 | ||||
-rwxr-xr-x | tests/tests.sh | 13 |
2 files changed, 10 insertions, 8 deletions
diff --git a/tests/bfs/execdir_plus.sh b/tests/bfs/execdir_plus.sh index 9ae7764..f66b898 100644 --- a/tests/bfs/execdir_plus.sh +++ b/tests/bfs/execdir_plus.sh @@ -1,7 +1,4 @@ tree=$(invoke_bfs -D tree 2>&1 -quit) - -if [[ "$tree" == *"-S dfs"* ]]; then - skip -fi +[[ "$tree" == *"-S dfs"* ]] && skip bfs_diff basic -execdir "$TESTS/sort-args.sh" {} + diff --git a/tests/tests.sh b/tests/tests.sh index 7ccd9b5..4a95fca 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -191,7 +191,6 @@ for arg; do VERBOSE_SKIPPED=yes ;; --verbose=tests) - VERBOSE_SKIPPED=yes VERBOSE_TESTS=yes ;; --verbose) @@ -542,6 +541,15 @@ function bfs_diff() ( ) function skip() { + if [ "$VERBOSE_SKIPPED" ]; then + caller | { + read -r line file + printf "${BOL}${CYN}%s skipped!${RST} (%s)\n" "$TEST" "$(awk "NR == $line" "$file")" + } + elif [ "$VERBOSE_TESTS" ]; then + printf "${BOL}${CYN}%s skipped!${RST}\n" "$TEST" + fi + exit $EX_SKIP } @@ -673,9 +681,6 @@ for TEST in "${TEST_CASES[@]}"; do ((++passed)) elif ((status == EX_SKIP)); then ((++skipped)) - if [ "$VERBOSE_SKIPPED" ]; then - printf "${BOL}${CYN}%s skipped!${RST}\n" "$TEST" - fi else ((++failed)) [ "$VERBOSE_ERRORS" ] || cat "$TMP/stderr" >&2 |