-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make revision tests show up as test.rs#revision #47605
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
Make revision tests show up as test.rs#revision #47605
Conversation
src/tools/compiletest/src/main.rs
Outdated
@@ -597,7 +597,7 @@ pub fn is_test(file_name: &OsString) -> bool { | |||
!invalid_prefixes.iter().any(|p| file_name.starts_with(p)) | |||
} | |||
|
|||
pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn { | |||
pub fn make_test_with_revisions(config: &Config, testpaths: &TestPaths) -> Vec<test::TestDescAndFn> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should rename this function. It makes the test with and without revisions. With the new name I kind of expect a "default" make_test
function somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 will change it back
src/tools/compiletest/src/main.rs
Outdated
should_panic, | ||
allow_fail: false, | ||
}, | ||
testfn: make_test_closure(config, testpaths), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have to be threading the revision
down into the test closure here...
src/tools/compiletest/src/runtest.rs
Outdated
rev_cx.run_revision(); | ||
} | ||
} | ||
base_cx.run_revision(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
....so that here we can be given the revision, and load up the revision_props
and so forth like we used to do
6ec4956
to
6dd40b8
Compare
6dd40b8
to
ed12efa
Compare
|
So I think the problem is that both tests are outputting things into the same directory. That's kind of annoying. Still, it seems kind of like a bad feature of the existing test harness too! We can probably fix this by tweaking the way we compute the output file names. For example, we might alter rust/src/tools/compiletest/src/runtest.rs Lines 1825 to 1834 in fdc18b3
It looks kind of like rust/src/tools/compiletest/src/runtest.rs Lines 2739 to 2745 in fdc18b3
I guess I'd search around for other uses of |
ed12efa
to
2c379cc
Compare
@nikomatsakis last comment, you wanted to add a comment like rust/src/tools/compiletest/src/main.rs Lines 543 to 550 in 5965b79
|
a4c85fb
to
c65b6b8
Compare
src/tools/compiletest/src/main.rs
Outdated
allow_fail: false, | ||
}, | ||
testfn: make_test_closure(config, testpaths), | ||
let dir = config.build_base.join(&testpaths.relative_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add a comment here explaining (a) the directory layout that we are going to be creating (i.e., with some examples) and (b) why we are doing that here and not in runtest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/tools/compiletest/src/runtest.rs
Outdated
@@ -1830,7 +1828,8 @@ impl<'test> TestCx<'test> { | |||
|
|||
// Note: The directory `dir` is created during `collect_tests_from_dir` | |||
dir.join(&self.output_testname(&self.testpaths.file)) | |||
.with_extension(&self.config.stage_id) | |||
.join(self.revision.unwrap_or("")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here also we should update the comment on the function, which doesn't talk about revisions; also, does join
have no effect when its argument is an empty string? I feel like I expect this to rather be:
let mut dir = ...;
dir = dir.join(...);
if let Some(r) = self.revision {
dir = dir.join(r);
}
dir = dir.join(&self.config.stage_id);
dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/tools/compiletest/src/main.rs
Outdated
let dir = config.build_base.join(&testpaths.relative_dir) | ||
.join(PathBuf::from(&testpaths.file.file_stem().unwrap())) | ||
.join(revision); | ||
fs::create_dir_all(&dir).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikomatsakis This is building a directory structure like `/home/santiago/src/oss/rust1/build/x86_64-unknown-linux-gnu/test/run-pass/borrowck/two-phase-baseline/lxl/stage1-x86_64-unknown-linux-gnu". So this code creates the dir up to lxl and stage1-x86_64-unknown-linux-gnu is the file. Let me know if you prefer something different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks right to me
src/tools/compiletest/src/runtest.rs
Outdated
.with_extension(&self.config.stage_id) | ||
let r = dir.join(&self.output_testname(&self.testpaths.file)) | ||
.join(self.revision.unwrap_or("")) | ||
.join(&self.config.stage_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikomatsakis This logic is repeated, we'd probably like to have a function around that computes this.
src/tools/compiletest/src/runtest.rs
Outdated
@@ -2741,6 +2740,7 @@ impl<'test> TestCx<'test> { | |||
debug!("input_file: {:?}", self.testpaths.file); | |||
mir_dump_dir.push(&self.testpaths.relative_dir); | |||
mir_dump_dir.push(self.testpaths.file.file_stem().unwrap()); | |||
mir_dump_dir.push(self.revision.unwrap_or("")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikomatsakis This also is kind of similar but using relative dirs. We may probably want two functions, one that computes the relative thing and one that computes the full thing and uses the relative one.
src/tools/compiletest/src/runtest.rs
Outdated
@@ -1830,7 +1828,8 @@ impl<'test> TestCx<'test> { | |||
|
|||
// Note: The directory `dir` is created during `collect_tests_from_dir` | |||
dir.join(&self.output_testname(&self.testpaths.file)) | |||
.with_extension(&self.config.stage_id) | |||
.join(self.revision.unwrap_or("")) | |||
.join(&self.config.stage_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikomatsakis This logic is repeated, we'd probably like to have a function around that computes this.
}] | ||
} else { | ||
early_props.revisions.iter().map(|revision| { | ||
fs::create_dir_all(dir.join(revision)).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikomatsakis This is building a directory structure like `/home/santiago/src/oss/rust1/build/x86_64-unknown-linux-gnu/test/run-pass/borrowck/two-phase-baseline/lxl/stage1-x86_64-unknown-linux-gnu". So this code creates the dir up to lxl and stage1-x86_64-unknown-linux-gnu is the file. Let me know if you prefer something different
ddc7c72
to
83a36db
Compare
83a36db
to
9631e13
Compare
Ok, this is not working. We talked with @nikomatsakis to put this aside for a while. We may come back to this later. If someone wants to take over from where it is, feel free to do so. Otherwise, I may revisit it at some point. |
Fixes #47604
r? @nikomatsakis