run_test.sh: Match color coding for PASS/SKIP/FAIL
The run_test.sh script greps for PASS/SKIP/FAIL messages in the test
output. It must avoid matching other instances of these words, eg.
FAILED,[SKIP], etc. Currently it only avoids a colon afterwards but this
needs to be generalized to use with non-kvm-unit-tests tests, like
kselftests. Since other instances never use coloring, at least for now,
match on the \e escape byte instead.
Bug: 193407077
Test: make test
Change-Id: I8fc4450c3dcbb01784fca26416f6711cd9ebedd7
diff --git a/kvm-unit-tests/run_test.sh b/kvm-unit-tests/run_test.sh
index 74ceb50..41e2e22 100755
--- a/kvm-unit-tests/run_test.sh
+++ b/kvm-unit-tests/run_test.sh
@@ -169,8 +169,8 @@
"${CMD[@]}" &> "${OUTPUT}"
EXIT_STATUS=$?
- PASS=$(grep -E -h --color=never "[^ ](PASS|SKIP)[^:]" "${OUTPUT}")
- FAIL=$(grep -E -h --color=never "[^ ]FAIL[^:]" "${OUTPUT}")
+ PASS=$(grep -E -h --color=never $'(PASS|SKIP)\x1b' "${OUTPUT}")
+ FAIL=$(grep -E -h --color=never $'FAIL\x1b' "${OUTPUT}")
# Check FAIL eagerly.
if [ -n "${FAIL}" ]; then