Fix-Point opened a new pull request, #3414: URL: https://github.com/apache/nuttx-apps/pull/3414
## Summary The HRTimer test in `ostest` has been significantly refactored and enhanced to provide comprehensive coverage of high-resolution timer functionality. The previous test was limited in scope and could fail on virtual platforms (e.g., QEMU) due to timing inaccuracies caused by vCPU preemption. Key improvements include: - **Expanded test scenarios**: Added dedicated test functions for one-shot timers, periodic timers, maximum delay (UINT64_MAX), random delays, and cancellation behavior. For SMP systems, additional tests validate critical section protection and proper cancellation synchronization. - **Robust latency handling**: Replaced strict assertions on timer latency with warnings when latency exceeds a configurable tolerance (now 10 ms). This allows the test to pass on QEMU while still flagging excessive delays. - **Code clarity and maintainability**: Introduced detailed function headers, renamed constants for readability, and replaced a custom assertion macro with standard `ASSERT()`. - **Build relocation**: Moved the HRTimer test under the `CONFIG_BUILD_FLAT` conditional to align with other flat-mode tests, ensuring it is only built when appropriate. These changes ensure the HRTimer subsystem is thoroughly validated across different hardware and virtual environments, with clear diagnostics for timing anomalies. ## Impact - **Users**: No direct impact on end users; the change only affects the `ostest` test suite. Developers running the OS test will now see more extensive HRTimer validation. - **Build process**: The HRTimer test is now conditionally built only under `CONFIG_BUILD_FLAT` (alongside `CONFIG_HRTIMER`). This may affect builds that previously included the test in non-flat configurations, but such configurations are uncommon. - **Documentation**: Added comprehensive comments for each test function, explaining purpose, inputs, and expected behavior, improving maintainability. - **Security**: No security implications. - **Compatibility**: The test now uses standard `ASSERT()` instead of a custom macro; any external scripts relying on the old test output may need adjustment, but the overall test structure remains compatible with the OS test harness. ## Testing Tested on `rv-virt:smp`, ostest passed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
