@@ -1150,7 +1150,7 @@ where
1150
1150
while !remaining. is_empty ( ) {
1151
1151
let test = remaining. pop ( ) . unwrap ( ) ;
1152
1152
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 ) ;
1154
1154
let ( test, result, stdout) = rx. recv ( ) . unwrap ( ) ;
1155
1155
callback ( TeResult ( test, result, stdout) ) ?;
1156
1156
}
@@ -1161,7 +1161,7 @@ where
1161
1161
let timeout = Instant :: now ( ) + Duration :: from_secs ( TEST_WARN_TIMEOUT_S ) ;
1162
1162
running_tests. insert ( test. desc . clone ( ) , timeout) ;
1163
1163
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 ) ;
1165
1165
pending += 1 ;
1166
1166
}
1167
1167
@@ -1193,7 +1193,7 @@ where
1193
1193
// All benchmarks run at the end, in serial.
1194
1194
for b in filtered_benchs {
1195
1195
callback ( TeWait ( b. desc . clone ( ) ) ) ?;
1196
- run_test ( opts, false , b, tx. clone ( ) ) ;
1196
+ run_test ( opts, false , b, tx. clone ( ) , /*concurrency*/ true ) ;
1197
1197
let ( test, result, stdout) = rx. recv ( ) . unwrap ( ) ;
1198
1198
callback ( TeResult ( test, result, stdout) ) ?;
1199
1199
}
@@ -1395,6 +1395,7 @@ pub fn run_test(
1395
1395
force_ignore : bool ,
1396
1396
test : TestDescAndFn ,
1397
1397
monitor_ch : Sender < MonitorMsg > ,
1398
+ concurrency : bool ,
1398
1399
) {
1399
1400
let TestDescAndFn { desc, testfn } = test;
1400
1401
@@ -1411,6 +1412,7 @@ pub fn run_test(
1411
1412
monitor_ch : Sender < MonitorMsg > ,
1412
1413
nocapture : bool ,
1413
1414
testfn : Box < dyn FnBox ( ) + Send > ,
1415
+ concurrency : bool ,
1414
1416
) {
1415
1417
// Buffer for capturing standard I/O
1416
1418
let data = Arc :: new ( Mutex :: new ( Vec :: new ( ) ) ) ;
@@ -1445,7 +1447,7 @@ pub fn run_test(
1445
1447
// the test synchronously, regardless of the concurrency
1446
1448
// level.
1447
1449
let supports_threads = !cfg ! ( target_os = "emscripten" ) && !cfg ! ( target_arch = "wasm32" ) ;
1448
- if supports_threads {
1450
+ if concurrency && supports_threads {
1449
1451
let cfg = thread:: Builder :: new ( ) . name ( name. as_slice ( ) . to_owned ( ) ) ;
1450
1452
cfg. spawn ( runtest) . unwrap ( ) ;
1451
1453
} else {
@@ -1466,13 +1468,14 @@ pub fn run_test(
1466
1468
}
1467
1469
DynTestFn ( f) => {
1468
1470
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 )
1470
1472
}
1471
1473
StaticTestFn ( f) => run_test_inner (
1472
1474
desc,
1473
1475
monitor_ch,
1474
1476
opts. nocapture ,
1475
1477
Box :: new ( move || __rust_begin_short_backtrace ( f) ) ,
1478
+ concurrency,
1476
1479
) ,
1477
1480
}
1478
1481
}
0 commit comments