Skip to content

Commit 010f2ab

Browse files
committed
core: When running tests sequentially, print the test name before running it
Useful for debugging hanging tests
1 parent 23d36be commit 010f2ab

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/libstd/test.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,22 @@ fn run_tests(opts: test_opts, tests: [test_desc],
214214

215215
while done_idx < total {
216216
while wait_idx < concurrency && run_idx < total {
217-
run_test(vec::shift(filtered_tests), ch);
217+
let test = vec::shift(filtered_tests);
218+
if concurrency == 1u {
219+
// We are doing one test at a time so we can print the name
220+
// of the test before we run it. Useful for debugging tests
221+
// that hang forever.
222+
callback(te_wait(test));
223+
}
224+
run_test(test, ch);
218225
wait_idx += 1u;
219226
run_idx += 1u;
220227
}
221228

222229
let (test, result) = comm::recv(p);
223-
callback(te_wait(test));
230+
if concurrency != 1u {
231+
callback(te_wait(test));
232+
}
224233
callback(te_result(test, result));
225234
wait_idx -= 1u;
226235
done_idx += 1u;

0 commit comments

Comments
 (0)