8000 [Create Test] Create TC_ACL_2_10 persistence test with reboot DUT functionality by j-ororke · Pull Request #39945 · project-chip/connectedhomeip · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Create Test] Create TC_ACL_2_10 persistence test with reboot DUT functionality #39945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

j-ororke
Copy link
Contributor
@j-ororke j-ororke commented Jul 10, 2025

Summary

Creates ACL_2_10 python3 test module for ACL persistence testing, also adds in reboot logic for rebooting DUT/app during the test, key implementations include:

  • Add TC_ACL_2_10 Python test module for AccessControl cluster persistence testing
  • Remove ACL_2_10 YAML script (replaced by Python implementation)
  • Add reboot functionality to run_python_test.py test runner
  • Implement flag file mechanism for app restart signaling (/tmp/chip_test_restart_app).. Now dynamic based on test run ID.
  • Add environment variable support for app restart configuration
  • Add proper process management and cleanup for restarted apps
  • Ensure backward compatibility with existing tests

Related issues

  • Task PR Link: 621
  • Test Plan Change PR: 5324

Testing

  • Automated testing completed in WSL Linux environment

…ctionality:

- Add TC_ACL_2_10 Python test module for ACL persistence testing
- Remove legacy ACL_2_10 YAML script (replaced by Python implementation)
- Add reboot functionality to run_python_test python3 test runner
- Implement flag file mechanism for app restart signaling (/tmp/chip_test_restart_app)
- Add environment variable support for app restart configuration
- Add proper process management and cleanup for restarted apps
- Ensure backward compatibility with existing tests

The reboot functionality allows testing data persistence across device reboots,
which is essential for validating AccessControl cluster behavior.
Copy link
Contributor
@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The code changes introduce ACL persistence testing and DUT reboot functionality. The review focuses on improving the robustness of the new device reboot functionality and correcting a logic issue in the new test case.

j-ororke and others added 4 commits July 10, 2025 10:52
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Generate unique test run ID using UUID to avoid conflicts in concurrent test runs
- Replace hardcoded /tmp paths with unique paths: /tmp/chip_test_restart_app_{test_run_id}
- Add environment variables CHIP_TEST_RESTART_FLAG_FILE and CHIP_TEST_STOP_FLAG_FILE
- Update monitor function to accept flag file paths as parameters
- Maintain backward compatibility with existing tests

This prevents race conditions when multiple test instances run concurrently
on the same machine, eliminating test flakiness caused by file path conflicts.
Copy link
github-actions bot commented Jul 10, 2025

PR #39945: Size comparison from 0c0e2b9 to 04bfd28

Full report (3 builds for cc32xx, stm32)
platform target config section 0c0e2b9 04bfd28 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 548818 548818 0 0.0
RAM 205144 205144 0 0.0
lock CC3235SF_LAUNCHXL FLASH 581810 581810 0 0.0
RAM 205344 205344 0 0.0
stm32 light STM32WB5MM-DK FLASH 465260 465260 0 0.0
RAM 141376 141376 0 0.0

@j-ororke j-ororke changed the title [Create Test] Create TC_ACL_2_10 persistence test with reboot DUT functionality: [Create Test] Create TC_ACL_2_10 persistence test with reboot DUT functionality Jul 10, 2025
Copy link
Contributor
@gemini-code-assist gemini-code-assist bot left a comment

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 a new persistence test for ACL and adds the necessary DUT reboot functionality to the Python test runner. My feedback focuses on improving the robustness of the new reboot mechanism, particularly around file cleanup and preventing race conditions in concurrent test runs.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
github-actions bot commented Jul 10, 2025

PR #39945: Size comparison from 0c0e2b9 to 85a1888

Full report (14 builds for cc13x4_26x4, cc32xx, nrfconnect, qpg, stm32, tizen)
platform target config section 0c0e2b9 85a1888 change % change
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 763096 763096 0 0.0
RAM 103368 103368 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 774636 774636 0 0.0
RAM 108536 108536 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 720976 720976 0 0.0
RAM 96940 96940 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 705268 705268 0 0.0
RAM 97148 97148 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 548818 548818 0 0.0
RAM 205144 205144 0 0.0
lock CC3235SF_LAUNCHXL FLASH 581810 581810 0 0.0
RAM 205344 205344 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 888068 888068 0 0.0
RAM 166162 166162 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 897144 897144 0 0.0
RAM 145100 145100 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 858392 858392 0 0.0
RAM 141049 141049 0 0.0
qpg lighting-app qpg6200+debug FLASH 743824 743824 0 0.0
RAM 94220 94220 0 0.0
lock-app qpg6200+debug FLASH 753444 753444 0 0.0
RAM 94248 94248 0 0.0
stm32 light STM32WB5MM-DK FLASH 465260 465260 0 0.0
RAM 141376 141376 0 0.0
tizen all-clusters-app arm unknown 5096 5096 0 0.0
FLASH 1695744 1695744 0 0.0
RAM 91444 91444 0 0.0
chip-tool-ubsan arm unknown 20756 20756 0 0.0
FLASH 21046962 21046962 0 0.0
RAM 9154980 9154980 0 0.0

j-ororke and others added 2 commits July 10, 2025 12:18
…les:

- Updated test code in test steps 12-16 to resolve some redundancy when there is only one entry
- Added in a finally block so that we make sure that any flag file is removed at the end of tests that call for reboots
- Added some try-catch logic around the cleanup operations
- Moved import uuid to top of test runner script
- Enforced that flag files are set in test environment when running TC_ACL_2_10 test step 9
Copy link
github-actions bot commented Jul 10, 2025

PR #39945: Size comparison from 0c0e2b9 to 3cad3cf

Full report (72 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 0c0e2b9 3cad3cf change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1102594 1102594 0 0.0
RAM 179010 179010 0 0.0
bl702 lighting-app bl702+eth FLASH 656002 656002 0 0.0
RAM 134961 134961 0 0.0
bl702+wifi FLASH 833184 833184 0 0.0
RAM 124517 124517 0 0.0
bl706+mfd+rpc+littlefs FLASH 1065302 1065302 0 0.0
RAM 117373 117373 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 894848 894848 0 0.0
RAM 105660 105660 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 978566 978566 0 0.0
RAM 109852 109852 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 763096 763096 0 0.0
RAM 103368 103368 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 774636 774636 0 0.0
RAM 108536 108536 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 720976 720976 0 0.0
RAM 96940 96940 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 705268 705268 0 0.0
RAM 97148 97148 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 548818 548818 0 0.0
RAM 205144 205144 0 0.0
lock CC3235SF_LAUNCHXL FLASH 581810 581810 0 0.0
RAM 205344 205344 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 662581 662581 0 0.0
RAM 77472 77472 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 682433 682433 0 0.0
RAM 80112 80112 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 682433 682433 0 0.0
RAM 80112 80112 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 639365 639365 0 0.0
RAM 72540 72540 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 623805 623805 0 0.0
RAM 73784 73784 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 643441 643441 0 0.0
RAM 76336 76336 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 643441 643441 0 0.0
RAM 76336 76336 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 644765 644765 0 0.0
RAM 76784 76784 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 664481 664481 0 0.0
RAM 79336 79336 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 664481 664481 0 0.0
RAM 79336 79336 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 619545 619545 0 0.0
RAM 70888 70888 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 639397 639397 0 0.0
RAM 73520 73520 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 639397 639397 0 0.0
RAM 73520 73520 0 0.0
efr32 lock-app BRD4187C FLASH 947076 947076 0 0.0
RAM 131528 131528 0 0.0
BRD4338a FLASH 749300 749292 -8 -0.0
RAM 203072 203072 0 0.0
window-app BRD4187C FLASH 1040792 1040784 -8 -0.0
RAM 127656 127656 0 0.0
esp32 all-clusters-app c3devkit DRAM 102272 102272 0 0.0
FLASH 1780200 1780200 0 0.0
IRAM 83862 83862 0 0.0
m5stack DRAM 121156 121156 0 0.0
FLASH 1747498 1747498 0 0.0
IRAM 117071 117071 0 0.0
linux air-purifier-app debug unknown 4856 4856 0 0.0
FLASH 2796542 2796542 0 0.0
RAM 117320 117320 0 0.0
all-clusters-app debug unknown 5672 5672 0 0.0
FLASH 6197230 6197230 0 0.0
RAM 531248 531248 0 0.0
all-clusters-minimal-app debug unknown 5536 5536 0 0.0
FLASH 5473452 5473452 0 0.0
RAM 228008 228008 0 0.0
bridge-app debug unknown 5568 5568 0 0.0
FLASH 4807692 4807692 0 0.0
RAM 207712 207712 0 0.0
camera-app debug unknown 8976 8976 0 0.0
FLASH 6933259 6933259 0 0.0
RAM 230024 230024 0 0.0
camera-controller debug unknown 9216 9216 0 0.0
FLASH 14374187 14374187 0 0.0
RAM 661400 661400 0 0.0
chip-tool debug unknown 6272 6272 0 0.0
FLASH 14723561 14723561 0 0.0
RAM 654912 654912 0 0.0
chip-tool-ipv6only arm64 unknown 40656 40656 0 0.0
FLASH 12700111 12700111 0 0.0
RAM 701208 701208 0 0.0
closure-app debug unknown 5536 5536 0 0.0
FLASH 4791244 4791244 0 0.0
RAM 200616 200616 0 0.0
fabric-admin debug unknown 5952 5952 0 0.0
FLASH 12785665 12785665 0 0.0
RAM 653944 653944 0 0.0
fabric-bridge-app debug unknown 4816 4816 0 0.0
FLASH 4593024 4593024 0 0.0
RAM 193424 193424 0 0.0
fabric-sync debug unknown 5056 5056 0 0.0
FLASH 5741517 5741517 0 0.0
RAM 491760 491760 0 0.0
lighting-app debug+rpc+ui unknown 6280 6280 0 0.0
FLASH 5694481 5694481 0 0.0
RAM 209944 209944 0 0.0
lock-app debug unknown 5488 5488 0 0.0
FLASH 4836372 4836372 0 0.0
RAM 197192 197192 0 0.0
ota-provider-app debug unknown 4856 4856 0 0.0
FLASH 4446878 4446878 0 0.0
RAM 186112 186112 0 0.0
ota-requestor-app debug unknown 4736 4736 0 0.0
FLASH 4519002 4519002 0 0.0
RAM 188984 188984 0 0.0
shell debug unknown 4288 4288 0 0.0
FLASH 3076460 3076460 0 0.0
RAM 147344 147344 0 0.0
thermostat-no-ble arm64 unknown 9832 9832 0 0.0
FLASH 4236159 4236159 0 0.0
RAM 233304 233304 0 0.0
tv-app debug unknown 5824 5824 0 0.0
FLASH 6106509 6106509 0 0.0
RAM 616008 616008 0 0.0
tv-casting-app debug unknown 5352 5352 0 0.0
FLASH 12873165 12873165 0 0.0
RAM 771504 771504 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 888068 888068 0 0.0
RAM 166162 166162 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 897144 897144 0 0.0
RAM 145100 145100 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 858392 858392 0 0.0
RAM 141049 141049 0 0.0
nxp contact mcxw71+release FLASH 624768 624768 0 0.0
RAM 63164 63164 0 0.0
lock mcxw71+release FLASH 775976 775976 0 0.0
RAM 67820 67820 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1632484 1632484 0 0.0
RAM 211104 211104 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1576660 1576660 0 0.0
RAM 208472 208472 0 0.0
light cy8ckit_062s2_43012 FLASH 1449452 1449452 0 0.0
RAM 197184 197184 0 0.0
lock cy8ckit_062s2_43012 FLASH 1481708 1481708 0 0.0
RAM 224904 224904 0 0.0
qpg lighting-app qpg6200+debug FLASH 743824 743824 0 0.0
RAM 94220 94220 0 0.0
lock-app qpg6200+debug FLASH 753444 753444 0 0.0
RAM 94248 94248 0 0.0
stm32 light STM32WB5MM-DK FLASH 465260 465260 0 0.0
RAM 141376 141376 0 0.0
telink bridge-app tl7218x FLASH 702312 702312 0 0.0
RAM 93600 93600 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 794044 794044 0 0.0
RAM 44016 44016 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 782450 782450 0 0.0
RAM 100912 100912 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 709564 709564 0 0.0
RAM 54240 54240 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 746158 746158 0 0.0
RAM 77404 77404 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 722884 722884 0 0.0
RAM 36996 36996 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 602986 602986 0 0.0
RAM 112532 112532 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 818004 818008 4 0.0
RAM 99164 99164 0 0.0
tizen all-clusters-app arm unknown 5096 5096 0 0.0
FLASH 1695744 1695744 0 0.0
RAM 91444 91444 0 0.0
chip-tool-ubsan arm unknown 20756 20756 0 0.0
FLASH 21046962 21046962 0 0.0
RAM 9154980 9154980 0 0.0

@j-ororke j-ororke marked this pull request as ready for review July 11, 2025 14:57
while True:
try:
# Check if we should stop monitoring
if os.path.exists(stop_flag_file):
Copy link
Contributor

Choose a reason for hiding this comment

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

this file gets created only by this script right? If so, can you please change this over to use events rather than file existence? or terminate/sigterm

A93C
logging.info("Restarting app process...")

# Stop the existing app process
if hasattr(app_process, 'terminate'):
Copy link
Contributor

Choose a reason for hiding this comment

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

This gets started by Subprocess, so I think this should always exist, right? Are you finding places where it doesn't?

os.environ['CHIP_TEST_APP_READY_PATTERN'] = app_ready_pattern.pattern.decode() if app_ready_pattern else ""
# Signal that the app restart capability is available to the test script
os.environ['CHIP_TEST_APP_RESTART_AVAILABLE'] = '1'
os.environ['CHIP_TEST_RESTART_FLAG_FILE'] = restart_flag_file
Copy link
Contributor

Choose a reason for hiding this comment

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

if you're putting this in an environment variable, that removes the differentiation you created with the uuid 'cause there can only be one.

might just make more senses to pass this to the test file directly like we do with the named pipe files.

os.environ['CHIP_TEST_APP_ARGS'] = app_args
os.environ['CHIP_TEST_APP_READY_PATTERN'] = app_ready_pattern.pattern.decode() if app_ready_pattern else ""
# Signal that the app restart capability is available to the test script
os.environ['CHIP_TEST_APP_RESTART_AVAILABLE'] = '1'
Copy link
Contributor

Choose a reason for hiding this comment

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

This kind of makes sense, but I think you're better off passing a command line arg to the test script so it can check internally that the arg is passed correctly if it requires this functionality.

# Set environment variables for app restart capability
if app:
os.environ['CHIP_TEST_APP_PATH'] = app
os.environ['CHIP_TEST_APP_ARGS'] = app_args
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than pulling these from environment vars, it makes more sense to store these internally - they are passed to this script, so they're already available.

time.sleep(1)

# Start a new app process
new_app_process = Subprocess(app, *shlex.split(app_args),
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to do anything here to hook up the stdin processing thread?

Copy link
Contributor

Choose a reason for hiding this comment

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

actually, do you know where that gets used or why? It seems like it would clash with the testing framework.

time.sleep(0.5) # Check every 500ms
except Exception as e:
logging.error(f"Error in app restart monitor: {e}")
time.sleep(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

what's this sleep for?

# Get the current app process (which might have been restarted)
current_app_process = app_process_ref[0] if app_process_ref else app_process

if current_app_process:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is pretty similar to the code above - can you pop this into a function so it can be re-used? I think this will also get the stdin pipes hooked correctly.

app_process_ref = None
if app:
# Create a reference to app_process so it can be updated by the monitor thread
app_process_ref = [app_process]
Copy link
Contributor

Choose a reason for hiding this comment

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

so this is doing thread sync by shared mem - suggesting adding a lock. Maybe? Maybe it's not strictly necessary here since your monitor thread should be killed before the reference is used again. Maybe I'm being paranoid.

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.

3 participants
0