Skip to content

Nigthly Fix for Slow Tests#72549

Open
jtrejoespinoza-grid wants to merge 9 commits into
project-chip:masterfrom
jtrejoespinoza-grid:nightly_fix
Open

Nigthly Fix for Slow Tests#72549
jtrejoespinoza-grid wants to merge 9 commits into
project-chip:masterfrom
jtrejoespinoza-grid:nightly_fix

Conversation

@jtrejoespinoza-grid

@jtrejoespinoza-grid jtrejoespinoza-grid commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Currently Nightly Jobs are failing because the tests are timing out but are reported as completed with correct status. This PR fix this issue:

Logs reference: https://github.com/project-chip/connectedhomeip/actions/runs/26790493182/job/78977530766

Screenshot 2026-06-11 at 10 57 47 a m

This PR fixes how to handle the subprocess wait and timeout and terminate the test and report the status code to run_python_tests.py.

Also currently the --timeout is the test timeout or the timeout the author considers is enough for the test to complete and we should let the test report this timeout. In the case for some reason this test is stuck and the framework does not respond in the test timeout the run_python_test should terminate it and avoid let zoombies process, that is the reason a +60 seconds is added on the subprocess kill over the limit provided by the --timeout in the test.

run_python_test global timeout: --timeout seconds + 60 seconds
test_timeout: --timeout -> Test can reach this timeout and fail or if is stuck global timeout will terminate the pid.

Related issues

Fixes: project-chip/matter-test-scripts#787

Testing

There are two ways to test this:

Locally:

Open a slow test like TC_SU tests which contains the --timeout argument with a timeout larger than 3 minutes.
Update the timeout with a time under 3 minutes or for quick results a --timeout of 20 seconds.

Test example:

  • TC_SU_2_5.py
    Update the --timeout
Screenshot 2026-06-11 at 11 14 05 a m

Execute the test with run_python_test.py

python3 scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_SU_2_5.py

In a second tab open the test logs.
tail -F -n 3000 /tmp/matter_testing/logs/MatterTest/latest/test_log.INFO

Verify the logs from run_python_tests.py return a status code after the 20 seconds.
Verify in the test log the test is terminated properly.

CI Jobs:

Uncomment the test section from Nightly jobs and comment the section from schedule:

# --- TEST SECTION: Uncomment below to test on PRs ---
    # push:
    #     branches:
    #         - master
    #         - 'v*-branch'
    # pull_request:
    # merge_group:
# --- END TEST SECTION ---

Verfiy Jobs are completed properly and terminated properly not as see in the first screenshot from this PR.

Checklist

  • Revert the code from nightly.yaml after review is complete and accepted.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for parsing a --timeout argument from test script arguments and applying it to the subprocess wait call. It also updates the subprocess wrapper to terminate the process if it times out during wait(), and increases the termination timeout constant. Feedback on these changes highlights two main issues: first, in tasks.py, calling self.terminate() is asynchronous and may result in a None return code, which can cause a crash in the caller; a join with a fallback return value should be used instead. Second, in run_python_test.py, parsing --timeout directly from the argument list lacks bounds and type checking, which can lead to IndexError or ValueError and should be made more robust.

Comment thread scripts/tests/run_python_test.py Outdated
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

PR #72549: Size comparison from cf7110d to dc2cc97

Full report (25 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32)
platform target config section cf7110d dc2cc97 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1094260 1094260 0 0.0
RAM 144882 144882 0 0.0
bl616 lighting-app bl616+thread FLASH 1105604 1105604 0 0.0
RAM 104280 104280 0 0.0
bl616+wifi+shell FLASH 1593352 1593352 0 0.0
RAM 98176 98176 0 0.0
bl702 lighting-app bl702+eth FLASH 1057262 1057262 0 0.0
RAM 108525 108525 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 896094 896094 0 0.0
RAM 105908 105908 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777008 777008 0 0.0
RAM 103404 103404 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 789760 789760 0 0.0
RAM 108684 108684 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 738868 738868 0 0.0
RAM 97612 97612 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 719040 719040 0 0.0
RAM 97644 97644 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 569074 569074 0 0.0
RAM 205112 205112 0 0.0
lock CC3235SF_LAUNCHXL FLASH 596626 596626 0 0.0
RAM 205272 205272 0 0.0
efr32 lighting-app BRD4187C FLASH 1094308 1094308 0 0.0
RAM 135256 135256 0 0.0
lock-app BRD4187C FLASH 994312 994312 0 0.0
RAM 131292 131292 0 0.0
BRD4338a FLASH 799129 799129 0 0.0
RAM 243432 243432 0 0.0
esp32 all-clusters-app c3devkit DRAM 99876 99876 0 0.0
FLASH 1623912 1623912 0 0.0
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 834508 834508 0 0.0
RAM 157693 157693 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1737196 1737196 0 0.0
RAM 215412 215412 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1625892 1625892 0 0.0
RAM 211604 211604 0 0.0
light cy8ckit_062s2_43012 FLASH 1470196 1470196 0 0.0
RAM 197436 197436 0 0.0
lock cy8ckit_062s2_43012 FLASH 1503652 1503652 0 0.0
RAM 225268 225268 0 0.0
qpg lighting-app qpg6200+debug FLASH 842424 842424 0 0.0
RAM 127908 127908 0 0.0
lock-app qpg6200+debug FLASH 782260 782260 0 0.0
RAM 118840 118840 0 0.0
realtek light-switch-app rtl8777g FLASH 688816 688816 0 0.0
RAM 101780 101780 0 0.0
lighting-app rtl8777g FLASH 729760 729760 0 0.0
RAM 102052 102052 0 0.0
stm32 light STM32WB5MM-DK FLASH 478464 478464 0 0.0
RAM 141492 141492 0 0.0

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.76%. Comparing base (5a8a94e) to head (565e531).
⚠️ Report is 115 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #72549      +/-   ##
==========================================
+ Coverage   55.85%   56.76%   +0.90%     
==========================================
  Files        1638     1634       -4     
  Lines      112255   112660     +405     
  Branches    13400    13143     -257     
==========================================
+ Hits        62702    63948    +1246     
+ Misses      49553    48712     -841     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

PR #72549: Size comparison from cf7110d to a9d85e7

Full report (25 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32)
platform target config section cf7110d a9d85e7 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1094260 1094260 0 0.0
RAM 144882 144882 0 0.0
bl616 lighting-app bl616+thread FLASH 1105604 1105604 0 0.0
RAM 104280 104280 0 0.0
bl616+wifi+shell FLASH 1593352 1593352 0 0.0
RAM 98176 98176 0 0.0
bl702 lighting-app bl702+eth FLASH 1057262 1057262 0 0.0
RAM 108525 108525 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 896094 896094 0 0.0
RAM 105908 105908 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777008 777008 0 0.0
RAM 103404 103404 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 789760 789760 0 0.0
RAM 108684 108684 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 738868 738868 0 0.0
RAM 97612 97612 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 719040 719040 0 0.0
RAM 97644 97644 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 569074 569074 0 0.0
RAM 205112 205112 0 0.0
lock CC3235SF_LAUNCHXL FLASH 596626 596626 0 0.0
RAM 205272 205272 0 0.0
efr32 lighting-app BRD4187C FLASH 1094308 1094308 0 0.0
RAM 135256 135256 0 0.0
lock-app BRD4187C FLASH 994312 994312 0 0.0
RAM 131292 131292 0 0.0
BRD4338a FLASH 799129 799129 0 0.0
RAM 243432 243432 0 0.0
esp32 all-clusters-app c3devkit DRAM 99876 99876 0 0.0
FLASH 1623912 1623912 0 0.0
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 834508 834508 0 0.0
RAM 157693 157693 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1737196 1737196 0 0.0
RAM 215412 215412 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1625892 1625892 0 0.0
RAM 211604 211604 0 0.0
light cy8ckit_062s2_43012 FLASH 1470196 1470196 0 0.0
RAM 197436 197436 0 0.0
lock cy8ckit_062s2_43012 FLASH 1503652 1503652 0 0.0
RAM 225268 225268 0 0.0
qpg lighting-app qpg6200+debug FLASH 842424 842424 0 0.0
RAM 127908 127908 0 0.0
lock-app qpg6200+debug FLASH 782260 782260 0 0.0
RAM 118840 118840 0 0.0
realtek light-switch-app rtl8777g FLASH 688816 688816 0 0.0
RAM 101780 101780 0 0.0
lighting-app rtl8777g FLASH 729760 729760 0 0.0
RAM 102052 102052 0 0.0
stm32 light STM32WB5MM-DK FLASH 478464 478464 0 0.0
RAM 141492 141492 0 0.0

@jtrejoespinoza-grid jtrejoespinoza-grid marked this pull request as ready for review June 12, 2026 16:52

@FrancoLionti FrancoLionti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have those three comments so far not but not too big a deal actually.

Comment thread scripts/tests/run_python_test.py Outdated
Comment thread scripts/tests/run_python_test.py
Comment on lines +323 to +326
split_args = shlex.split(script_args)
timeout_key = '--timeout'
test_arg_timeout = None
timeout_index = split_args.index(timeout_key) if timeout_key in split_args else None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The manual --timeout lookup in run_python_test.py only handles the space-separated form (--timeout 20). It looks for a standalone --timeout token and reads the next one. With --timeout=20, shlex.split() produces a single token, so the lookup misses it, test_arg_timeout stays None, and the outer Subprocess.wait() falls back to the 300s default — silently undoing the fix this PR is trying to make.

No current caller uses the = form (CI metadata uses --timeout 1800, etc.), so this is latent rather than a live bug.

runner.py already parses --timeout via argparse (type=int), which handles both forms and validates the value. Worth reusing that here (e.g. a small parse_known_args with just --timeout) instead of hand-parsing, so the orchestrator and the test script read the flag the same way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I far I know we don't use that format for CI arguments in the CI TEST ARGUMENTS section from python tests.

@jtrejoespinoza-grid jtrejoespinoza-grid Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

By the way only a few tests use "=" for arguments and for what I see only for app arguments and not for script arguments:

You can check by using sed on src/python_testing

sed -n '/BEGIN CI TEST ARGUMENTS/,/END CI TEST ARGUMENTS/p' src/python_testing/*py | grep -v "===" | grep =

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

PR #72549: Size comparison from cf7110d to e18b1f2

Full report (25 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32)
platform target config section cf7110d e18b1f2 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1094260 1094288 28 0.0
RAM 144882 144882 0 0.0
bl616 lighting-app bl616+thread FLASH 1105604 1105604 0 0.0
RAM 104280 104280 0 0.0
bl616+wifi+shell FLASH 1593352 1593384 32 0.0
RAM 98176 98176 0 0.0
bl702 lighting-app bl702+eth FLASH 1057262 1057262 0 0.0
RAM 108525 108525 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 896094 896094 0 0.0
RAM 105908 105908 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777008 777008 0 0.0
RAM 103404 103404 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 789760 789760 0 0.0
RAM 108684 108684 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 738868 738868 0 0.0
RAM 97612 97612 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 719040 719040 0 0.0
RAM 97644 97644 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 569074 569106 32 0.0
RAM 205112 205112 0 0.0
lock CC3235SF_LAUNCHXL FLASH 596626 596658 32 0.0
RAM 205272 205272 0 0.0
efr32 lighting-app BRD4187C FLASH 1094308 1094308 0 0.0
RAM 135256 135256 0 0.0
lock-app BRD4187C FLASH 994312 994320 8 0.0
RAM 131292 131292 0 0.0
BRD4338a FLASH 799129 799169 40 0.0
RAM 243432 243432 0 0.0
esp32 all-clusters-app c3devkit DRAM 99876 99876 0 0.0
FLASH 1623912 1623944 32 0.0
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 834508 834496 -12 -0.0
RAM 157693 157693 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1737196 1737236 40 0.0
RAM 215412 215412 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1625892 1625916 24 0.0
RAM 211604 211604 0 0.0
light cy8ckit_062s2_43012 FLASH 1470196 1470220 24 0.0
RAM 197436 197436 0 0.0
lock cy8ckit_062s2_43012 FLASH 1503652 1503676 24 0.0
RAM 225268 225268 0 0.0
qpg lighting-app qpg6200+debug FLASH 842424 842424 0 0.0
RAM 127908 127908 0 0.0
lock-app qpg6200+debug FLASH 782260 782260 0 0.0
RAM 118840 118840 0 0.0
realtek light-switch-app rtl8777g FLASH 688816 688816 0 0.0
RAM 101780 101780 0 0.0
lighting-app rtl8777g FLASH 729760 729760 0 0.0
RAM 102052 102052 0 0.0
stm32 light STM32WB5MM-DK FLASH 478464 478464 0 0.0
RAM 141492 141492 0 0.0

@andy31415 andy31415 changed the title Nigthly Fix fow Slow Tests Nigthly Fix for Slow Tests Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly Jobs Failing with false positive status

2 participants