diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-12-18 20:11:35 +0800 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-12-19 20:36:51 +0800 |
| commit | aaca9fa482739cc097a7e77bf6a5ee87e8aa6254 (patch) | |
| tree | a400204ec641a8477d2d37f929aea0d3699b74e2 /src | |
| parent | bab18a542d95b5c76620d0a0d383d7ab683cc1b7 (diff) | |
| download | rust-aaca9fa482739cc097a7e77bf6a5ee87e8aa6254.tar.gz rust-aaca9fa482739cc097a7e77bf6a5ee87e8aa6254.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index cb31b03dd2a..6a4f0b96bb4 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1958,23 +1958,23 @@ impl<'test> TestCx<'test> { let mut filecheck = Command::new(self.config.llvm_filecheck.as_ref().unwrap()); filecheck.arg("--input-file").arg(output).arg(&self.testpaths.file); - // FIXME: Consider making some of these prefix flags opt-in per test, - // via `filecheck-flags` or by adding new header directives. - // Because we use custom prefixes, we also have to register the default prefix. filecheck.arg("--check-prefix=CHECK"); - // Some tests use the current revision name as a check prefix. + // FIXME(#134510): auto-registering revision names as check prefix is a bit sketchy, and + // that having to pass `--allow-unused-prefix` is an unfortunate side-effect of not knowing + // whether the test author actually wanted revision-specific check prefixes or not. + // + // TL;DR We may not want to conflate `compiletest` revisions and `FileCheck` prefixes. + + // HACK: tests are allowed to use a revision name as a check prefix. if let Some(rev) = self.revision { filecheck.arg("--check-prefix").arg(rev); } - // Some tests also expect either the MSVC or NONMSVC prefix to be defined. - let msvc_or_not = if self.config.target.contains("msvc") { "MSVC" } else { "NONMSVC" }; - filecheck.arg("--check-prefix").arg(msvc_or_not); - - // The filecheck tool normally fails if a prefix is defined but not used. - // However, we define several prefixes globally for all tests. + // HACK: the filecheck tool normally fails if a prefix is defined but not used. However, + // sometimes revisions are used to specify *compiletest* directives which are not FileCheck + // concerns. filecheck.arg("--allow-unused-prefixes"); // Provide more context on failures. |
