Fix timing in PAL-tests for FreeBSD on hypervisors.
authorJostein Kjønigsen <jostein@kjonigsen.net>
Thu, 4 Jun 2015 06:29:55 +0000 (16:29 +1000)
committerJostein Kjønigsen <jostein@kjonigsen.net>
Sun, 7 Jun 2015 18:06:21 +0000 (04:06 +1000)
src/pal/tests/palsuite/threading/SleepEx/test2/test2.c
src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.c
src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExSemaphoreTest/WFSOExSemaphoreTest.c
src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExThreadTest/WFSOExThreadTest.c

index cce842a..9bfcebf 100644 (file)
@@ -20,8 +20,18 @@ const int InterruptTime = 1000;
 /* We need to keep in mind that BSD has a timer resolution of 10ms, so
    we need to adjust our delta to keep that in mind. Besides we need some 
    tolerance to account for different scheduling strategies, heavy load 
-   scenarios, etc */
-const DWORD AcceptableDelta = 50;
+   scenarios, etc.
+   
+   Real-world data also tells us we can expect a big difference between
+   values when run on real iron vs run in a hypervisor.
+
+   Thread-interruption times when run on bare metal will typically yield
+   around 0ms on Linux and between 0 and 16ms on FreeBSD. However, when run
+   in a hypervisor (like VMWare ESXi) we may get values around an order of
+   magnitude higher, up to 110 ms for some tests.
+*/
+const DWORD AcceptableDelta = 150;
+
 const int Iterations = 5;
 
 void RunTest(BOOL AlertThread);
index deacabf..5d231cd 100644 (file)
@@ -19,8 +19,8 @@
 /*Based on SleepEx/test2 */
 
 const int ChildThreadWaitTime = 4000;
-const int InterruptTime = 2000; 
-const int AcceptableDelta = 100;
+const int InterruptTime = 2000;
+const DWORD AcceptableDelta = 300;
 
 void RunTest(BOOL AlertThread);
 VOID PALAPI APCFunc(ULONG_PTR dwParam);
index a788e72..5538883 100644 (file)
@@ -19,8 +19,8 @@
 /*Based on SleepEx/test2 */
 
 const int ChildThreadWaitTime = 4000;
-const int InterruptTime = 2000; 
-const int AcceptableDelta = 100;
+const int InterruptTime = 2000;
+const DWORD AcceptableDelta = 300;
 
 void RunTest(BOOL AlertThread);
 VOID PALAPI APCFunc(ULONG_PTR dwParam);
index b96a905..fd9e8f0 100644 (file)
@@ -20,7 +20,7 @@
 
 const int ChildThreadWaitTime = 4000;
 const int InterruptTime = 2000; 
-const int AcceptableDelta = 100;
+const DWORD AcceptableDelta = 300;
 
 void RunTest(BOOL AlertThread);
 VOID PALAPI APCFunc(ULONG_PTR dwParam);