From aa77c2eb581a1952c48706cb0b74af1d74f27334 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Sun, 18 Sep 2016 13:29:53 +1000 Subject: [PATCH] Give the Windows MMTimer test a better chance of passing The default scheduling on windows seems fairly erratic or is at least in the VM that I'm running these tests on, so increase the timing slack a bit so the test has a better chance of passing. It is still quite easy for it to fail though, especially if you for instance manipulate the terminal window somehow while running the tests but it does not really matter in any case as this test serves its purpose in testing the PBD::MMTimers API. --- libs/pbd/test/windows_timer_utils_test.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libs/pbd/test/windows_timer_utils_test.cc b/libs/pbd/test/windows_timer_utils_test.cc index cd2ba59040..003c116ef8 100644 --- a/libs/pbd/test/windows_timer_utils_test.cc +++ b/libs/pbd/test/windows_timer_utils_test.cc @@ -143,19 +143,18 @@ WindowsTimerUtilsTest::testMMTimers () test_tgt_granularity ("Minimum Timer Resolution", avg_min_res_tgt_elapsed); - // test that it the avg granularity is the same as miniumum resolution - CPPUNIT_ASSERT (avg_min_res_tgt_elapsed == 1); + // In a heavily loaded system and without running this test with raised + // scheduling priority we can't assume that the granularity is the same as + // the minimum timer resolution so give it a few ms of slack, if it is + // greater than that then there likely is a problem that needs investigating. + CPPUNIT_ASSERT (avg_min_res_tgt_elapsed <= 5); uint32_t avg_min_res_sleep_elapsed = 0; + // This should have roughly the same granularity as the tgt test above test_sleep_granularity ("Minimum Timer Resolution", avg_min_res_sleep_elapsed); - // In a heavily loaded system and without running this test with raised - // scheduling priority we can't assume that the sleep granularity is the - // same as the minimum timer resolution so give it 1ms of slack, if it is - // greater than that then there likely is a problem that needs - // investigating. - CPPUNIT_ASSERT (avg_min_res_sleep_elapsed <= 2); + CPPUNIT_ASSERT (avg_min_res_sleep_elapsed <= 5); CPPUNIT_ASSERT (PBD::MMTIMERS::reset_resolution());