Skip to content

ci: remove pytest watchdog in favour of NTFC session timeout - #20958

Merged
xiaoxiang781216 merged 2 commits into
apache:masterfrom
Brijesh-Thakkar:ci/ntfc-session-timeout
Oct 26, 2026
Merged

xiaoxiang781216 merged 2 commits into
apache:masterfrom
Brijesh-Thakkar:ci/ntfc-session-timeout

Conversation

@Brijesh-Thakkar

Copy link
Copy Markdown
Contributor

Summary

Remove the external pkill -f pytest watchdog from .github/workflows/build.yml
in favour of NTFC's built-in session timeout, as suggested by @raiden00pl in
#17717, and fix two stale documentation lines.

  • .github/workflows/build.yml: remove
    ( sleep 7200 ; echo Killing pytest after timeout... ; pkill -f pytest )&.
    It never stopped the tests: NTFC runs pytest in-process, so no process has
    "pytest" in its command line. The pattern only matched the bash -c job
    script and the watchdog subshell (their script text contains the word), so
    on a timeout it would have killed the whole step. It is also redundant:
    NTFC enforces timeout_session from the config: section of
    config.yaml (3600 s when not set, 6000 s for sim/citest) through
    pytest-timeout's --session-timeout (ntfc/pytest/mypytest.py:350-352).
  • Documentation/testing/ntfc.rst: it installed ntfc==0.0.1, although CI
    uses 0.0.3 (8f4a5b2).
  • Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst: it told
    the reader to run configs/citest/run, which was renamed run.sh in
    b88f86b and cannot be run on its own (it needs the environment set by
    testbuild.sh). It now links to the NTFC page.

Part of #17717

Impact

  • No test limits change. The per-session limits stay as they are: 3600 s
    (NTFC default) for the citest configurations that do not set
    timeout_session, 6000 s for sim/citest.
  • Unlike the old pkill, a timeout now keeps the NTFC reports: NTFC stops
    the session, writes result/<timestamp>/ and exits with status 1, so the
    job still fails and run.sh still saves the results as artifacts.
  • The session limit is checked after each test (pytest-timeout,
    pytest_timeout.py:195-199), so a single hung test is bounded by the
    per-test timeout (800 s default in NTFC) and the session can end up to
    that much past the limit.
  • Open question for maintainers: the old watchdog also (accidentally)
    bounded a hung build at 2 hours, since it was started before
    cibuild.sh and measured the whole step. Without it the Linux job falls
    back to GitHub's default of 360 minutes (only the msys2 job has a
    timeout-minutes). A step-level timeout-minutes could be a follow-up if
    wanted.

Testing

Host: Ubuntu, Python 3.14.4 (CI uses 3.10), gcc-12.5.0, ntfc 0.0.3,
nuttx-ntfc-testing release-0.0.2, sim:citest built with the same commands
as CI (cibuild.sh -c -A -N -R -S).

Timeout check: a copy of sim/citest/config.yaml with timeout_session: 60
and the built nuttx ELF, run with the same arguments as citest/run.sh
(ntfc test --testpath=... --confpath=... --jsonconf=...):

!!!!!!!!!!!!!!!!!!!!!! session-timeout: 60.0 sec exceeded !!!!!!!!!!!!!!!!!!!!!!
======================== 1 passed in 254.65s (0:04:14) =========================
[RESULT_SUMMARY] total:1 passes:1 failures:0 skipped:0 errors:0 time:254.25 modules:1
ntfc exit code=1  elapsed=269s

NTFC stopped on its own after the first test (test_os[main], ~254 s, hence
the overshoot of the 60 s limit); the other 1526 tests were not run; the
result/<timestamp>/ directory (xml, html report, pytest.debug.log) was
written; and the exit status was 1 although the test that ran passed.

For comparison, the same ELF and config with the unchanged
timeout_session: 6000: 1221 passed / 0 failed / 306 skipped in ~1090 s
(limit not reached).

Other checks: ./tools/checkpatch.sh -g upstream/master..HEAD passes;
build.yml still parses as YAML and its if/else is intact (the else
branch now only runs cibuild.sh).

Caveat: only sim:citest was run. The QEMU targets (arm64, x86_64,
rv-virt, sabre-6quad) and the change in the real GitHub Actions workflow are
left to CI.

Note

nuttx-apps build.yml has the same watchdog and still installs
ntfc==0.0.1. I will follow up there with the same removal, bump it to 0.0.3
(as nuttx CI already uses) and make the job fail fast if all install retries
fail, as the nuttx workflow does.

Part of #17717

Generated-by: Claude Code (analysis, test runs and drafting); reviewed and tested by me.

The Linux build job starts "( sleep 7200 ; ... ; pkill -f pytest )&" in
the background before running cibuild.sh. It was meant to stop a hung
test run, but it does not do that now that the runtime tests use NTFC:
NTFC runs pytest in-process, so no process has "pytest" in its command
line. The pattern only matches the "bash -c" job script and the
watchdog subshell, because their script text contains the word
"pytest". When it fires it kills the whole step instead of the tests.

The watchdog is also redundant. NTFC enforces a session timeout itself:
"timeout_session" in the config section of config.yaml (3600 seconds
when not set, 6000 seconds for sim/citest), passed to pytest-timeout as
--session-timeout (ntfc/pytest/mypytest.py:350-352). When the limit is
reached NTFC stops the session, keeps its reports and exits with status
1, so the job still fails. A local sim:citest run with
"timeout_session: 60" confirmed this.

Note that the session timeout covers the test session only, not the
build.

Part of apache#17717

Generated-by: Claude Code
Signed-off-by: Brijesh Thakkar <[email protected]>
Documentation/testing/ntfc.rst says it installs the NTFC version
currently used by NuttX CI, but it installs 0.0.1 while CI uses 0.0.3
since 8f4a5b2 ("bump NTFC to 0.0.3"). Update the version.

The rv-virt page tells the reader to run
configs/citest/run to run the CI scripts. That file no longer exists: it
was renamed to run.sh in b88f86b and needs the environment set up by
testbuild.sh. Point to the NTFC page, which describes how to run the CI
tests locally, instead.

Part of apache#17717

Generated-by: Claude Code
Signed-off-by: Brijesh Thakkar <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 09:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions github-actions Bot added Area: CI Size: XS The size of the change in this PR is very small labels Oct 24, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

let's ignore ci error which is fixed by #20949 instead wasting ci resource by retrigger.

@xiaoxiang781216
xiaoxiang781216 merged commit bb14e4f into apache:master Oct 26, 2026
48 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CI Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants