From: Dmitry Fomichev Date: Mon, 25 May 2020 21:32:55 +0000 (+0900) Subject: t/zbd: beautify test script output X-Git-Tag: fio-3.21~50 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=332fa1782b4de106d2230ba743b11c4c239796ea;hp=-c 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 --- 332fa1782b4de106d2230ba743b11c4c239796ea 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