Repository navigation
feat: add --package and --target for package and CPU architecture selection - #49
Conversation
|
@rikosellic |
This follows the legacy design by @chrihop, in |
|
@DID-Lab-SZU |
|
Sounds good to me. |
`--targets` selected packages, which collided with the CPU target. The CPU
architecture was hard-coded to `x86_64-unknown-none` in
`VERIFICATION_RUST_TARGET`. Follow cargo-verus naming so a later architecture
can be verified without changing dv again:
- Packages: `--package/-p` on verify, focus, build, doc, and count. `doc` was
`--target`, and `count` previously used `-p` for `--print-all`.
- Architecture: `--target <TRIPLE>` on verify, focus, build, doc, and count,
defaulting to x86_64-unknown-none. Unsupported triples are rejected at parse
time; experimental triples are accepted with a warning.
- `--print-all` on `count` is now `-a`. Breaking for `count -p`: scripts that
used `-p` to print every annotated line must use `-a`.
- verus.rs: DEFAULT_RUST_TARGET, parse_rust_target, SUPPORTED_RUST_TARGETS
(accepted) and VALIDATED_RUST_TARGETS (x86 only). The triple is passed to
cargo-verus --target, dependency resolution, and the cached dependency file,
named {package}.{triple}.{release|debug}.deps.toml.
- doc.rs: the triple is used for rustdoc --target and artifact lookup. The
missing-dependency error suggests the exact cargo dv build command.
- count.rs: count --module selects the #[path] whose cfg(target_arch) matches
the target instead of always the first (x86) declaration. Error messages
suggest the matching cargo dv verify --package command.
- README documents --package, --target, and the experimental triples.
Behavior is unchanged for the default target: commands without the flags
build and verify exactly as before.
9d38705 to
7843c04
Compare
--rust-target for CPU target selection--package and --target for package and CPU architecture selection
Marsman1996
left a comment
There was a problem hiding this comment.
LGTM, and I will open a sync PR in VOSTD later
|
Please post this on Zulip so others can know about the command change. We may also need to change our CI. |
--targetsselected packages, which collided with the CPU target. The CPUarchitecture was hard-coded to
x86_64-unknown-noneinVERIFICATION_RUST_TARGET. Follow cargo-verus naming:--package/-pselectspackages and
--targetselects the Rust target triple, so a later architecturecan be verified without changing
dvagain.Changes
--package/-ponverify,focus,build,doc(was--target), andcount. This frees-pincount, which was--print-all;--print-allnow uses-a. Breaking forcount -p: callers that usedcount -pfor print-all must switch tocount -a.--target <TRIPLE>onverify,focus,build,doc, andcount, defaulting tox86_64-unknown-none. Unsupported triples are rejectedat parse time; experimental triples are accepted with a warning.
verus.rs:DEFAULT_RUST_TARGET,parse_rust_target,SUPPORTED_RUST_TARGETS(accepted) and
VALIDATED_RUST_TARGETS(x86 only). The triple is passed tocargo-verus --target, dependency resolution, and the cached dependency file,named
{package}.{triple}.{release|debug}.deps.toml.doc.rs: the triple is used for rustdoc--targetand for locating artifactsunder the triple-prefixed directories. The missing-dependency error suggests
the exact
cargo dv build --package <dep> --target <triple>command.count.rs: the triple is used to find cargo-verus dep-info.count --moduleselects the
#[path]declaration whosecfg(target_arch)matches the target(previously always the first, the x86 arch module). Error messages suggest
cargo dv verify --package <name>.README.md: documents--package,--target, and the experimental triples.Behavior is unchanged for the default target: every command without the flags
builds and verifies exactly as before.
Compatibility
--targetsis replaced by--package.--targetis a new flag; there is noreleased
--rust-targetinterface. Callers must use--packageand--target.--disasmstill readslibrary_path(), which ignores the triple. The flag iscurrently unused (
disassemble()has no caller), so this is not reachable.Verification
cargo test --lib --bin rust-dv: 11 + 6 passed. Four new tests cover thedefault target, rejection of an unsupported triple, cargo
--targetpropagation, and
count --moduletarget selection. Thecounttest waschecked by mutation: disabling the
cfgmatch makes it fail.rustfmt --checkon the changed files: clean.--targetsisrejected.
rust-dv count --module arch::irq --target <triple>on the realostdtreeresolves
x86,riscv, andloongarchto their ownirq.rs.Known test issues, both present on the base commit and unrelated to this PR:
cargo test --test helper_tests:test_get_dependencyfails withNo targets found(it runs from thedvdirectory, which has no vostdworkspace). Not fixed here.
test_new_packagewritesverification/test-packageand inserts aworkspace = ...line at the top ofdv/Cargo.toml. Run it only in a cleancheckout, or revert those two changes afterwards.
Related issues: none.