-
Notifications
You must be signed in to change notification settings - Fork 7.8k
fix(tests): Fix periman and add missing diagrams #12126
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
base: master
Are you sure you want to change the base?
Conversation
👋 Hello lucasssvaz, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 90 files 90 suites 27m 57s ⏱️ For more details on these failures, see this check. Results for commit 31a2ae6. ♻️ This comment has been updated with latest results. |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances peripheral resource management testing and fixes issues in ADC continuous mode for ESP32 targets. The changes add comprehensive manual deinitialization tests for various peripherals and improve DMA buffer handling for cache-aligned targets like ESP32-P4.
- Added manual deinit test paths for SigmaDelta, LEDC, RMT, I2S, I2C, SPI, and ADC_Continuous peripherals
- Improved ADC continuous mode with cache-aligned DMA buffer allocation and proper memory cleanup
- Added Wokwi simulation diagrams for ESP32-P4 and ESP32-H2 SD card test setups
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/validation/sdcard/diagram.esp32p4.json | New Wokwi diagram for ESP32-P4 SD card test configuration with two SD cards |
| tests/validation/sdcard/diagram.esp32h2.json | New Wokwi diagram for ESP32-H2 SD card test configuration |
| tests/validation/sdcard/ci.yml | CI configuration for SD card tests (disabled for hardware and QEMU) |
| tests/validation/periman/test_periman.py | Enhanced Python test script to track and validate both auto-detach and manual deinit tests |
| tests/validation/periman/periman.ino | Added manual deinit test cases for 7 peripherals to verify proper resource cleanup |
| tests/validation/periman/ci.yml | Removed ESP32-P4 target exclusion from periman tests |
| cores/esp32/esp32-hal-adc.c | Improved ADC continuous mode with cache-aligned DMA buffers, guard against double-cleanup, and proper memory management |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Now test manual deinit path | ||
| setup_test("ADC_Continuous_deinit", ADC1_DEFAULT, ADC2_DEFAULT); | ||
| test_executed = false; // Skip the pinMode test in teardown | ||
| adc_coversion_done = false; // Reset flag |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: 'coversion' should be 'conversion'. The variable name should be adc_conversion_done instead of adc_coversion_done.
| } | ||
|
|
||
| // Don't call perimanClearPinBus() here - the peripheral manager already handles it | ||
| // This callback is only responsible for cleaning up the ADC driver itself |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says "This callback is only responsible for cleaning up the ADC driver itself" but the callback doesn't handle freeing the adc_result buffer. Consider updating the comment to clarify that the caller (analogContinuousDeinit) is responsible for freeing adc_result, or alternatively document why this separation of responsibilities exists.
| // This callback is only responsible for cleaning up the ADC driver itself | |
| // This callback is only responsible for cleaning up the ADC driver and calibration handles. | |
| // It does NOT free the adc_result buffer; the caller (e.g., analogContinuousDeinit) is responsible for freeing adc_result. |
Description of Change
This pull request introduces significant improvements to peripheral resource management and validation testing in the ESP32 codebase. The main focus is on ensuring that both automatic and manual deinitialization (deinit) of peripherals is robustly tested and that resource cleanup, especially for DMA buffers and ADC drivers, is handled correctly. The changes also enhance test coverage for manual deinit paths and update test infrastructure to reflect these improvements.
Peripheral Resource Management Improvements:
heap_caps_aligned_allocfor buffer allocation. [1] [2]analogContinuousDeinitto always clear used pins through the peripheral manager and to free the result buffer, improving robustness of deinitialization.Validation Test Enhancements:
periman.ino) to include explicit manual deinit tests for SigmaDelta, LEDC, RMT, I2S, I2C, SPI, and ADC Continuous peripherals. Each test now verifies that Serial1 can be restored after manual deinit, ensuring that the peripheral manager and driver cleanup are reliable. [1] [2] [3] [4] [5] [6] [7]pinMode) and manual deinit test paths. [1] [2]Test Infrastructure Updates:
test_periman.py) to dynamically track which peripherals have manual deinit tests, parse and match test output accordingly, and provide clearer logging and error messages. This ensures all expected tests are executed and validated. [1] [2]ci.yml) for platform and target definitions. [1] [2]Miscellaneous:
These changes collectively improve the reliability and maintainability of peripheral resource management, and provide stronger guarantees through comprehensive automated testing.
References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21]
Test Scenarios
Tested locally