about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-08-12 17:09:18 +0200
committerGitHub <noreply@github.com>2024-08-12 17:09:18 +0200
commit5b6379a86def3813aed60707d085b333bb426913 (patch)
treeb6f5f2f26c71bef93038869574d2705465396627 /src
parentea74eff55ca04effe8332aba80bfa529fce7b973 (diff)
parent03b6c2f2d4ac99d123e02786a69ba380498d80d8 (diff)
Rollup merge of #128929 - saethlin:enable-codegen-units-tests, r=compiler-errors
Fix codegen-units tests that were disabled 8 years ago

I don't know if any of these tests still have value. They were disabled by https://github.com/rust-lang/rust/pull/33890, and we've survived without them for a while. But considering how small this test suite is, maybe it's worth having them.

I also had to add some normalization to the codegen-units tests output. I think the fact that I had to add some underscores how poor our test coverage is.
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)