diff options
| author | Solthodox <100046219+Solthodox@users.noreply.github.com> | 2026-11-23 16:59:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-23 09:59:55 -0600 |
| commit | d8a9bdac18ba263c1e2d87536cb3f275c9ce69f2 (patch) | |
| tree | 0de8eb88d2e7ede4c32a302ea3375b842efde380 /scripts/ci_expected_failures.py | |
| parent | 1a9c8c9e8983525bd1e3b013e59a5d804ed7000c (diff) | |
ci: fail interrupted test runs even when partial failures are expected (#6755)
Squash-merged after diff review of PR #6755 - ci: keep interrupted runs red when partial failures are allowlisted
Diffstat (limited to 'scripts/ci_expected_failures.py')
| -rw-r--r-- | scripts/ci_expected_failures.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/ci_expected_failures.py b/scripts/ci_expected_failures.py index 2e8fafb20..8112dcf4b 100644 --- a/scripts/ci_expected_failures.py +++ b/scripts/ci_expected_failures.py | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | FAILED_LIST is a file with one failed test name per line, EXIT_STATUS the test runner's exit status, and each | 5 | FAILED_LIST is a file with one failed test name per line, EXIT_STATUS the test runner's exit status, and each |
| 6 | EXPECTED argument one or more whitespace-separated test names (so a workflow can pass one quoted list). Exits 1 when a | 6 | EXPECTED argument one or more whitespace-separated test names (so a workflow can pass one quoted list). Exits 1 when a |
| 7 | test outside EXPECTED failed, or when the runner failed without naming a test (a crash, a build error); 2 on a usage | 7 | test outside EXPECTED failed, the runner failed without naming a test, or the runner was terminated by a signal |
| 8 | error, including a non-integer EXIT_STATUS or a FAILED_LIST that cannot be read, reported as one line. `--help` prints | 8 | (its failure list can be incomplete); 2 on a usage error. `--help` prints this text. An expected failure absent |
| 9 | this text. An expected failure that passed gets a GitHub Actions notice, so the list in the workflow can shrink. | 9 | from a completed run gets a GitHub Actions notice so the list in the workflow can shrink. |
| 10 | """ | 10 | """ |
| 11 | 11 | ||
| 12 | import sys | 12 | import sys |
| @@ -16,6 +16,10 @@ def judge(failed: list[str], status: int, expected: list[str]) -> tuple[int, lis | |||
| 16 | """(exit status, GitHub Actions workflow commands to print).""" | 16 | """(exit status, GitHub Actions workflow commands to print).""" |
| 17 | unexpected = [name for name in failed if name not in expected] | 17 | unexpected = [name for name in failed if name not in expected] |
| 18 | lines = [f"::error::{name} failed" for name in unexpected] | 18 | lines = [f"::error::{name} failed" for name in unexpected] |
| 19 | # subprocess reports a signal as -N; the shell pipelines in runtime.yml report it as 128+N. | ||
| 20 | if status < 0 or 128 < status <= 255: | ||
| 21 | lines.append(f"::error::abnormal test runner exit {status}; the failure list may be incomplete") | ||
| 22 | return 1, lines | ||
| 19 | if status != 0 and not failed: | 23 | if status != 0 and not failed: |
| 20 | lines.append(f"::error::the test runner exited with {status} without naming a failed test") | 24 | lines.append(f"::error::the test runner exited with {status} without naming a failed test") |
| 21 | for name in expected: | 25 | for name in expected: |