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

Run all pass-dep tests natively, too #3948

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Oct 7, 2024

fixes #3810

@oli-obk oli-obk force-pushed the rustc_doublecheck branch 2 times, most recently from de41d01 to 1426114 Compare October 7, 2024 14:24
tests/pass/intptrcast.rs Outdated Show resolved Hide resolved
@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 7, 2024

unknown unstable option: miri-provenance-gc

lol oops, dependency building on linux does different stuff I guess

@RalfJung
Copy link
Member

RalfJung commented Oct 7, 2024

Yeah we set that flag here

miri/ci/ci.sh

Line 53 in 6e83c99

time MIRIFLAGS="${MIRIFLAGS-} -Zmiri-provenance-gc=1" ./miri test $TARGET_FLAG

GC_STRESS is disabled on Windows since the runner is so slow.^^

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

This looks great!

I wonder if it'd be worth to first only land this for pass-dep, also to keep the diff smaller. Then we can iron out the kinks for the large number of pass tests in a next step.

exit_code: 0,
output_conflict_handling: Some(|path, actual, errors, config| {
let path = path.with_file_name(
path.file_name().unwrap().to_str().unwrap().replace(".run.", "."),
Copy link
Member

Choose a reason for hiding this comment

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

Where does this .run. come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is so you get foo.run.stderr that does not conflict with foo.stderr, which is for stderr during compilation

Copy link
Member

Choose a reason for hiding this comment

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

But this removes .run.

Is this to make sure that the output of the "run" is compared with the normal reference file for Miri?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

revision: &str,
) -> bool {
for rev in comments.for_revision(revision) {
for arg in &rev.compile_flags {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we just strip everything that starts with -Zmiri?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is filtering out tests. Otherwise I need to add only-miri a lot

Copy link
Member

Choose a reason for hiding this comment

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

Ah... "strip" is a very confusing name then.

Hm, not sure how I feel about that. Feels a bit too implicit. This reaffirms my position that we should, at least in the first iteration, only do this for pass-dep tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what that changes. I would still have to do all the same changes in ui.rs

I will do that to reduce the scope of this PR and future unrelated PRs that may be affected, but the impl is just as complex

Copy link
Member

Choose a reason for hiding this comment

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

Well the logic for implicitly making tests only-miri when they use these particular flag could be removed, I think?

});
config.program.envs.push(("MIRI_BE_RUSTC".into(), Some("host".into())));

#[derive(Debug)]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#[derive(Debug)]
/// A ui_test filter that strips `-Zmiri` flags.
#[derive(Debug)]

Copy link
Member

Choose a reason for hiding this comment

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

I guess the comment is wrong then. Please replace it by something that is correct :)

tests/ui.rs Show resolved Hide resolved
tests/pass-dep/libc/libc-mem.rs Outdated Show resolved Hide resolved
tests/pass/miri_start.rs Outdated Show resolved Hide resolved
tests/pass/ptr_int_casts.rs Outdated Show resolved Hide resolved
tests/pass/ptr_int_from_exposed.rs Outdated Show resolved Hide resolved
tests/pass/tls/win_tls_callback.rs Outdated Show resolved Hide resolved
tests/pass/zero-sized-accesses-and-offsets.rs Outdated Show resolved Hide resolved
c.current_dir(dir);
}
c.args(
cmd.get_args().filter(|arg| !arg.as_encoded_bytes().starts_with(b"-Zmiri-")),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the arg filter

Copy link
Member

Choose a reason for hiding this comment

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

More comments would help :)

config.comment_defaults.base().add_custom("run", Run {
exit_code: 0,
output_conflict_handling: Some(|path, actual, errors, config| {
let path = path.with_file_name(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let path = path.with_file_name(
// ui_test would compare the output with `test.run.stdout`, but we want to
// compare with `test.stdout`, so adjust the filename.
let path = path.with_file_name(

At least I think that's what happens?

if !config.host_matches_target() {
return Ok(());
}
config.output_conflict_handling = ui_test::ignore_output_conflict;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
config.output_conflict_handling = ui_test::ignore_output_conflict;
// This is about the output during compilation. We want to ignore that.
// Above in `add_custom("run", ...)`, we set things up so that the output
// from *running* the program is compared as it should.
config.output_conflict_handling = ui_test::ignore_output_conflict;

@oli-obk oli-obk changed the title Run all run(-dep)-pass tests natively, too Run all pass-dep tests natively, too Oct 8, 2024
@oli-obk oli-obk added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Oct 8, 2024
@@ -312,21 +440,30 @@ fn main() -> Result<()> {
}
}

ui(Mode::Pass, "tests/pass", &target, WithoutDependencies, tmpdir.path())?;
ui(Mode::Pass, "tests/pass-dep", &target, WithDependencies, tmpdir.path())?;
ui(Mode::Pass { rustc: false }, "tests/pass", &target, WithoutDependencies, tmpdir.path())?;
Copy link
Member

Choose a reason for hiding this comment

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

Can you also adjust the eprintln in fn ui to add something like "on rustc" or so, so that one can see which way the tests are being run?

@bors
Copy link
Contributor

bors commented Oct 10, 2024

☔ The latest upstream changes (presumably #3950) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: Waiting for the PR author to address review comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run pass tests against real rustc as well
3 participants