Validate RV32I prebuilt count metadata - #14
Conversation
44864fd to
82c888f
Compare
jserv
left a comment
There was a problem hiding this comment.
Reviewed the metadata parser, the guard ordering, the stubs, and the portability. The change is correct and well covered. The strict parser resolves every fixture plus the un-fixtured edges (empty, trailing newline versus a real second line, CRLF, whitespace, huge decimal), requiring count.txt does not regress a legitimate release (a demos-only release skips at the conformance == 0 guard first), and the set -e command-substitution idiom is portable in dash. The switch from -ne to a string compare also avoids the old arithmetic error on a malformed count.
| meta_case leading-zero-count '01\n' | ||
| meta_case junk-count '1x\n' | ||
| meta_case multiline-count '1\n\n' | ||
| meta_case mismatched-count '2\n' |
There was a problem hiding this comment.
Thorough fixture set. The parser also correctly rejects a few inputs not pinned here: CRLF (1\r\n), space padded ( 1\n or 1 \n), and it accepts an arbitrarily large decimal as a string. Fixtures for those would guard the behavior against a future parser change.
There was a problem hiding this comment.
Thank u Prof. for pointing out the remaining parser edges. I add fixtures for CRLF and leading/trailing whitespace, along with a direct parser check that preserves an arbitrarily large decimal verbatim. The direct check distinguish a valid-but-mismatched large count from a malformed count, since both would otherwise make the end-to-end consumer return 77.
82c888f to
c1a1a98
Compare
rv32i-prebuilt.sh treats count.txt as optional and removes all non-digit characters before comparing it. A release without the file can pass, and a value such as 1x2 is read as 12. Require one positive decimal count and return 77 when the metadata is missing, malformed, or does not match the number of conformance ELF files. Put that rule in rv32i-count.sh so the script and its contract test cannot drift on it, add offline cases for these inputs, and gate the full pass-case on a count.txt matching the elfs beside it, so a partial build tree skips instead of reddening the gate. make verify-prebuilt passes. make check-all passes. Signed-off-by: thc1006 <hctsai1006@cs.nctu.edu.tw>
c1a1a98 to
2d9a7d0
Compare
|
Thank @thc1006 for contributing! |
rv32i-prebuilt.shtreatscount.txtas optional and strips all non-digit characters before comparing it. As a result, a release without the file can pass, and a value such as1x2is interpreted as12.Require
count.txtto contain exactly one positive decimal integer. Return77when the metadata is missing, malformed, or does not match the number of conformance ELF files. Add offline cases covering each condition.make verify-prebuiltpasses.make check-allpasses.Summary by cubic
Enforces strict validation of
count.txtin RV32I prebuilts to prevent truncated or miscounted suites.rv32i-prebuilt.shnow requires exactly one positive decimal viarv32i-count.shand compares as strings; missing, malformed, or mismatched counts exit 77, offline metadata cases and live smoke use the same helper, and the full pass-case runs only whencount.txtmatches the ELFs.Written for commit 2d9a7d0. Summary will update on new commits.