From f429ab3c18fe47a5cc116f2c4daaa24a740f3511 Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Mon, 3 May 2021 16:10:13 -0400 Subject: [PATCH 1/2] compiletest: "fix" FileCheck with --allow-unused-prefixes The default of --allow-unused-prefixes used to be false, but in LLVM change 87dbdd2e3b (https://reviews.llvm.org/D95849) the default became true. I'm not quite sure how we could do better here (specifically not providing the CHECK prefix when it's not needed), but this seems to work for now. --- src/tools/compiletest/src/runtest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index ecbaccf744dcd..517ae9c4dff95 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2293,7 +2293,7 @@ impl<'test> TestCx<'test> { // For now, though… if let Some(rev) = self.revision { let prefixes = format!("CHECK,{}", rev); - filecheck.args(&["--check-prefixes", &prefixes]); + filecheck.args(&["--allow-unused-prefixes", "--check-prefixes", &prefixes]); } self.compose_and_run(filecheck, "", None, None) } From 3035816fc13c2ae30d46849bfcceec085a2f47e2 Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Mon, 17 May 2021 13:08:42 -0400 Subject: [PATCH 2/2] runtest: correctly guard against LLVM version 13 --- src/tools/compiletest/src/runtest.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 517ae9c4dff95..80d905c730f49 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2293,7 +2293,11 @@ impl<'test> TestCx<'test> { // For now, though… if let Some(rev) = self.revision { let prefixes = format!("CHECK,{}", rev); - filecheck.args(&["--allow-unused-prefixes", "--check-prefixes", &prefixes]); + if self.config.llvm_version.unwrap_or(0) >= 130000 { + filecheck.args(&["--allow-unused-prefixes", "--check-prefixes", &prefixes]); + } else { + filecheck.args(&["--check-prefixes", &prefixes]); + } } self.compose_and_run(filecheck, "", None, None) }