|
23 | 23 | # Tests which are "flaky" and may pass/fail randomly will still be run, |
24 | 24 | # but can be recorded below to prevent them from being checked. |
25 | 25 |
|
| 26 | +# CI-only job summary feature - write to `/dev/null` when run locally. |
| 27 | +GITHUB_STEP_SUMMARY="${GITHUB_STEP_SUMMARY:-/dev/null}" |
| 28 | + |
26 | 29 | # CLI arguments: |
27 | 30 | opentitan_path="$1" |
28 | 31 | qemu_path="$2" |
@@ -94,24 +97,20 @@ unexpected_passes="$(comm -23 "$passed" "$expected")" |
94 | 97 | status=0 |
95 | 98 |
|
96 | 99 | 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 |
100 | 103 | status=1 |
| 104 | + |
| 105 | + echo >&2 "::error::There were some unexpected test failures" |
101 | 106 | fi |
102 | 107 |
|
103 | 108 | 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 |
109 | 112 |
|
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" |
115 | 114 | fi |
116 | 115 |
|
117 | 116 | exit $status |
0 commit comments