about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2024-08-10 12:19:38 -0400
committerBen Kimock <kimockb@gmail.com>2024-08-10 14:03:27 -0400
commit03b6c2f2d4ac99d123e02786a69ba380498d80d8 (patch)
tree5c13d3401baa3bfd0c8e87e43979052a13481860 /src
parentca5d25e2c41f5a6b4ce65c681bf2f94c7ead1f14 (diff)
Fix and enable disabled codegen-units tests
Diffstat (limited to 'src')
-rw-r--r--src/tools/compiletest/src/runtest.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index b1b6d6fc8eb..ce6569f5537 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -3027,11 +3027,17 @@ impl<'test> TestCx<'test> {
         const PREFIX: &str = "MONO_ITEM ";
         const CGU_MARKER: &str = "@@";
 
+        // Some MonoItems can contain {closure@/path/to/checkout/tests/codgen-units/test.rs}
+        // To prevent the current dir from leaking, we just replace the entire path to the test
+        // file with TEST_PATH.
         let actual: Vec<MonoItem> = proc_res
             .stdout
             .lines()
             .filter(|line| line.starts_with(PREFIX))
-            .map(|line| str_to_mono_item(line, true))
+            .map(|line| {
+                line.replace(&self.testpaths.file.display().to_string(), "TEST_PATH").to_string()
+            })
+            .map(|line| str_to_mono_item(&line, true))
             .collect();
 
         let expected: Vec<MonoItem> = errors::load_errors(&self.testpaths.file, None)