summaryrefslogtreecommitdiffstats
path: root/tests/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-05-20 12:52:05 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-05-20 12:52:05 -0400
commit484e05d3dc2301f95f2a3146c4680eee89d5d8d7 (patch)
treee600d5ede7f95453b5bd2e9d650c1a3fe545b615 /tests/tests.sh
parentd32c35244ae5484ff643d60a84577554e03ebdc6 (diff)
downloadbfs-484e05d3dc2301f95f2a3146c4680eee89d5d8d7.tar.xz
tests: Don't print test names to non-ttys without --verbose=tests
This should shrink the CI logs appreciably.
Diffstat (limited to 'tests/tests.sh')
-rwxr-xr-xtests/tests.sh21
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/tests.sh b/tests/tests.sh
index eaf5add..e8eb82a 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -3375,7 +3375,7 @@ function test_unexpected_operator() {
fail invoke_bfs \! -o -print
}
-BOL=
+BOL='\n'
EOL='\n'
function update_eol() {
@@ -3384,7 +3384,10 @@ function update_eol() {
EOL="\\033[${COLUMNS}G "
}
-if [[ -t 1 && ! "$VERBOSE_TESTS" ]]; then
+
+if [ "$VERBOSE_TESTS" ]; then
+ BOL=''
+elif [ -t 1 ]; then
BOL='\r\033[K'
# Workaround for bash 4: checkwinsize is off by default. We can turn it on,
@@ -3402,7 +3405,11 @@ failed=0
skipped=0
for test in "${enabled_tests[@]}"; do
- printf "${BOL}${YLW}%s${RST}${EOL}" "$test"
+ if [[ -t 1 || "$VERBOSE_TESTS" ]]; then
+ printf "${BOL}${YLW}%s${RST}${EOL}" "$test"
+ else
+ printf "."
+ fi
if [ "$VERBOSE_ERRORS" ]; then
("$test")
@@ -3426,13 +3433,15 @@ for test in "${enabled_tests[@]}"; do
fi
done
+printf "${BOL}"
+
if ((passed > 0)); then
- printf "${BOL}${GRN}tests passed: %d${RST}\n" "$passed"
+ printf "${GRN}tests passed: %d${RST}\n" "$passed"
fi
if ((skipped > 0)); then
- printf "${BOL}${CYN}tests skipped: %s${RST}\n" "$skipped"
+ printf "${CYN}tests skipped: %s${RST}\n" "$skipped"
fi
if ((failed > 0)); then
- printf "${BOL}${RED}tests failed: %s${RST}\n" "$failed"
+ printf "${RED}tests failed: %s${RST}\n" "$failed"
exit 1
fi