From 484e05d3dc2301f95f2a3146c4680eee89d5d8d7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 20 May 2022 12:52:05 -0400 Subject: tests: Don't print test names to non-ttys without --verbose=tests This should shrink the CI logs appreciably. --- tests/tests.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3