@@ -31,7 +31,7 @@ use std::time::SystemTime;
31
31
use std:: { env, fs, vec} ;
32
32
33
33
use build_helper:: git:: { get_git_modified_files, get_git_untracked_files} ;
34
- use camino:: { Utf8Path , Utf8PathBuf } ;
34
+ use camino:: { Utf8Component , Utf8Path , Utf8PathBuf } ;
35
35
use getopts:: Options ;
36
36
use rayon:: iter:: { ParallelBridge , ParallelIterator } ;
37
37
use tracing:: debug;
@@ -799,6 +799,25 @@ fn collect_tests_from_dir(
799
799
return Ok ( TestCollector :: new ( ) ) ;
800
800
}
801
801
802
+ let mut components = dir. components ( ) . rev ( ) ;
803
+ if let Some ( Utf8Component :: Normal ( last) ) = components. next ( )
804
+ && let Some ( ( "asm" , backend) ) = last. split_once ( '-' )
805
+ && let Some ( Utf8Component :: Normal ( parent) ) = components. next ( )
806
+ && parent == "ui"
807
+ && let Some ( Utf8Component :: Normal ( grand_parent) ) = components. next ( )
808
+ && grand_parent == "tests"
809
+ && let Ok ( backend) = CodegenBackend :: try_from ( backend)
810
+ && backend != cx. config . codegen_backend
811
+ {
812
+ // We ignore asm tests which don't match the current codegen backend.
813
+ println ! (
814
+ "Ignoring tests in `{dir}` because they don't match the configured codegen \
815
+ backend (`{}`)",
816
+ cx. config. codegen_backend. as_str( ) ,
817
+ ) ;
818
+ return Ok ( TestCollector :: new ( ) ) ;
819
+ }
820
+
802
821
// For run-make tests, a "test file" is actually a directory that contains an `rmake.rs`.
803
822
if cx. config . mode == TestMode :: RunMake {
804
823
let mut collector = TestCollector :: new ( ) ;
0 commit comments