From 9baac3aaa9940d3f8d0019d5a8007c5795eb7898 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 13 May 2022 15:35:24 -0400 Subject: tests: Add --verbose={commands,errors,skipped,tests} options --- Makefile | 2 +- tests.sh | 47 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index f5bc34e..d11f7e1 100644 --- a/Makefile +++ b/Makefile @@ -190,7 +190,7 @@ STRATEGY_CHECKS := $(STRATEGIES:%=check-%) CHECKS := $(STRATEGY_CHECKS) check-trie check-xtimegm # Custom test flags for distcheck -DISTCHECK_FLAGS := TEST_FLAGS="--sudo --verbose" +DISTCHECK_FLAGS := TEST_FLAGS="--sudo --verbose=tests" default: bfs .PHONY: default diff --git a/tests.sh b/tests.sh index 68b3a36..0a7d8da 100755 --- a/tests.sh +++ b/tests.sh @@ -82,7 +82,7 @@ function usage() { local pad=$(printf "%*s" ${#0} "") cat <&1 fi function bfs_verbose() { - if [ "$VERBOSE" ]; then + if [ "$VERBOSE_COMMANDS" ]; then if [ -t 3 ]; then printf "${GRN}%q${RST} " "${BFS[@]}" >&3 @@ -1103,9 +1130,9 @@ function invoke_bfs() { "${BFS[@]}" "$@" } -# Silence stderr unless --verbose is set +# Silence stderr unless --verbose=errors is set function quiet() { - if [ "$VERBOSE" ]; then + if [ "$VERBOSE_ERRORS" ]; then "$@" else "$@" 2>/dev/null @@ -3356,7 +3383,7 @@ function update_eol() { EOL="\\033[${COLUMNS}G " } -if [[ -t 1 && ! "$VERBOSE" ]]; then +if [[ -t 1 && ! "$VERBOSE_TESTS" ]]; then BOL='\r\033[K' # Workaround for bash 4: checkwinsize is off by default. We can turn it on, @@ -3383,7 +3410,7 @@ for test in "${enabled_tests[@]}"; do ((++passed)) elif ((status == EX_SKIP)); then ((++skipped)) - if [ "$VERBOSE" ]; then + if [ "$VERBOSE_SKIPPED" ]; then printf "${BOL}${CYN}%s skipped!${RST}\n" "$test" fi else -- cgit v1.2.3