Add thread attribute to test harness#413
Open
xuchang-vivo wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
build_prs |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/25646966663. |
|
❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/25646966663. |
Contributor
Author
|
build_prs |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/25647237583. |
Contributor
Author
|
build_prs |
|
❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/25647237583. |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/25647307332. |
|
✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/25647307332. |
han-jiang277
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
threadattribute toblueos_test_macro::testandonly_testso a test body can run concurrently in multiple BlueOS threads.repeatbehavior unchanged whenthreadis omitted or set to 1.thread = 2withrepeat = 2to validate concurrent execution.Why
This gives stress and regression tests a direct way to exercise concurrent paths from the test harness without hand-rolling thread startup and completion coordination in each test.
Implementation Notes
repeatandthreadtogether, rejects duplicate or zero values, and usesConstBarrierpluswait_until/wakefor threaded execution.crateasblueosinside the test module only, so the macro can use the sameblueos::...paths as external unittest crates.Testing
rustfmt test_harness/src/lib.rs kernel/src/lib.rsninja -C out/qemu_mps2_an385.debug kernel_unittest_clippyninja -C out/qemu_mps2_an385.debug kernel/kernel:run_unittestExpected Output
The new
test_harness_thread_attributeunittest is declared as#[test(thread = 2, repeat = 2)], so the kernel unittest run prints one RUN/OK pair per repeat iteration and includes the configured thread count: