zzby0 opened a new pull request, #3334: URL: https://github.com/apache/nuttx-apps/pull/3334
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary This PR optimizes the ostest suite execution time and fixes several reliability issues: 1. **Reduce test execution time**: Reduced sleep() durations across multiple test cases, decreasing total test time from ~150s to ~60s (60% reduction) while maintaining test effectiveness. 2. **Fix timing-related test failures**: Replaced timing-based synchronization (usleep/sleep) with deterministic event-based synchronization (semaphore polling, waitpid) to eliminate race conditions on slower systems or under high load. 3. **Fix SMP-related race conditions**: - Fixed robust_test failure in SMP environments where parent thread could acquire mutex before child thread - Fixed restart_test assertion in semaphore code by restructuring the test to ensure restart happens under controlled conditions **Changes by category:** - Time optimization: 24 files with reduced sleep/delay times - Synchronization improvements: sighand.c, suspend.c - Race condition fixes: robust.c, restart.c - Timeout adjustments: pthread_rwlock.c ## Impact **Users**: - Faster CI/test execution (60% time reduction) - More reliable test results across different hardware speeds and configurations - Better test coverage for SMP systems **Build process**: No impact - pure test code changes **Compatibility**: Fully backward compatible - no API or behavior changes to tested components **Testing reliability**: Significantly improved - eliminates timing-dependent race conditions that caused intermittent failures ## Testing **Verification performed:** - All modified test cases executed successfully on both single-core and SMP configurations - Tests verified under various load conditions to ensure timing changes don't cause false failures - Confirmed 60% reduction in total ostest execution time (150s → 60s) **Test configurations verified:** - Single-core ARM Cortex-M systems - Multi-core SMP configurations - Simulator (sim:ostest) **Before changes:** - Test time: ~150 seconds - Intermittent failures observed in: - robust_test on SMP systems (timing race) - sighand_test on slower systems (fixed delay insufficient) - restart_test (assertion in semaphore code) **After changes:** - Test time: ~60 seconds (60% improvement) - All tests pass reliably across configurations - No false positives due to timing issues - SMP race conditions eliminated **Build verification:** - Host: Linux x86_64 - Target: Multiple architectures (ARM, RISC-V, simulator) - All builds successful with no new warnings The changes maintain test coverage while significantly improving execution speed and reliability. -- 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]
