Skip to contentSkip to conversation

tests: Inject test name also when the test fails

PATCH Applied Havard Skinnemoen 2 participants 2 messages Jun 28, 2020 – Jun 29, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: Inject test name also when the test fails

If a test is unsuccessful, the result is "not ok", which does not match the regex because it includes a space.

This regex matches both "ok" and "not ok".

---
 tests/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/Makefile.include +1 -1
index 3f4448a20b..09df2d3f86 100644
@@ -637,7 +637,7 @@ define do_test_tap
           { export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
             $(foreach COMMAND, $1, \
 	      $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
-	      | sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
+	      | sed "s/^\(not \)\?ok [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
 	      | ./scripts/tap-merge.pl | tee "$@" \
 	      | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
 	  "TAP","$@")
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog
#1 lore raw
Quoted 16 lines · Havard Skinnemoen

If a test is unsuccessful, the result is "not ok", which does not match the regex because it includes a space.

This regex matches both "ok" and "not ok".

---
 tests/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/Makefile.include +0 -0
index 3f4448a20b..09df2d3f86 100644

tests/Makefile.include define do_test_tap · line 643

Quoted 8 lines
tests/Makefile.include +1 -1
@@ -637,7 +637,7 @@ define do_test_tap
           { export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
             $(foreach COMMAND, $1, \
 	      $(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
-	      | sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
+	      | sed "s/^\(not \)\?ok [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
 	      | ./scripts/tap-merge.pl | tee "$@" \
 	      | ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
 	  "TAP","$@")

Queued, thanks.

Paolo