Fix prow not printing log on failure
When the KUnit Prow presubmit fails, we get the following message:
```
Kunit Tool failed to run
```
regardless of how the actual test failed.
Even if the actual tests failed to run, we should print out whatever is
actually in the log; this fixes that.
Google-Bug-Id: 131624679
Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
Change-Id: I696239e4d2ff8dc98ef52edae076d5c0ab7d8392
diff --git a/kunit.sh b/kunit.sh
index 9ffd00d..8a30d61 100755
--- a/kunit.sh
+++ b/kunit.sh
@@ -23,12 +23,18 @@
# Build and run kernel, parse output, and send details to output log
python3 ./tools/testing/kunit/kunit.py run > "$ARTIFACTS/kunit.log" 2>&1
-if [[ $? -ne 0 ]]; then
- echo "Kunit Tool failed to run"
- exit 1
+EXIT_CODE=$?
+
+if [[ $EXIT_CODE -ne 0 ]]; then
+ echo "KUnit Presubmit Failed:"
+else
+ echo "KUnit Presubmit Succeeded:"
fi
-echo "KUnit Log"
echo "============================="
cat "$ARTIFACTS/kunit.log"
echo "============================="
+
+if [[ $EXIT_CODE -ne 0 ]]; then
+ exit 1
+fi