Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miri can't run single tests #1414

Closed
djugei opened this issue May 16, 2020 · 9 comments · Fixed by #1415
Closed

miri can't run single tests #1414

djugei opened this issue May 16, 2020 · 9 comments · Fixed by #1415
Labels
A-cargo Area: affects the cargo wrapper (cargo miri) C-support Category: Not necessarily a bug, but someone asking for support

Comments

@djugei
Copy link

djugei commented May 16, 2020

I can't seem to find a way to make miri run just a subset of my tests.
cargo miri test always runs all of them and i don't see a way to cut that down.

@vakaras
Copy link
Contributor

vakaras commented May 16, 2020

Have you tried: cargo miri test -- -- <test-name> ?

@RalfJung RalfJung added A-cargo Area: affects the cargo wrapper (cargo miri) C-support Category: Not necessarily a bug, but someone asking for support labels May 16, 2020
@RalfJung
Copy link
Member

RalfJung commented May 16, 2020

@djugei it would be helpful to know what exact commands you tried.

Also see the docs at https://github.com/rust-lang/miri#using-miri.

@djugei
Copy link
Author

djugei commented May 17, 2020

i tried cargo miri test -- test-name, but not the double-double-dashes, which work.

literally had to go /second on the docs to find it, there isn't an example of the double-double-dash-syntax. i also read the help text (no info) and the src/bin/miri.rs to have a look at comand line parsing, but thats hand-rolled, uses global state, and i did not look into the deeper function calls.

@RalfJung
Copy link
Member

Clearly our docs need improvement, you are not the only one to be confused by this. FWIW, the right file to look at would have been src/bin/cargo-miri.rs, but even there this is not easy to see (Cc #546).

As a start, I'll add the example back to the README... we used to have one I think, but it somehow disappeared.

(Also, it's not global state, we are not that that crazy.^^)

@RalfJung
Copy link
Member

RalfJung commented May 17, 2020

Also, the help text (cargo miri --help) does indicate both double-dashes:

Usage:
    cargo miri [subcommand] [options] [--] [<miri opts>...] [--] [<program opts>...]

Looks like this is still not clear enough, maybe we should have examples here, too.

@djugei
Copy link
Author

djugei commented May 17, 2020

right, i looked at cargo-miri.rs, misremembered.

and you are right, the help text is there, must have overlooked it, guess i expected it to be right after the test-subcommand, also cargo miri --help and cargo miri test --help produce the same output (not more specific for subcommand)

i think the main confusion for me is that its different from how cargo without miri works

cargo run -- arguments
cargo miri run -- -- arguments

cargo test -- arguments
cargo miri test -- -- arguments

bors added a commit that referenced this issue May 17, 2020
add test suite filter example to README and 'cargo miri --help'

Fixes #1414
@djugei
Copy link
Author

djugei commented May 17, 2020

i think with those changes i would have found what i was looking for

@djugei djugei closed this as completed May 17, 2020
@RalfJung
Copy link
Member

i think the main confusion for me is that its different from how cargo without miri works

Yeah, that's a bit weird. But I don't really see another way as we also need a way to pass flags to Miri.

Maybe we could re-expose all these flags through cargo miri directly so they do not need a --. Or maybe that should be an env var, MIRIFLAGS or so. Though at this point we'd also have a backwards compatibility hazard if we changed this. :/
I opened an issue just for this: #1416

Also not sure if you saw that, I opened a PR to add more examples to the docs: #1415

@djugei
Copy link
Author

djugei commented May 17, 2020

yeah i closed the issue cause of the pr, thanks for the work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo Area: affects the cargo wrapper (cargo miri) C-support Category: Not necessarily a bug, but someone asking for support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants