Skip to content

Commit 996a48e

Browse files
committed
[ot] scripts/opentitan: regressions: make unexpected passes non-fatal, report summary
Tests which we expected to fail but actually passed are no longer fatal. This allows new tests to be added on the OpenTitan side without breaking the QEMU CI. A new job summary has been added which shows up as markdown on the job page rather than only the logs of the run. Signed-off-by: James Wainwright <[email protected]>
1 parent 90f2da7 commit 996a48e

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

scripts/opentitan/run-bazel-tests.sh

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ set -e
2323
# Tests which are "flaky" and may pass/fail randomly will still be run,
2424
# but can be recorded below to prevent them from being checked.
2525

26+
# CI-only job summary feature - write to `/dev/null` when run locally.
27+
GITHUB_STEP_SUMMARY="${GITHUB_STEP_SUMMARY:-/dev/null}"
28+
2629
# CLI arguments:
2730
opentitan_path="$1"
2831
qemu_path="$2"
@@ -94,24 +97,20 @@ unexpected_passes="$(comm -23 "$passed" "$expected")"
9497
status=0
9598

9699
if [ -n "$unexpected_failures" ]; then
97-
echo >&2
98-
echo >&2 Tests that we expected to pass which did NOT pass:
99-
echo "$unexpected_failures" | awk '$0=" "$0' >&2
100+
echo | tee -a "$GITHUB_STEP_SUMMARY" >&2
101+
echo "Tests that we expected to pass which did NOT pass:" | tee -a "$GITHUB_STEP_SUMMARY" >&2
102+
echo "$unexpected_failures" | awk '$0="- `"$0"`"' | tee -a "$GITHUB_STEP_SUMMARY" >&2
100103
status=1
104+
105+
echo >&2 "::error::There were some unexpected test failures"
101106
fi
102107

103108
if [ -n "$unexpected_passes" ]; then
104-
echo >&2
105-
echo >&2 Tests which passed but we did NOT expect them to pass:
106-
echo "$unexpected_passes" | awk '$0=" "$0' >&2
107-
status=1
108-
fi
109+
echo | tee -a "$GITHUB_STEP_SUMMARY" >&2
110+
echo "Tests which passed but we did NOT expect them to pass:" | tee -a "$GITHUB_STEP_SUMMARY" >&2
111+
echo "$unexpected_passes" | awk '$0="- `"$0"`"' | tee -a "$GITHUB_STEP_SUMMARY" >&2
109112

110-
# Print helpful errors in CI.
111-
if [ $status -ne 0 ] && [ -n "$CI" ]; then
112-
echo >&2
113-
echo >&2 "::error::Bazel test results did not match the list of expected passing tests."
114-
echo >&2 "::error::Consider fixing the tests or updating the test list in ${0}."
113+
echo >&2 "::warning::Some tests passed which we did not expect"
115114
fi
116115

117116
exit $status

0 commit comments

Comments
 (0)