Skip to content

Commit 73ec736

Browse files
committed
Normalize revisions used for filecheck directives
Typically, filecheck prefixes will be uppercase (always true) and start with `CHECK-` (almost always true). Currently we allow using revision names as filecheck directives, but they are passed directly. That means that our directives are exactly what the revision name is, in the same case, so they only look like filecheck directives if the revision name is uppercase (usually they are lowercase). Update this so that we always uppercase revision names and prefix them with `CHECK-` when used as directives. This is better for consistency, makes it easier to identify directives in the tests, and has the nice side effect that some editors will make the directive stand out by highlighting it (which currently happens for most directives, just not those from revisions).
1 parent 2e6fc42 commit 73ec736

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/tools/compiletest/src/runtest.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2608,13 +2608,14 @@ impl<'test> TestCx<'test> {
26082608
// Because we use custom prefixes, we also have to register the default prefix.
26092609
filecheck.arg("--check-prefix=CHECK");
26102610

2611-
// Some tests use the current revision name as a check prefix.
2611+
// The current revision name can also be used as a check prefix
26122612
if let Some(rev) = self.revision {
2613-
filecheck.arg("--check-prefix").arg(rev);
2613+
filecheck.arg(format!("--check-prefix=CHECK-{}", rev.to_uppercase()));
26142614
}
26152615

26162616
// Some tests also expect either the MSVC or NONMSVC prefix to be defined.
2617-
let msvc_or_not = if self.config.target.contains("msvc") { "MSVC" } else { "NONMSVC" };
2617+
let msvc_or_not =
2618+
if self.config.target.contains("msvc") { "CHECK-MSVC" } else { "CHECK-NONMSVC" };
26182619
filecheck.arg("--check-prefix").arg(msvc_or_not);
26192620

26202621
// The filecheck tool normally fails if a prefix is defined but not used.

0 commit comments

Comments
 (0)