Skip to content

Commit 1a325f4

Browse files
committed
tests: strip the run-all tally with a portable escape
run-all extracts each suite's tally after stripping ANSI with a sed `\x1b` escape, which only GNU sed interprets; on any other sed the escape stays literal and the tally fails to parse. Match a literal ESC built with printf, as the surrounding color variables already are, so the strip works on any sed.
1 parent 4e97b24 commit 1a325f4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/run-all

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ for s in $SUITES; do
4747
"$b" 2>"$tmp"
4848
rc=$?
4949
cat "$tmp" >&2
50-
# ANSI may bracket the tally; strip before extracting.
50+
# ANSI may bracket the tally; strip before extracting. Match a literal ESC
51+
# (printf, as the color vars above do) rather than a GNU-sed \x1b escape, so
52+
# the strip works on any sed.
5153
line_plain=$(grep -E '[0-9]+/[0-9]+ tests passed' "$tmp" \
5254
| tail -1 \
53-
| sed 's/\x1b\[[0-9;]*m//g')
55+
| sed "s/$(printf '\033')\[[0-9;]*m//g")
5456
pass=$(printf '%s' "$line_plain" | awk '{ split($1, a, "/"); print a[1] }')
5557
count=$(printf '%s' "$line_plain" | awk '{ split($1, a, "/"); print a[2] }')
5658
rm -f "$tmp"

0 commit comments

Comments
 (0)