From 332fa1782b4de106d2230ba743b11c4c239796ea Mon Sep 17 00:00:00 2001 From: Dmitry Fomichev Date: Tue, 26 May 2020 06:32:55 +0900 Subject: [PATCH] t/zbd: beautify test script output The test printout columns are better aligned now. Also, the test result, PASS/FAIL, is now color-coded and that makes it easier to spot failures. Reviewed-by: Damien Le Moal Signed-off-by: Dmitry Fomichev Signed-off-by: Jens Axboe --- t/zbd/test-zbd-support | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/t/zbd/test-zbd-support b/t/zbd/test-zbd-support index de05f438..51b05dfd 100755 --- a/t/zbd/test-zbd-support +++ b/t/zbd/test-zbd-support @@ -929,19 +929,31 @@ logfile=$0.log passed=0 failed=0 +if [ -t 1 ]; then + red="\e[1;31m" + green="\e[1;32m" + end="\e[m" +else + red="" + green="" + end="" +fi rc=0 + for test_number in "${tests[@]}"; do rm -f "${logfile}.${test_number}" - echo -n "Running test $test_number ... " + echo -n "Running test $(printf "%02d" $test_number) ... " if eval "test$test_number"; then status="PASS" + cc_status="${green}${status}${end}" ((passed++)) else status="FAIL" + cc_status="${red}${status}${end}" ((failed++)) rc=1 fi - echo "$status" + echo -e "$cc_status" echo "$status" >> "${logfile}.${test_number}" done -- 2.25.1