]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Colorize the Github test output
authorRich Ercolani <214141+rincebrain@users.noreply.github.com>
Wed, 16 Feb 2022 19:40:25 +0000 (14:40 -0500)
committerGitHub <noreply@github.com>
Wed, 16 Feb 2022 19:40:25 +0000 (11:40 -0800)
Let's color our workflow test output for better readability.

Reviewed by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #13000

.github/workflows/zfs-tests-functional.yml
.github/workflows/zfs-tests-sanity.yml
scripts/Makefile.am
scripts/zfs-tests-color.sh [new file with mode: 0755]

index 40d13788a96b1de6d1a8660825b84289ab0b9bc3..1a32e2e22932c4420e902a531c44915ec8cef19c 100644 (file)
@@ -59,7 +59,9 @@ jobs:
         df -h /
     - name: Tests
       run: |
-        /usr/share/zfs/zfs-tests.sh -vR -s 3G
+        set -o pipefail
+        /usr/share/zfs/zfs-tests.sh -vR -s 3G | scripts/zfs-tests-color.sh
+      shell: bash
       timeout-minutes: 330
     - name: Prepare artifacts
       if: failure()
index ea538ce714f0acca36e0d4b3e45a92d84e5cc018..d10350d2961fc5fd3edd533b219724bd9e8c8389 100644 (file)
@@ -55,7 +55,9 @@ jobs:
         df -h /
     - name: Tests
       run: |
-        /usr/share/zfs/zfs-tests.sh -vR -s 3G -r sanity
+        set -o pipefail
+        /usr/share/zfs/zfs-tests.sh -vR -s 3G -r sanity | scripts/zfs-tests-color.sh
+      shell: bash
       timeout-minutes: 330
     - name: Prepare artifacts
       if: failure()
index 77b1269a9de4fe931692fee18e5a9b5d3d836792..e2772cf1d605385023e0370ed7ee1127412fc355 100644 (file)
@@ -18,7 +18,8 @@ EXTRA_SCRIPTS = \
        make_gitrev.sh \
        man-dates.sh \
        paxcheck.sh \
-       mancheck.sh
+       mancheck.sh \
+       zfs-tests-color.sh
 
 EXTRA_DIST = \
        cstyle.pl \
diff --git a/scripts/zfs-tests-color.sh b/scripts/zfs-tests-color.sh
new file mode 100755 (executable)
index 0000000..9098abb
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# A large mass of sed for coloring zfs-tests.sh output
+# Version 2, thanks to наб.
+# Just pipe zfs-tests.sh output into this, and watch.
+
+exec "$(command -v gsed || echo sed)" \
+       -e 's/\] \[PASS\]$/] [\x1b[92mPASS\x1b[0m]/' \
+       -e 's/\] \[FAIL\]$/] [\x1b[1;91mFAIL\x1b[0m]/' \
+       -e 's/\] \[KILLED\]$/] [\x1b[1;101mKILLED\x1b[0m]/' \
+       -e 's/\] \[SKIP\]$/] [\x1b[1mSKIP\x1b[0m]/' \
+       -e 's/\] \[RERAN\]$/] [\x1b[1;93mRERAN\x1b[0m]/' \
+       -e 's/^\(PASS\W\)/\x1b[92m\1\x1b[0m/' \
+       -e 's/^\(FAIL\W\)/\x1b[1;91m\1\x1b[0m/' \
+       -e 's/^\(KILLED\W\)/\x1b[1;101m\1\x1b[0m/' \
+       -e 's/^\(SKIP\W\)/\x1b[1m\1\x1b[0m/' \
+       -e 's/^\(RERAN\W\)/\x1b[1;93m\1\x1b[0m/' \
+       -e 's/^Tests with result\(.\+\)PASS\(.\+\)$/Tests with result\1\x1b[92mPASS\x1b[0m\2/' \
+       -e 's/^\(\W\+\)\(KILLED\)\(\W\)/\1\x1b[1;101m\2\x1b[0m\3/g' \
+       -e 's/^\(\W\+\)\(FAIL\)\(\W\)/\1\x1b[1;91m\2\x1b[0m\3/g' \
+       -e 's/^\(\W\+\)\(RERUN\)\(\W\)/\1\x1b[1;93m\2\x1b[0m\3/g' \
+       -e 's/^\(\W\+\)\(SKIP\)\(\W\)/\1\x1b[1m\2\x1b[0m\3/g' \
+       -e 's/expected \(PASS\))$/expected \x1b[92m\1\x1b[0m)/' \
+       -e 's/expected \(KILLED\))$/expected \x1b[1;101m\1\x1b[0m)/' \
+       -e 's/expected \(FAIL\))$/expected \x1b[1;91m\1\x1b[0m)/' \
+       -e 's/expected \(RERUN\))$/expected \x1b[1;93m\1\x1b[0m)/' \
+       -e 's/expected \(SKIP\))$/expected \x1b[1m\1\x1b[0m)/' \
+       -e 's/^Test\( ([[:alnum:] ]\+)\)\?: \(.\+\) (run as \(.\+\)) \[\([0-9]\+:[0-9]\+\)\] \[\(.\+\)\]$/\x1b[1mTest\1: \x1b[0m\2 (run as \x1b[1m\3\x1b[0m) [\x1b[1m\4\x1b[0m\] [\5\]/'