-
Notifications
You must be signed in to change notification settings - Fork 376
Optimize unit tests by parallelizing them #590
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
Conversation
Split long tests into subtests and use all available CPUs to run them.
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 optimizes the h3_framing test suite by splitting it into multiple independent test subsets that can run in parallel, significantly reducing overall test execution time. The change enables CTest to automatically parallelize test execution based on available CPU cores.
- Refactored the monolithic
test_h3_framinginto 9 independent test subsets that can run concurrently - Configured CTest to run tests in parallel by default using all available CPU cores
- Added a
-scommand-line option to select specific test subsets
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/test_h3_framing.c | Refactored test structure to support subset execution via new -s flag, splitting pwritev combos and other tests into 9 independent subsets |
| tests/CMakeLists.txt | Removed h3_framing from main test list and added 9 separate test targets (6 pwritev combos + 3 other test groups) |
| CMakeLists.txt | Added parallel test execution configuration using ProcessorCount and CMAKE_CTEST_ARGUMENTS, plus a serial test target |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/test_h3_framing.c
Outdated
| main_test_pwritev (void) | ||
| { | ||
| /* Run all combos */ | ||
| main_test_pwritev_combo(0, 6); |
Copilot
AI
Nov 27, 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 hardcoded value 6 should be replaced with sizeof(combos) / sizeof(combos[0]) to avoid magic numbers and ensure consistency with the combos array definition. This would make the code more maintainable if the combos array size changes in the future.
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.
@copilot open a new pull request to apply changes based on this feedback
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@dtikhonov I've opened a new pull request, #592, to work on those changes. Once the pull request is ready, I'll request review from you. |
…ng.c (#592) * Initial plan * Replace hardcoded 6 with N_PWRITEV_COMBOS constant Co-authored-by: dtikhonov <4528576+dtikhonov@users.noreply.github.com> * Remove codeql artifact and add to gitignore Co-authored-by: dtikhonov <4528576+dtikhonov@users.noreply.github.com> * Simplify: move combos to file scope and use sizeof directly Co-authored-by: dtikhonov <4528576+dtikhonov@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dtikhonov <4528576+dtikhonov@users.noreply.github.com>
No description provided.