Auto merge of #106053 - compiler-errors:incr-test-revision, r=Mark-Simulacrum

Take revision into account in non-incremental-mode `// incremental` tests

A UI test I added in #105983 confusingly [failed](https://github.com/rust-lang/rust/pull/106031#issuecomment-1362558067) in a merge because two different revisions raced with each other for the same incremental directory for a (non-incremental-mode, i.e. `src/test/ui`) UI test.

Let's take the revision name into account when generating an incremental directory so that other UI tests that combine `// incremental` and `// revisions` won't race and cause possible flakiness in CI.
This commit is contained in:
bors 2022-12-23 13:37:11 +00:00
commit 62cc869245
2 changed files with 7 additions and 3 deletions

View File

@ -617,6 +617,6 @@ pub fn output_base_name(config: &Config, testpaths: &TestPaths, revision: Option
/// Absolute path to the directory to use for incremental compilation. Example:
/// /path/to/build/host-triple/test/ui/relative/testname.mode/testname.inc
pub fn incremental_dir(config: &Config, testpaths: &TestPaths) -> PathBuf {
output_base_name(config, testpaths, None).with_extension("inc")
pub fn incremental_dir(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> PathBuf {
output_base_name(config, testpaths, revision).with_extension("inc")
}

View File

@ -117,8 +117,12 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
}
debug!("running {:?}", testpaths.file.display());
let mut props = TestProps::from_file(&testpaths.file, revision, &config);
// For non-incremental (i.e. regular UI) tests, the incremental directory
// takes into account the revision name, since the revisions are independent
// of each other and can race.
if props.incremental {
props.incremental_dir = Some(incremental_dir(&config, testpaths));
props.incremental_dir = Some(incremental_dir(&config, testpaths, revision));
}
let cx = TestCx { config: &config, props: &props, testpaths, revision };