summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-01-13 20:45:56 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2017-01-13 20:50:48 +0100
commit81c9112a305d484627e666624434dc9f9cce17e7 (patch)
tree5c17bdb2879871b7b17ca0308e465405730f2590 /src/ipcpd
parent3ad7ee0c378e528fab7277daa9427eda562f08b4 (diff)
downloadouroboros-81c9112a305d484627e666624434dc9f9cce17e7.tar.gz
ouroboros-81c9112a305d484627e666624434dc9f9cce17e7.zip
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.
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/tests/timerwheel_test.c6
1 files changed, 5 insertions, 1 deletions
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 <time.h>
#include <stdlib.h>
-#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) {