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

[cargo-miri] Interpret unit tests of proc-macro crates #1677

Closed
wants to merge 3 commits into from
Closed

[cargo-miri] Interpret unit tests of proc-macro crates #1677

wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 16, 2021

This PR is the successor of #1674.

Will fix #1660.

cargo-miri/bin.rs Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member

This PR attempts to do that by using cargo metadata to detect the unit tests and calling cargo test again to interpret them in Miri.

Hm, that's not what I had in mind... I thought we could detect this by looking at the command-line arguments cargo passes to us.

I will take a closer look at this, but I don't have a lot of spare time currently, so I cannot dig into this myself or provide an in-depth review currently -- sorry for that.

@ghost
Copy link
Author

ghost commented Jan 18, 2021

Hm, that's not what I had in mind... I thought we could detect this by looking at the command-line arguments cargo passes to us.

I will take a closer look at this, but I don't have a lot of spare time currently, so I cannot dig into this myself or provide an in-depth review currently -- sorry for that.

It's okay. Meanwhile I'm going to try if I can continue #1674 (that's "looking at the command-line arguments cargo passes to us"). Thanks for taking a look!

@ghost
Copy link
Author

ghost commented Jan 18, 2021

I thought we could detect this by looking at the command-line arguments cargo passes to us.

I tried to continue #1674 here and stopped using cargo metadata.
#1674 failed with found possibly newer version of crate `std` which `num_cpus` depends on, so I tried to set --sysroot, but I'm getting an ICE (compiler/rustc_mir/src/monomorphize/collector.rs:826:9: no MIR available for DefId(2:6849 ~ core[25bd]::fmt::num::DEC_DIGITS_LUT)) now.

@RalfJung
Copy link
Member

no MIR available

This sounds like it is using the host rustc sysroot when it needs the Miri sysroot.
So are you trying to run the test in Miri? Looks like that won't work.


if env::var_os("MIRI_TARGET_IS_HOST").is_some() {
cmd.arg("--sysroot");
cmd.arg(sysroot);
Copy link
Author

@ghost ghost Jan 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like it is using the host rustc sysroot when it needs the Miri sysroot.

It's strange that I explicitly set --sysroot to the Miri sysroot and that was even shown up in the verbose output. I must miss something. 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand your goal here. Didn't we say that these crates (proc-macro tests) would not be interpreted with Miri, and that they would not be run at all?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RalfJung That's not what I was trying to do here. I updated #1675 and did that there.

@ghost ghost requested a review from RalfJung January 18, 2021 17:24
@ghost

This comment has been minimized.

@ghost
Copy link
Author

ghost commented Jan 19, 2021

I don't understand your goal here. Didn't we say that these crates (proc-macro tests) would not be interpreted with Miri, and that they would not be run at all?

@RalfJung I meant I had not given up this PR yet and feel free to close this PR (next week or more later when you have time, good luck to your current work) if you think this approach is undesirable or unlikely to succeed.

@RalfJung
Copy link
Member

I think #1675 is more promising, so given that this here also doesn't seem to work (if I understood you correctly, and judging from the CI status), let's close this and focus on the other PR.

@RalfJung RalfJung closed this Jan 19, 2021
@ghost ghost deleted the proc-macro-unit-test2 branch January 19, 2021 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant