Repository navigation
Conversation
Signed-off-by: jmass-ggg <jamesgurung690@gmail.com>
jmass-ggg
force-pushed
the
fix/1484-register-protection-tests
branch
from
December 3, 2026 07:41
cc48270 to
759faac
Compare
Author
|
Hi @chreekat, I've submitted PR #1500 addressing issue #1484. All 11 CI checks have passed, including the DCO check. The synchronization-based approach reduces the combined test runtime from approximately 8 seconds to 24 milliseconds in my local environment. I'd appreciate your review and feedback when you have time. I'm happy to address any concerns or suggested improvements before merging. Thank you! |
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
Addresses #1484.
The existing register-protection tests rely on one-second sleeps and elapsed-time assertions to verify sequential and parallel execution. This introduces approximately eight seconds of test execution time and can cause false failures in heavily loaded CI environments.
This change replaces timing-based checks with coordinated test primitives, explicit synchronization, and register mutex probes.
Problem
The original implementation has several limitations:
Previous Execution Flow
flowchart TD A[Start register-protection test] --> B[Execute concurrent actions] B --> C[Acquire register locks] C --> D[Sleep for one second] D --> E[Complete actions] E --> F[Measure elapsed time] F --> G{Within expected duration?} G -->|Yes| H[Test passes] G -->|No| I[Test fails] J[CPU contention or scheduling delays] -.-> FA correct locking implementation can fail when scheduling delays cause the elapsed time to exceed the expected threshold.
Proposed Solution
RegisterSpintest primitive.New Execution Flow
flowchart TD A[Start register-protection test] --> B[Launch worker thread] B --> C[Acquire production register locks] C --> D[Enter coordinated test primitive] D --> E[Notify test controller] E --> F[Probe required register mutexes] F --> G[Release synchronization gate] G --> H[Join worker thread] H --> I[Evaluate test assertions] I -->|Expected behavior| J[Test passes] I -->|Unexpected behavior| K[Test fails]Independent Register Concurrency
sequenceDiagram participant T as Test Controller participant A as Action 1 participant B as Action 2 par Independent execution T->>A: Start action A->>A: Acquire register A lock A-->>T: Primitive entered and T->>B: Start action B->>B: Acquire register B lock B-->>T: Primitive entered end Note over A,B: Both primitives must enter before release T->>A: Release gate T->>B: Release gate A-->>T: Worker completed B-->>T: Worker completed T->>T: Validate concurrent progressPerformance Comparison
Measured locally on x86_64:
The replacement reduces the combined measured runtime by approximately 99.7%, providing an approximately 340× speed improvement in the tested environment.
Files Changed
tests/register_protection.htests/test_actions.cpptests/test_parser.cpptests/primitives.cpptests/Makefile.amNo production implementation files are modified.
Validation
git diff --check.Known Limitations
try_lock()permits spurious failures.The objective is to reduce test runtime and scheduling sensitivity while preserving meaningful register-protection regression coverage.
Related issue: #1484