about summary refs log tree commit diff
path: root/src/tools/compiletest
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-11-02 13:07:57 +1100
committerZalathar <Zalathar@users.noreply.github.com>2023-11-07 11:15:19 +1100
commite585a992300093c13e477f2eb7e66842d9275131 (patch)
tree7ea9dc46d79cd66de64057b074765c36f06c1765 /src/tools/compiletest
parent211d4cee8eb0ef2e3dcf5426c143cecce76570cb (diff)
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.
Diffstat (limited to 'src/tools/compiletest')
-rw-r--r--src/tools/compiletest/src/common.rs12
-rw-r--r--src/tools/compiletest/src/runtest.rs2
2 files changed, 12 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 0e1bf0c6c2d..a908218fff1 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -78,7 +78,7 @@ impl Default for Mode {
 }
 
 impl Mode {
-    pub fn disambiguator(self) -> &'static str {
+    pub fn aux_dir_disambiguator(self) -> &'static str {
         // Pretty-printing tests could run concurrently, and if they do,
         // they need to keep their output segregated.
         match self {
@@ -86,6 +86,15 @@ impl Mode {
             _ => "",
         }
     }
+
+    pub fn output_dir_disambiguator(self) -> &'static str {
+        // Coverage tests use the same test files for multiple test modes,
+        // so each mode should have a separate output directory.
+        match self {
+            CoverageMap | RunCoverage => self.to_str(),
+            _ => "",
+        }
+    }
 }
 
 string_enum! {
@@ -699,6 +708,7 @@ pub fn output_testname_unique(
     let mode = config.compare_mode.as_ref().map_or("", |m| m.to_str());
     let debugger = config.debugger.as_ref().map_or("", |m| m.to_str());
     PathBuf::from(&testpaths.file.file_stem().unwrap())
+        .with_extra_extension(config.mode.output_dir_disambiguator())
         .with_extra_extension(revision.unwrap_or(""))
         .with_extra_extension(mode)
         .with_extra_extension(debugger)
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index c9bc858b8e9..748ee2fe052 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2720,7 +2720,7 @@ impl<'test> TestCx<'test> {
     fn aux_output_dir_name(&self) -> PathBuf {
         self.output_base_dir()
             .join("auxiliary")
-            .with_extra_extension(self.config.mode.disambiguator())
+            .with_extra_extension(self.config.mode.aux_dir_disambiguator())
     }
 
     /// Generates a unique name for the test, such as `testname.revision.mode`.