mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-22 16:47:21 +03:00
Make test/unit/background_thread not flaky.
This commit is contained in:
parent
b86d271cbf
commit
49505e558b
1 changed files with 5 additions and 3 deletions
|
|
@ -80,6 +80,8 @@ TEST_BEGIN(test_background_thread_running) {
|
||||||
|
|
||||||
test_repeat_background_thread_ctl(false);
|
test_repeat_background_thread_ctl(false);
|
||||||
test_switch_background_thread_ctl(true);
|
test_switch_background_thread_ctl(true);
|
||||||
|
assert_b_eq(info->started, true,
|
||||||
|
"Background_thread did not start.\n");
|
||||||
|
|
||||||
nstime_t start, now;
|
nstime_t start, now;
|
||||||
nstime_init(&start, 0);
|
nstime_init(&start, 0);
|
||||||
|
|
@ -99,9 +101,9 @@ TEST_BEGIN(test_background_thread_running) {
|
||||||
nstime_init(&now, 0);
|
nstime_init(&now, 0);
|
||||||
nstime_update(&now);
|
nstime_update(&now);
|
||||||
nstime_subtract(&now, &start);
|
nstime_subtract(&now, &start);
|
||||||
assert_u64_lt(nstime_sec(&now), 10,
|
assert_u64_lt(nstime_sec(&now), 1000,
|
||||||
"Background threads did not run for 10 seconds.");
|
"Background threads did not run for 1000 seconds.");
|
||||||
usleep(10000);
|
sleep(1);
|
||||||
}
|
}
|
||||||
test_switch_background_thread_ctl(false);
|
test_switch_background_thread_ctl(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue