@@ -25,7 +25,7 @@ use build_helper::git::{get_git_modified_files, get_git_untracked_files};
25
25
use core:: panic;
26
26
use getopts:: Options ;
27
27
use std:: collections:: HashSet ;
28
- use std:: ffi:: OsString ;
28
+ use std:: ffi:: { OsStr , OsString } ;
29
29
use std:: fs;
30
30
use std:: io:: { self , ErrorKind } ;
31
31
use std:: path:: { Path , PathBuf } ;
@@ -225,6 +225,29 @@ pub fn parse_config(args: Vec<String>) -> Config {
225
225
// Avoid spawning an external command when we know tidy won't be used.
226
226
false
227
227
} ;
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
+ } ;
228
251
Config {
229
252
bless : matches. opt_present ( "bless" ) ,
230
253
compile_lib_path : make_absolute ( opt_path ( matches, "compile-lib-path" ) ) ,
@@ -249,7 +272,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
249
272
debugger : None ,
250
273
run_ignored,
251
274
with_debug_assertions,
252
- filters : matches . free . clone ( ) ,
275
+ filters,
253
276
skip : matches. opt_strs ( "skip" ) ,
254
277
filter_exact : matches. opt_present ( "exact" ) ,
255
278
force_pass_mode : matches. opt_str ( "pass" ) . map ( |mode| {
0 commit comments