GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge branch 'ci/hw_test_retry_strategy' into 'master' · espressif/esptool@6ec584a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .gitlab-ci.yml
  • .gitlab
    • README.md
    • target_tests.yml
  • pyproject.toml
  • test
    • test_esptool.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.gitlab-ci.yml‎

Copy file name to clipboardExpand all lines: .gitlab-ci.yml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ variables:
5858
- if: $CI_PIPELINE_SOURCE == "schedule"
5959
when: never
6060
- when: on_success
61+
# These failures end within seconds and say nothing about the code.
62+
retry:
63+
max: 1
64+
when: [runner_system_failure, scheduler_failure, api_failure]
6165
before_script:
6266
- pip install -e .[dev] --prefer-binary
6367
artifacts:
Collapse file

‎.gitlab/README.md‎

Copy file name to clipboardExpand all lines: .gitlab/README.md
+12-1Lines changed: 12 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ Python images: `PYTHON_IMAGE_MIN` and `PYTHON_IMAGE_LATEST` in `.gitlab-ci.yml`.
4747

4848
**report** — `combine_reports` merges coverage from test jobs.
4949

50+
## Retries
51+
52+
Failures are retried at two levels:
53+
54+
- **Job retry.** `.target_test` (`target_tests.yml`) and `.windows_test` (`.gitlab-ci.yml`) retry a job once on `runner_system_failure`, `scheduler_failure` or `api_failure`. This covers every `target_<chip>` job, `target_tests_windows` and `host_tests_windows`. Timeouts are not retried: the 60 min timeouts on `esp32` and `esp8266` came from boards dropping mid-run, and a retry costs another hour.
55+
- **Test rerun inside the job.** Outside the stub canary, a hardware test (a class derived from `EsptoolTestCase` in `test/test_esptool.py` or `test/test_esptool_sdm.py`) that fails on a serial-link or port error is rerun up to 2 times, 5 s apart (`flaky` mark with `only_rerun=TRANSPORT_ERRORS`). Assertion failures and boards that cannot be reached are not rerun, unless the assertion message quotes a matching esptool error. `TestReset::test_watchdog_reset` is the exception: its own mark reruns any failure, because its known failure on `esp32c5_32mb` is an assertion.
56+
57+
The number of reruns per job has no cap. On a link that still connects but often fails, a slow job such as `target_esp32` or `target_esp8266` (about 30 min median) could rerun many tests and reach the 60 min timeout. pytest is then killed and writes no `test/report.xml`. This has not been observed.
58+
59+
With pytest-rerunfailures, each attempt is written to `test/report.xml` as its own `<testcase>`. When a test passes on a rerun, every entry is marked passed. When every attempt fails, the earlier entries are marked passed and the last one failed. The GitLab test report view therefore shows rerun attempts as passed tests. The error of a rerun attempt is only in the job log: in the output printed while the attempt ran, and as a traceback in the "rerun test summary info" section (`-rR` lists the attempts, `--rerun-show-tracebacks` in `addopts` adds their tracebacks). The stub canary turns the in-job reruns off, so its reports hold no such entries.
60+
5061
## Canary
5162

5263
Nightly job that builds fresh v2 stubs from **esp-stub-lib** and runs the full test suite against them. All canary jobs use `$CANARY_IMAGE` (`ubuntu:24.04`).
@@ -71,7 +82,7 @@ Nightly job that builds fresh v2 stubs from **esp-stub-lib** and runs the full t
7182
| `before_script` error | not run | not run | fails, reported as failed before the comparison | no file |
7283
| pytest error (exit 2–5), git or JUnit report error | any | any | fails, reported as failed before the comparison | `error` |
7384

74-
Only the failed tests are rerun (`pytest --lf`). The committed stubs are restored with `git checkout`, which takes effect because the jobs install esptool in editable mode. Exit code 75 is listed in `allow_failure:exit_codes`, so it does not trigger `canary_on_failure`; the pipeline ends green with warnings and `canary_record` saves the SHA. `test/report.xml` holds the last run with the fresh stubs; `test/report-first.xml`, `test/report-committed.xml` and `test/canary-outcome.txt` are kept as artifacts.
85+
Only the failed tests are rerun (`pytest --lf`). The in-job reruns of the `flaky` marks in `test/test_esptool.py` (see [Retries](#retries)) are turned off when `STUB_CANARY=1`. The rerun above still hides a stub that fails only sometimes (see the known limits below). Without the in-job reruns, a stub that sometimes fails with a transport error is reported when both canary attempts fail; with them, all 6 runs would have to fail. First-run failures also stay in `test/report-first.xml`, and rerun time stays out of the duration estimate below. The committed stubs are restored with `git checkout`, which takes effect because the jobs install esptool in editable mode. Exit code 75 is listed in `allow_failure:exit_codes`, so it does not trigger `canary_on_failure`; the pipeline ends green with warnings and `canary_record` saves the SHA. `test/report.xml` holds the last run with the fresh stubs; `test/report-first.xml`, `test/report-committed.xml` and `test/canary-outcome.txt` are kept as artifacts.
7586

7687
A job killed by the 1 h job timeout counts as CI infrastructure and is not reported, and the next night would test the same SHA and time out again. `canary_pytest.py` therefore interrupts each pytest run 5 minutes before the job timeout and fails the job with the outcome `no-time`. The interrupt is repeated every 15 s, because one that arrives while a test runs `esptool.main()` in the pytest process only fails that test; pytest is killed after 60 s. When more than 5 tests fail, the rerun with the fresh stubs is skipped; random failures hit 1–3 tests per job. Before the rerun with the committed stubs, the script estimates its time as twice the sum of the failed tests' durations, taking for each test the longer of its durations in the runs with the fresh stubs; when less time is left, the job fails with `no-time` without the comparison. A test that passes with the committed stubs before an interruption still counts as stub breakage.
7788

Collapse file

‎.gitlab/target_tests.yml‎

Copy file name to clipboardExpand all lines: .gitlab/target_tests.yml
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
# committed stubs. pytest and coverage never return 75.
2626
allow_failure:
2727
exit_codes: [75]
28+
# These failures end within seconds and say nothing about the code. Timeouts
29+
# are left out: the 60 min timeouts on esp32 and esp8266 came from boards
30+
# dropping mid-run, and a retry costs another hour. Outside the stub canary,
31+
# serial-link and port-lock test failures are rerun inside the job by the flaky
32+
# marks in test_esptool.py (see .gitlab/README.md, Retries).
33+
retry:
34+
max: 1
35+
when: [runner_system_failure, scheduler_failure, api_failure]
2836
artifacts:
2937
reports:
3038
junit: test/report.xml
Collapse file

‎pyproject.toml‎

Copy file name to clipboardExpand all lines: pyproject.toml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"coverage~=6.0",
5757
"pre-commit",
5858
"pytest",
59-
"pytest-rerunfailures",
59+
"pytest-rerunfailures>=16.7",
6060
"requests",
6161
"czespressif",
6262
]
@@ -160,4 +160,4 @@
160160
docstring-code-format = true
161161

162162
[tool.pytest.ini_options]
163-
addopts = "-sv --junitxml=test/report.xml --color=yes"
163+
addopts = "-sv -rfER --rerun-show-tracebacks --junitxml=test/report.xml --color=yes"

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.