@@ -9,7 +9,7 @@ use camino::{Utf8Path, Utf8PathBuf};
9
9
use semver:: Version ;
10
10
use tracing:: * ;
11
11
12
- use crate :: common:: { Config , Debugger , FailMode , PassMode , RunFailMode , TestMode } ;
12
+ use crate :: common:: { CodegenBackend , Config , Debugger , FailMode , PassMode , RunFailMode , TestMode } ;
13
13
use crate :: debuggers:: { extract_cdb_version, extract_gdb_version} ;
14
14
use crate :: directives:: auxiliary:: { AuxProps , parse_and_update_aux} ;
15
15
use crate :: directives:: needs:: CachedNeedsConditions ;
@@ -818,6 +818,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
818
818
"ignore-arm-unknown-linux-musleabihf" ,
819
819
"ignore-auxiliary" ,
820
820
"ignore-avr" ,
821
+ "ignore-backends" ,
821
822
"ignore-beta" ,
822
823
"ignore-cdb" ,
823
824
"ignore-compare-mode-next-solver" ,
@@ -907,6 +908,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
907
908
"min-llvm-version" ,
908
909
"min-system-llvm-version" ,
909
910
"needs-asm-support" ,
911
+ "needs-backends" ,
910
912
"needs-crate-type" ,
911
913
"needs-deterministic-layouts" ,
912
914
"needs-dlltool" ,
@@ -1669,6 +1671,8 @@ pub(crate) fn make_test_description<R: Read>(
1669
1671
decision ! ( cfg:: handle_only( config, ln) ) ;
1670
1672
decision ! ( needs:: handle_needs( & cache. needs, config, ln) ) ;
1671
1673
decision ! ( ignore_llvm( config, path, ln) ) ;
1674
+ decision ! ( ignore_backends( config, path, ln) ) ;
1675
+ decision ! ( needs_backends( config, path, ln) ) ;
1672
1676
decision ! ( ignore_cdb( config, ln) ) ;
1673
1677
decision ! ( ignore_gdb( config, ln) ) ;
1674
1678
decision ! ( ignore_lldb( config, ln) ) ;
@@ -1795,6 +1799,49 @@ fn ignore_lldb(config: &Config, line: &str) -> IgnoreDecision {
1795
1799
IgnoreDecision :: Continue
1796
1800
}
1797
1801
1802
+ fn ignore_backends ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
1803
+ if let Some ( backends_to_ignore) = config. parse_name_value_directive ( line, "ignore-backends" ) {
1804
+ for backend in backends_to_ignore. split_whitespace ( ) . map ( |backend| {
1805
+ match CodegenBackend :: try_from ( backend) {
1806
+ Ok ( backend) => backend,
1807
+ Err ( error) => {
1808
+ panic ! ( "Invalid ignore-backends value `{backend}` in `{path}`: {error}" )
1809
+ }
1810
+ }
1811
+ } ) {
1812
+ if config. codegen_backend == backend {
1813
+ return IgnoreDecision :: Ignore {
1814
+ reason : format ! ( "{} backend is marked as ignore" , backend. as_str( ) ) ,
1815
+ } ;
1816
+ }
1817
+ }
1818
+ }
1819
+ IgnoreDecision :: Continue
1820
+ }
1821
+
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
+
1798
1845
fn ignore_llvm ( config : & Config , path : & Utf8Path , line : & str ) -> IgnoreDecision {
1799
1846
if let Some ( needed_components) =
1800
1847
config. parse_name_value_directive ( line, "needs-llvm-components" )
0 commit comments