Conversation
…ing (Closes #6039) A wrong command line used to end in a Rust panic (exit 101) for 21 of 22 cases; running with no arguments printed nothing and exited 0. - -h / --help, or no arguments: print the usage and exit 0. The usage text is the header comment of bitwalk.rs, read with include_str!, so there is one copy of it. - A missing operand, an unknown option, or a malformed number: name it, print the usage, exit 2. - A file that cannot be read or written: name the path and exit 1. Good command lines are unchanged: the writer corpus stays 16/16 byte-identical to xc7frames2bit, the FASM corpus 22/22 to fasm2frames, and fpga-assembler #49 gold 5/5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
This was referenced Oct 4, 2026
Merged
Owner
Author
|
The two red checks here are red on
This PR changes |
This was referenced Oct 4, 2026
Merged
Merged
Merged
This was referenced Oct 5, 2026
Merged
Open
This branch has not been deployed
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.
Closes #6039.
Change
specs/xilinx7/bitwalk.rsonly. No spec, generated module, seal or ledger is touched.-h,--help, or no arguments print the usage and exit 0.--helpanywhere on the line counts.--writewithout--part_fileor--part_name, and a bad number (--cor0 OSCFSEL,--frame MIN).bitwalk: PATH: <os error>and exits 1.The usage text is the header comment at the top of
bitwalk.rs, which already listed every mode. It is read withinclude_str!, so there is one copy and not two that can drift. One line was added to that header for-h/--helpand the exit codes.Each new check is a named bool (
wants_help,unknown_flag,enough,in_and_out), as the issue asks.Measured
Command-line matrix, 22 wrong command lines, run against the master binary and this one:
c107cd2)The 22nd case on master is "no arguments", which printed nothing and exited 0.
Negative control: the same matrix with master as both binaries scores 0 / 22, so it does fail when nothing changed.
Good command lines unchanged, 4 / 4: a bare walk,
--frame,--framesto a file and--cor0to a file. Each has the same exit code and stdout as master, with timings normalised, and its output file is byte-identical.Corpus checks with the new binary (
x7.pyfrom thexilinx7-bitstream-loopharness):--writevsxc7frames2bit--writewith the wrong part--fasmvsfasm2frames--strictstill checkedNot changed
assert!(part != w::PARTS …)with a panic. That is a bad file, not a bad command line, and out of scope here.tiles/segbitslines, IDCODE text) still.unwrap()their parses.Not measured
x7.pyharness and the trinity-fpga tools that might parse bitwalk's stderr. Nothing on stdout changed for a good command line.{ "version": 1, "head_sha": "60ef0ea88149b1d33624b5fa5adbf5e6f5978d05", "summary": "bitwalk prints usage and clean errors instead of panicking on a wrong command line or an unreadable file.", "changes": [ "-h, --help or no arguments print the usage (the file's own header comment, via include_str!) and exit 0.", "A wrong command line names the problem, prints the usage and exits 2; an unreadable or unwritable file prints the path and exits 1.", "Only specs/xilinx7/bitwalk.rs changes; no spec, generated module, seal or ledger edits." ], "tests": [ { "command": "python3 bw_cli_matrix.py bitwalk-master bitwalk-new BIT", "status": "passed", "result": "22/22 wrong command lines give the expected exit code and message (master: 21/22 panicked with exit 101); 4/4 good command lines unchanged.", "evidence": "Matrix output; the same matrix with master as both binaries scores 0/22." }, { "command": "X7_WT=<clone> python3 x7.py writer", "status": "passed", "result": "16/16 byte-identical to xc7frames2bit; the wrong-part case exits 1 with 192 frames rejected.", "evidence": "x7.py writer sweep output." }, { "command": "X7_WT=<clone> python3 x7.py fasm", "status": "passed", "result": "22/22 byte-identical to fasm2frames; fpga-assembler #49 gold 5/5.", "evidence": "x7.py fasm sweep output." } ], "limitations": [ "An unknown IDCODE still panics at the PARTS assert; malformed file contents still unwrap their parses.", "Callers outside the x7.py harness and the trinity-fpga tools were not surveyed." ], "tags": [ "Engineering" ] }🤖 Generated with Claude Code