summary refs log tree commit diff
path: root/.ci/scripts/gotestfmt
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-08-28 21:05:30 +0100
committerGitHub <noreply@github.com>2022-08-28 20:05:30 +0000
commit4f6de33f4147f745eb808b717666eb4d35a12716 (patch)
treea0617dbe7533a55944bd889ea0c4db6078e91155 /.ci/scripts/gotestfmt
parentImprove documentation around user registration (#13640) (diff)
downloadsynapse-4f6de33f4147f745eb808b717666eb4d35a12716.tar.xz
Print complement failure results last (#13639)
Since github always scrolls to the bottom of any test output, let's put the
failed tests last and hide any successful packages.
Diffstat (limited to '.ci/scripts/gotestfmt')
-rwxr-xr-x.ci/scripts/gotestfmt21
1 files changed, 21 insertions, 0 deletions
diff --git a/.ci/scripts/gotestfmt b/.ci/scripts/gotestfmt
new file mode 100755
index 0000000000..83e0ec6361
--- /dev/null
+++ b/.ci/scripts/gotestfmt
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# wraps `gotestfmt`, hiding output from successful packages unless
+# all tests passed.
+
+set -o pipefail
+set -e
+
+# tee the test results to a log, whilst also piping them into gotestfmt,
+# telling it to hide successful results, so that we can clearly see
+# unsuccessful results.
+tee complement.log | gotestfmt -hide successful-packages
+
+# gotestfmt will exit non-zero if there were any failures, so if we got to this
+# point, we must have had a successful result.
+echo "All tests successful; showing all test results"
+
+# Pipe the test results back through gotestfmt, showing all results.
+# The log file consists of JSON lines giving the test results, interspersed
+# with regular stdout lines (including reports of downloaded packages).
+grep '^{"Time":' complement.log | gotestfmt