Skip to content

Commit e585a99

Browse files
committed
coverage: Give each coverage test mode a separate output directory
When multiple test modes share the same test directory, this will allow them to avoid interfering with each others' files and timestamps.
1 parent 211d4ce commit e585a99

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/tools/compiletest/src/common.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,23 @@ impl Default for Mode {
7878
}
7979

8080
impl Mode {
81-
pub fn disambiguator(self) -> &'static str {
81+
pub fn aux_dir_disambiguator(self) -> &'static str {
8282
// Pretty-printing tests could run concurrently, and if they do,
8383
// they need to keep their output segregated.
8484
match self {
8585
Pretty => ".pretty",
8686
_ => "",
8787
}
8888
}
89+
90+
pub fn output_dir_disambiguator(self) -> &'static str {
91+
// Coverage tests use the same test files for multiple test modes,
92+
// so each mode should have a separate output directory.
93+
match self {
94+
CoverageMap | RunCoverage => self.to_str(),
95+
_ => "",
96+
}
97+
}
8998
}
9099

91100
string_enum! {
@@ -699,6 +708,7 @@ pub fn output_testname_unique(
699708
let mode = config.compare_mode.as_ref().map_or("", |m| m.to_str());
700709
let debugger = config.debugger.as_ref().map_or("", |m| m.to_str());
701710
PathBuf::from(&testpaths.file.file_stem().unwrap())
711+
.with_extra_extension(config.mode.output_dir_disambiguator())
702712
.with_extra_extension(revision.unwrap_or(""))
703713
.with_extra_extension(mode)
704714
.with_extra_extension(debugger)

src/tools/compiletest/src/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2720,7 +2720,7 @@ impl<'test> TestCx<'test> {
27202720
fn aux_output_dir_name(&self) -> PathBuf {
27212721
self.output_base_dir()
27222722
.join("auxiliary")
2723-
.with_extra_extension(self.config.mode.disambiguator())
2723+
.with_extra_extension(self.config.mode.aux_dir_disambiguator())
27242724
}
27252725

27262726
/// Generates a unique name for the test, such as `testname.revision.mode`.

0 commit comments

Comments
 (0)