@@ -1150,7 +1150,7 @@ where
11501150 while !remaining. is_empty ( ) {
11511151 let test = remaining. pop ( ) . unwrap ( ) ;
11521152 callback ( TeWait ( test. desc . clone ( ) ) ) ?;
1153- run_test ( opts, !opts. run_tests , test, tx. clone ( ) ) ;
1153+ run_test ( opts, !opts. run_tests , test, tx. clone ( ) , /*concurrency*/ false ) ;
11541154 let ( test, result, stdout) = rx. recv ( ) . unwrap ( ) ;
11551155 callback ( TeResult ( test, result, stdout) ) ?;
11561156 }
@@ -1161,7 +1161,7 @@ where
11611161 let timeout = Instant :: now ( ) + Duration :: from_secs ( TEST_WARN_TIMEOUT_S ) ;
11621162 running_tests. insert ( test. desc . clone ( ) , timeout) ;
11631163 callback ( TeWait ( test. desc . clone ( ) ) ) ?; //here no pad
1164- run_test ( opts, !opts. run_tests , test, tx. clone ( ) ) ;
1164+ run_test ( opts, !opts. run_tests , test, tx. clone ( ) , /*concurrency*/ true ) ;
11651165 pending += 1 ;
11661166 }
11671167
@@ -1193,7 +1193,7 @@ where
11931193 // All benchmarks run at the end, in serial.
11941194 for b in filtered_benchs {
11951195 callback ( TeWait ( b. desc . clone ( ) ) ) ?;
1196- run_test ( opts, false , b, tx. clone ( ) ) ;
1196+ run_test ( opts, false , b, tx. clone ( ) , /*concurrency*/ true ) ;
11971197 let ( test, result, stdout) = rx. recv ( ) . unwrap ( ) ;
11981198 callback ( TeResult ( test, result, stdout) ) ?;
11991199 }
@@ -1395,6 +1395,7 @@ pub fn run_test(
13951395 force_ignore : bool ,
13961396 test : TestDescAndFn ,
13971397 monitor_ch : Sender < MonitorMsg > ,
1398+ concurrency : bool ,
13981399) {
13991400 let TestDescAndFn { desc, testfn } = test;
14001401
@@ -1411,6 +1412,7 @@ pub fn run_test(
14111412 monitor_ch : Sender < MonitorMsg > ,
14121413 nocapture : bool ,
14131414 testfn : Box < dyn FnBox ( ) + Send > ,
1415+ concurrency : bool ,
14141416 ) {
14151417 // Buffer for capturing standard I/O
14161418 let data = Arc :: new ( Mutex :: new ( Vec :: new ( ) ) ) ;
@@ -1445,7 +1447,7 @@ pub fn run_test(
14451447 // the test synchronously, regardless of the concurrency
14461448 // level.
14471449 let supports_threads = !cfg ! ( target_os = "emscripten" ) && !cfg ! ( target_arch = "wasm32" ) ;
1448- if supports_threads {
1450+ if concurrency && supports_threads {
14491451 let cfg = thread:: Builder :: new ( ) . name ( name. as_slice ( ) . to_owned ( ) ) ;
14501452 cfg. spawn ( runtest) . unwrap ( ) ;
14511453 } else {
@@ -1466,13 +1468,14 @@ pub fn run_test(
14661468 }
14671469 DynTestFn ( f) => {
14681470 let cb = move || __rust_begin_short_backtrace ( f) ;
1469- run_test_inner ( desc, monitor_ch, opts. nocapture , Box :: new ( cb) )
1471+ run_test_inner ( desc, monitor_ch, opts. nocapture , Box :: new ( cb) , concurrency )
14701472 }
14711473 StaticTestFn ( f) => run_test_inner (
14721474 desc,
14731475 monitor_ch,
14741476 opts. nocapture ,
14751477 Box :: new ( move || __rust_begin_short_backtrace ( f) ) ,
1478+ concurrency,
14761479 ) ,
14771480 }
14781481}
0 commit comments