@@ -111,27 +111,34 @@ struct StepDescription {
111
111
}
112
112
113
113
#[ derive( Debug , Clone , PartialOrd , Ord , PartialEq , Eq ) ]
114
- struct PathSet {
115
- set : BTreeSet < PathBuf > ,
114
+ pub enum PathSet {
115
+ Set ( BTreeSet < PathBuf > ) ,
116
+ Suite ( PathBuf )
116
117
}
117
118
118
119
impl PathSet {
119
120
fn empty ( ) -> PathSet {
120
- PathSet { set : BTreeSet :: new ( ) }
121
+ PathSet :: Set ( BTreeSet :: new ( ) )
121
122
}
122
123
123
124
fn one < P : Into < PathBuf > > ( path : P ) -> PathSet {
124
125
let mut set = BTreeSet :: new ( ) ;
125
126
set. insert ( path. into ( ) ) ;
126
- PathSet { set }
127
+ PathSet :: Set ( set)
127
128
}
128
129
129
130
fn has ( & self , needle : & Path ) -> bool {
130
- self . set . iter ( ) . any ( |p| p. ends_with ( needle) )
131
+ match self {
132
+ PathSet :: Set ( set) => set. iter ( ) . any ( |p| p. ends_with ( needle) ) ,
133
+ PathSet :: Suite ( _) => false
134
+ }
131
135
}
132
136
133
137
fn path ( & self , builder : & Builder ) -> PathBuf {
134
- self . set . iter ( ) . next ( ) . unwrap_or ( & builder. build . src ) . to_path_buf ( )
138
+ match self {
139
+ PathSet :: Set ( set) => set. iter ( ) . next ( ) . unwrap_or ( & builder. build . src ) . to_path_buf ( ) ,
140
+ PathSet :: Suite ( path) => PathBuf :: from ( path)
141
+ }
135
142
}
136
143
}
137
144
@@ -203,7 +210,10 @@ impl StepDescription {
203
210
for path in paths {
204
211
let mut attempted_run = false ;
205
212
for ( desc, should_run) in v. iter ( ) . zip ( & should_runs) {
206
- if let Some ( pathset) = should_run. pathset_for_path ( path) {
213
+ if let Some ( suite) = should_run. is_suite_path ( path) {
214
+ attempted_run = true ;
215
+ desc. maybe_run ( builder, suite) ;
216
+ } else if let Some ( pathset) = should_run. pathset_for_path ( path) {
207
217
attempted_run = true ;
208
218
desc. maybe_run ( builder, pathset) ;
209
219
}
@@ -250,7 +260,7 @@ impl<'a> ShouldRun<'a> {
250
260
for krate in self . builder . in_tree_crates ( name) {
251
261
set. insert ( PathBuf :: from ( & krate. path ) ) ;
252
262
}
253
- self . paths . insert ( PathSet { set } ) ;
263
+ self . paths . insert ( PathSet :: Set ( set) ) ;
254
264
self
255
265
}
256
266
@@ -268,9 +278,21 @@ impl<'a> ShouldRun<'a> {
268
278
269
279
// multiple aliases for the same job
270
280
pub fn paths ( mut self , paths : & [ & str ] ) -> Self {
271
- self . paths . insert ( PathSet {
272
- set : paths. iter ( ) . map ( PathBuf :: from) . collect ( ) ,
273
- } ) ;
281
+ self . paths . insert ( PathSet :: Set ( paths. iter ( ) . map ( PathBuf :: from) . collect ( ) ) ) ;
282
+ self
283
+ }
284
+
285
+ pub fn is_suite_path ( & self , path : & Path ) -> Option < & PathSet > {
286
+ self . paths . iter ( ) . find ( |pathset| {
287
+ match pathset {
288
+ PathSet :: Suite ( p) => path. starts_with ( p) ,
289
+ PathSet :: Set ( _) => false
290
+ }
291
+ } )
292
+ }
293
+
294
+ pub fn suite_path ( mut self , suite : & str ) -> Self {
295
+ self . paths . insert ( PathSet :: Suite ( PathBuf :: from ( suite) ) ) ;
274
296
self
275
297
}
276
298
@@ -372,8 +394,10 @@ impl<'a> Builder<'a> {
372
394
}
373
395
let mut help = String :: from ( "Available paths:\n " ) ;
374
396
for pathset in should_run. paths {
375
- for path in pathset. set {
376
- help. push_str ( format ! ( " ./x.py {} {}\n " , subcommand, path. display( ) ) . as_str ( ) ) ;
397
+ if let PathSet :: Set ( set) = pathset{
398
+ set. iter ( ) . for_each ( |path| help. push_str (
399
+ format ! ( " ./x.py {} {}\n " , subcommand, path. display( ) ) . as_str ( )
400
+ ) )
377
401
}
378
402
}
379
403
Some ( help)
@@ -404,6 +428,7 @@ impl<'a> Builder<'a> {
404
428
parent : Cell :: new ( None ) ,
405
429
} ;
406
430
431
+
407
432
if kind == Kind :: Dist {
408
433
assert ! ( !builder. config. test_miri, "Do not distribute with miri enabled.\n \
409
434
The distributed libraries would include all MIR (increasing binary size).
0 commit comments