@@ -25,7 +25,7 @@ use build_helper::git::{get_git_modified_files, get_git_untracked_files};
2525use core:: panic;
2626use getopts:: Options ;
2727use std:: collections:: HashSet ;
28- use std:: ffi:: OsString ;
28+ use std:: ffi:: { OsStr , OsString } ;
2929use std:: fs;
3030use std:: io:: { self , ErrorKind } ;
3131use std:: path:: { Path , PathBuf } ;
@@ -225,6 +225,29 @@ pub fn parse_config(args: Vec<String>) -> Config {
225225 // Avoid spawning an external command when we know tidy won't be used.
226226 false
227227 } ;
228+ let filters = if mode == Mode :: RunMake {
229+ matches
230+ . free
231+ . iter ( )
232+ . map ( |f| {
233+ let path = Path :: new ( f) ;
234+ let mut iter = path. iter ( ) . skip ( 1 ) ;
235+
236+ // We skip the test folder and check if the user passed `rmake.rs` or `Makefile`.
237+ if iter
238+ . next ( )
239+ . is_some_and ( |s| s == OsStr :: new ( "rmake.rs" ) || s == OsStr :: new ( "Makefile" ) )
240+ && iter. next ( ) . is_none ( )
241+ {
242+ path. parent ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . to_string ( )
243+ } else {
244+ f. to_string ( )
245+ }
246+ } )
247+ . collect :: < Vec < _ > > ( )
248+ } else {
249+ matches. free . clone ( )
250+ } ;
228251 Config {
229252 bless : matches. opt_present ( "bless" ) ,
230253 compile_lib_path : make_absolute ( opt_path ( matches, "compile-lib-path" ) ) ,
@@ -249,7 +272,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
249272 debugger : None ,
250273 run_ignored,
251274 with_debug_assertions,
252- filters : matches . free . clone ( ) ,
275+ filters,
253276 skip : matches. opt_strs ( "skip" ) ,
254277 filter_exact : matches. opt_present ( "exact" ) ,
255278 force_pass_mode : matches. opt_str ( "pass" ) . map ( |mode| {
0 commit comments