From d8ac823ab16fdc6c06a6a499dc5d6f0d0fc6ad19 Mon Sep 17 00:00:00 2001 From: Paul Banks Date: Thu, 19 Apr 2018 13:01:20 +0100 Subject: [PATCH] Make test output more useful now we uses testify with multi-line error messages --- GNUmakefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 030fa003d..d77342892 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -80,10 +80,14 @@ test: other-consul dev-build vet @# _something_ to stop them terminating us due to inactivity... { go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 5m $(GOTEST_PKGS) 2>&1 ; echo $$? > exit-code ; } | tee test.log | egrep '^(ok|FAIL)\s*github.com/hashicorp/consul' @echo "Exit code: $$(cat exit-code)" >> test.log - @grep -A5 'DATA RACE' test.log || true + @# This prints all the race report between ====== lines + @awk '/^WARNING: DATA RACE/ {do_print=1; print "=================="} do_print==1 {print} /^={10,}/ {do_print=0}' test.log || true @grep -A10 'panic: test timed out' test.log || true - @grep -A1 -- '--- SKIP:' test.log || true - @grep -A1 -- '--- FAIL:' test.log || true + @# Prints all the failure output until the next non-indented line - testify + @# helpers often output multiple lines for readability but useless if we can't + @# see them. + @awk '/--- SKIP/ {do_print=1} /^[^[:space:]]/ {do_print=0} do_print==1 {print}' test.log || true + @awk '/--- FAIL/ {do_print=1} /^[^[:space:]]/ {do_print=0} do_print==1 {print}' test.log || true @grep '^FAIL' test.log || true @if [ "$$(cat exit-code)" == "0" ] ; then echo "PASS" ; exit 0 ; else exit 1 ; fi