fix: prevent false-positive test results on signature length mismatch#102
fix: prevent false-positive test results on signature length mismatch#102GiGiKoneti wants to merge 1 commit into
Conversation
When the DUT signature and reference signature have different lengths, the comparison function writes 'Failed' but does not return early. The subsequent for-else loop then iterates over the shorter prefix, and if no mismatch is found within that prefix, the else-block writes 'Passed' for the same test. This patch adds an early return after the length check and replaces the for-else pattern with explicit returns to make the control flow unambiguous.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
|
@Talha-Ahmed-1 |
Problem
In
manual_run_riscv_arch_test.py, when the DUT signature and theSpike reference signature have different lengths, the comparison
function writes "Failed" to the log but does not return early.
Execution falls through into the
for-elseloop (line 56-63), whichiterates over
min(len(nrv_sig), len(ref_sig)). If the shorterprefix happens to match, the loop completes without
break, andPython's
for-elsesemantics trigger theelseblock — writing"Passed" for the same test that was already marked "Failed".
This means a test where the core produces a truncated or extended
signature can silently appear as "Passed" in the final report.
Fix
returnafter the length-mismatch check.for-elsepattern with explicitreturnstatementsto make the control flow unambiguous.
range(len(nrv_sig))instead ofrange(min(...))sincelengths are now guaranteed equal at that point.
Summary by CodeRabbit
Release Notes