File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
116116 "incremental" ,
117117 "known-bug" ,
118118 "llvm-cov-flags" ,
119+ "max-llvm-version" ,
119120 "min-cdb-version" ,
120121 "min-gdb-version" ,
121122 "min-lldb-version" ,
Original file line number Diff line number Diff line change @@ -1501,6 +1501,17 @@ fn ignore_llvm(config: &Config, line: &str) -> IgnoreDecision {
15011501 ) ,
15021502 } ;
15031503 }
1504+ } else if let Some ( value) = config. parse_name_value_directive ( line, "max-llvm-version" ) {
1505+ let value = value. trim ( ) ;
1506+ let max_version = extract_llvm_version ( value) . unwrap ( ) ;
1507+ // Ignore if actual version is larger than the maximum required version.
1508+ if actual_version > max_version {
1509+ return IgnoreDecision :: Ignore {
1510+ reason : format ! (
1511+ "ignored when the LLVM version ({actual_version}) is newer than {max_version}"
1512+ ) ,
1513+ } ;
1514+ }
15041515 } else if let Some ( value) =
15051516 config. parse_name_value_directive ( line, "min-system-llvm-version" )
15061517 {
Original file line number Diff line number Diff line change @@ -261,6 +261,15 @@ fn llvm_version() {
261261
262262 let config: Config = cfg ( ) . llvm_version ( "10.0.0" ) . build ( ) ;
263263 assert ! ( !check_ignore( & config, "//@ min-llvm-version: 9.0" ) ) ;
264+
265+ let config: Config = cfg ( ) . llvm_version ( "20.0.0" ) . build ( ) ;
266+ assert ! ( check_ignore( & config, "//@ max-llvm-version: 19.3.1" ) ) ;
267+
268+ let config: Config = cfg ( ) . llvm_version ( "20.0.0" ) . build ( ) ;
269+ assert ! ( !check_ignore( & config, "//@ max-llvm-version: 20.0.0" ) ) ;
270+
271+ let config: Config = cfg ( ) . llvm_version ( "20.0.0" ) . build ( ) ;
272+ assert ! ( !check_ignore( & config, "//@ max-llvm-version: 20.0.1" ) ) ;
264273}
265274
266275#[ test]
You can’t perform that action at this time.
0 commit comments