@@ -908,6 +908,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
908908 "min-llvm-version" ,
909909 "min-system-llvm-version" ,
910910 "needs-asm-support" ,
911+ "needs-backends" ,
911912 "needs-crate-type" ,
912913 "needs-deterministic-layouts" ,
913914 "needs-dlltool" ,
@@ -1671,6 +1672,7 @@ pub(crate) fn make_test_description<R: Read>(
16711672 decision ! ( needs:: handle_needs( & cache. needs, config, ln) ) ;
16721673 decision ! ( ignore_llvm( config, path, ln) ) ;
16731674 decision ! ( ignore_backends( config, path, ln) ) ;
1675+ decision ! ( needs_backends( config, path, ln) ) ;
16741676 decision ! ( ignore_cdb( config, ln) ) ;
16751677 decision ! ( ignore_gdb( config, ln) ) ;
16761678 decision ! ( ignore_lldb( config, ln) ) ;
@@ -1817,6 +1819,29 @@ fn ignore_backends(config: &Config, path: &Utf8Path, line: &str) -> IgnoreDecisi
18171819 IgnoreDecision :: Continue
18181820}
18191821
1822+ fn needs_backends ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
1823+ if let Some ( needed_backends) = config. parse_name_value_directive ( line, "needs-backends" ) {
1824+ if !needed_backends
1825+ . split_whitespace ( )
1826+ . map ( |backend| match CodegenBackend :: try_from ( backend) {
1827+ Ok ( backend) => backend,
1828+ Err ( error) => {
1829+ panic ! ( "Invalid needs-backends value `{backend}` in `{path}`: {error}" )
1830+ }
1831+ } )
1832+ . any ( |backend| config. codegen_backend == backend)
1833+ {
1834+ return IgnoreDecision :: Ignore {
1835+ reason : format ! (
1836+ "{} backend is not part of required backends" ,
1837+ config. codegen_backend. as_str( )
1838+ ) ,
1839+ } ;
1840+ }
1841+ }
1842+ IgnoreDecision :: Continue
1843+ }
1844+
18201845fn ignore_llvm ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
18211846 if let Some ( needed_components) =
18221847 config. parse_name_value_directive ( line, "needs-llvm-components" )
0 commit comments