@@ -10,7 +10,25 @@ use crate::{
10
10
discover_tests, parse_test_cases, ParsedTestCase , PlannerTestRunner , TestCase , RESULT_SUFFIX ,
11
11
} ;
12
12
13
+ #[ derive( Default , Clone ) ]
14
+ pub struct PlannerTestApplyOptions {
15
+ pub serial : bool ,
16
+ }
17
+
13
18
pub async fn planner_test_apply < F , Ft , R > ( path : impl AsRef < Path > , runner_fn : F ) -> Result < ( ) >
19
+ where
20
+ F : Fn ( ) -> Ft + Send + Sync + ' static ,
21
+ Ft : Future < Output = Result < R > > + Send ,
22
+ R : PlannerTestRunner + ' static ,
23
+ {
24
+ planner_test_apply_with_options ( path, runner_fn, PlannerTestApplyOptions :: default ( ) ) . await
25
+ }
26
+
27
+ pub async fn planner_test_apply_with_options < F , Ft , R > (
28
+ path : impl AsRef < Path > ,
29
+ runner_fn : F ,
30
+ options : PlannerTestApplyOptions ,
31
+ ) -> Result < ( ) >
14
32
where
15
33
F : Fn ( ) -> Ft + Send + Sync + ' static ,
16
34
Ft : Future < Output = Result < R > > + Send ,
66
84
. map_err ( |e| ( e, testname_x) )
67
85
} ) ;
68
86
69
- let mut test_stream =
70
- test_stream. buffer_unordered ( std:: thread:: available_parallelism ( ) ?. into ( ) ) ;
87
+ let mut test_stream = if options. serial {
88
+ test_stream. then ( |x| x) . boxed ( )
89
+ } else {
90
+ test_stream
91
+ . buffer_unordered ( std:: thread:: available_parallelism ( ) ?. into ( ) )
92
+ . boxed ( )
93
+ } ;
71
94
72
95
let mut test_discovered = false ;
73
96
let mut failed_cases = vec ! [ ] ;
0 commit comments