From 81c9112a305d484627e666624434dc9f9cce17e7 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 13 Jan 2017 20:45:56 +0100 Subject: ipcpd: Fix timerwheel test Sometimes the timerwheel test could fail because of scheduler timings (an issue more apparent in Virtual Machines). When the first check fails, the test will wait for another complete round of the timerwheel. The maximum number of slots in the test is reduced to reduce the test time. --- src/ipcpd/tests/timerwheel_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ipcpd/tests/timerwheel_test.c b/src/ipcpd/tests/timerwheel_test.c index 486358f9..1ace1371 100644 --- a/src/ipcpd/tests/timerwheel_test.c +++ b/src/ipcpd/tests/timerwheel_test.c @@ -25,7 +25,7 @@ #include #include -#define MAX_ELEMENTS 500 +#define MAX_ELEMENTS 100 #define MAX_RESOLUTION 10 /* ms */ #define MAX_ADDITIONS 1000 @@ -87,6 +87,10 @@ int timerwheel_test(int argc, char ** argv) nanosleep(&wait, NULL); + /* On some systems and VMs, the scheduler may be too slow. */ + if (total != check_total) + nanosleep(&wait, NULL); + timerwheel_destroy(tw); if (total != check_total) { -- cgit v1.2.3