@@ -2907,23 +2907,29 @@ impl<'test> TestCx<'test> {
2907
2907
fn verify_with_filecheck ( & self , output : & Path ) -> ProcRes {
2908
2908
let mut filecheck = Command :: new ( self . config . llvm_filecheck . as_ref ( ) . unwrap ( ) ) ;
2909
2909
filecheck. arg ( "--input-file" ) . arg ( output) . arg ( & self . testpaths . file ) ;
2910
+
2910
2911
// It would be more appropriate to make most of the arguments configurable through
2911
2912
// a comment-attribute similar to `compile-flags`. For example, --check-prefixes is a very
2912
2913
// useful flag.
2913
2914
//
2914
2915
// For now, though…
2915
- let prefix_for_target =
2916
- if self . config . target . contains ( "msvc" ) { "MSVC" } else { "NONMSVC" } ;
2917
- let prefixes = if let Some ( rev) = self . revision {
2918
- format ! ( "CHECK,{},{}" , prefix_for_target, rev)
2919
- } else {
2920
- format ! ( "CHECK,{}" , prefix_for_target)
2921
- } ;
2922
- if self . config . llvm_version . unwrap_or ( 0 ) >= 130000 {
2923
- filecheck. args ( & [ "--allow-unused-prefixes" , "--check-prefixes" , & prefixes] ) ;
2924
- } else {
2925
- filecheck. args ( & [ "--check-prefixes" , & prefixes] ) ;
2916
+
2917
+ // Because we use custom prefixes, we also have to register the default prefix.
2918
+ filecheck. arg ( "--check-prefix=CHECK" ) ;
2919
+
2920
+ // Some tests use the current revision name as a check prefix.
2921
+ if let Some ( rev) = self . revision {
2922
+ filecheck. arg ( "--check-prefix" ) . arg ( rev) ;
2926
2923
}
2924
+
2925
+ // Some tests also expect either the MSVC or NONMSVC prefix to be defined.
2926
+ let msvc_or_not = if self . config . target . contains ( "msvc" ) { "MSVC" } else { "NONMSVC" } ;
2927
+ filecheck. arg ( "--check-prefix" ) . arg ( msvc_or_not) ;
2928
+
2929
+ // The filecheck tool normally fails if a prefix is defined but not used.
2930
+ // However, we define several prefixes globally for all tests.
2931
+ filecheck. arg ( "--allow-unused-prefixes" ) ;
2932
+
2927
2933
// Provide more context on failures.
2928
2934
filecheck. args ( & [ "--dump-input-context" , "100" ] ) ;
2929
2935
self . compose_and_run ( filecheck, "" , None , None )
0 commit comments