Skip to content

Commit aaca9fa

Browse files
committed
compiletest: don't register MSVC/NONMSVC FileCheck prefixes
This was fragile as it was based on host target passed to compiletest, but the user could cross-compile and run test for a different target (e.g. cross from linux to msvc, but msvc won't be set on the target). Furthermore, it was also very surprising as normally revision names (other than `CHECK`) was accepted as FileCheck prefixes.
1 parent bab18a5 commit aaca9fa

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,23 +1958,23 @@ impl<'test> TestCx<'test> {
19581958
let mut filecheck = Command::new(self.config.llvm_filecheck.as_ref().unwrap());
19591959
filecheck.arg("--input-file").arg(output).arg(&self.testpaths.file);
19601960

1961-
// FIXME: Consider making some of these prefix flags opt-in per test,
1962-
// via `filecheck-flags` or by adding new header directives.
1963-
19641961
// Because we use custom prefixes, we also have to register the default prefix.
19651962
filecheck.arg("--check-prefix=CHECK");
19661963

1967-
// Some tests use the current revision name as a check prefix.
1964+
// FIXME(#134510): auto-registering revision names as check prefix is a bit sketchy, and
1965+
// that having to pass `--allow-unused-prefix` is an unfortunate side-effect of not knowing
1966+
// whether the test author actually wanted revision-specific check prefixes or not.
1967+
//
1968+
// TL;DR We may not want to conflate `compiletest` revisions and `FileCheck` prefixes.
1969+
1970+
// HACK: tests are allowed to use a revision name as a check prefix.
19681971
if let Some(rev) = self.revision {
19691972
filecheck.arg("--check-prefix").arg(rev);
19701973
}
19711974

1972-
// Some tests also expect either the MSVC or NONMSVC prefix to be defined.
1973-
let msvc_or_not = if self.config.target.contains("msvc") { "MSVC" } else { "NONMSVC" };
1974-
filecheck.arg("--check-prefix").arg(msvc_or_not);
1975-
1976-
// The filecheck tool normally fails if a prefix is defined but not used.
1977-
// However, we define several prefixes globally for all tests.
1975+
// HACK: the filecheck tool normally fails if a prefix is defined but not used. However,
1976+
// sometimes revisions are used to specify *compiletest* directives which are not FileCheck
1977+
// concerns.
19781978
filecheck.arg("--allow-unused-prefixes");
19791979

19801980
// Provide more context on failures.

tests/codegen/meta-filecheck/msvc-prefix-good.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)