Skip to content

Provide a way to run a test that needs an external dependency #2443

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

Closed
RalfJung opened this issue Jul 25, 2022 · 9 comments · Fixed by #2890 or #2901
Closed

Provide a way to run a test that needs an external dependency #2443

RalfJung opened this issue Jul 25, 2022 · 9 comments · Fixed by #2890 or #2901
Assignees
Labels
A-dev Area: working on Miri as a developer C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@RalfJung
Copy link
Member

RalfJung commented Jul 25, 2022

It would be pretty neat if we had a way to have ./miri run work on tests that need external dependencies -- right now, these are a bit annoying to debug (and for tests that call into libc, this is a regression compared to the state before we added support for test dependencies). This should probably be a separate ./miri run-dep or so, and as much as possible it should share the test-dependencies infrastructure with ui_test/compiletest.

@RalfJung RalfJung added C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement A-dev Area: working on Miri as a developer labels Jul 25, 2022
@RalfJung
Copy link
Member Author

I just ran into this yesterday, where I wanted to just run some files as a quick test, and the libc dependency became a problem. So it'd be great to have some sort of solution here.

@oli-obk
Copy link
Contributor

oli-obk commented Aug 25, 2022

I'd prefer to run this via ./miri test, what is missing from ./miri test tests/pass-dep/some_test.rs for this to be useful for you?

@RalfJung
Copy link
Member Author

This should work for files outside of the test folder. It should also not compare the output to any stderr/stdout files, nor write any stderr/stdout files itself. It should ignore magic test comments. It should just run the file and not have any expectations about the exit code.

Using ./miri test kind of works but it is a crude work-around -- there's a lot of junk in the output, one has to put the file into a particular folder, one cannot overwrite the magic comments.

@RalfJung
Copy link
Member Author

RalfJung commented Dec 2, 2022

This would also have been really useful to debug rust-lang/futures-rs#2669.

Judging from oli-obk/ui_test#11 being closed, looks like this "just" needs some wiring up in Miri?

@oli-obk oli-obk self-assigned this Dec 2, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Dec 2, 2022

Ah yes, I forgot about this one after implementing the ui_test side of things

@oli-obk
Copy link
Contributor

oli-obk commented Dec 14, 2022

I won't get to this this year and January will most likely be spent catching up on other things. Will pick it up again after that.

@RalfJung
Copy link
Member Author

This works great, thanks!

However printing the entire invocation makes this very verbose and makes it easy to miss the actual program output. Maybe this should be hidden, at least by default?

@oli-obk
Copy link
Contributor

oli-obk commented May 12, 2023

We can just stop emitting that. I thought it may be practical if something goes wrong but I don't see a good way to hide it conditionally. We could make it a flag before the file name I guess?

@RalfJung
Copy link
Member Author

If something goes wrong I'd probably rather debug ./miri run and cargo miri run than the complicated dep setup.

So yeah for now I'd vote for not emitting that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dev Area: working on Miri as a developer C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
2 participants