From: g0dil Date: Fri, 13 Nov 2009 09:20:52 +0000 (+0000) Subject: Make all timing critical tests depend on SENF_TIMING_CRITICAL_TESTS X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=61512a4b2d212696b96ed73009b36665c8c637ed;p=senf.git Make all timing critical tests depend on SENF_TIMING_CRITICAL_TESTS git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1521 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/PPI/IntervalTimer.test.cc b/senf/PPI/IntervalTimer.test.cc index e8e746c..7dd31d6 100644 --- a/senf/PPI/IntervalTimer.test.cc +++ b/senf/PPI/IntervalTimer.test.cc @@ -73,13 +73,17 @@ namespace { BOOST_AUTO_UNIT_TEST(intervalTimer) { + char const * enabled (getenv("SENF_TIMING_CRITICAL_TESTS")); + BOOST_WARN_MESSAGE(enabled, "Set SENF_TIMING_CRITICAL_TESTS to not skip timing critical tests"); + TimerTest timer (100,3); senf::ClockService::clock_type start (senf::ClockService::now()); senf::ppi::run(); - BOOST_CHECK_PREDICATE( is_close_clock, - (senf::ClockService::now()) - (start+senf::ClockService::milliseconds(300)) - (senf::ClockService::milliseconds(80)) ); + if (enabled) + BOOST_CHECK_PREDICATE( is_close_clock, + (senf::ClockService::now()) + (start+senf::ClockService::milliseconds(300)) + (senf::ClockService::milliseconds(50)) ); } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/senf/Scheduler/ClockService.test.cc b/senf/Scheduler/ClockService.test.cc index b3fb4a6..3ad36bf 100644 --- a/senf/Scheduler/ClockService.test.cc +++ b/senf/Scheduler/ClockService.test.cc @@ -56,15 +56,19 @@ namespace { BOOST_AUTO_UNIT_TEST(clockService) { + char const * enabled (getenv("SENF_TIMING_CRITICAL_TESTS")); + BOOST_WARN_MESSAGE(enabled, "Set SENF_TIMING_CRITICAL_TESTS to not skip timing critical tests"); + senf::ClockService::restart(); // So we know, when the signal will be delivered senf::ClockService::clock_type t1 (senf::ClockService::now()); delay(200); senf::ClockService::clock_type t2 (senf::ClockService::now()); - BOOST_CHECK_PREDICATE( is_close_clock, - (t1 + senf::ClockService::milliseconds(200)) - (t2) - (senf::ClockService::milliseconds(100)) ); + if (enabled) + BOOST_CHECK_PREDICATE( is_close_clock, + (t1 + senf::ClockService::milliseconds(200)) + (t2) + (senf::ClockService::milliseconds(100)) ); t1 = t2; @@ -72,26 +76,29 @@ BOOST_AUTO_UNIT_TEST(clockService) delay(1*1000); t2 = senf::ClockService::now(); - BOOST_CHECK_PREDICATE( is_close_clock, - (t1 + senf::ClockService::seconds(1)) - (t2) - (senf::ClockService::milliseconds(500)) ); + if (enabled) + BOOST_CHECK_PREDICATE( is_close_clock, + (t1 + senf::ClockService::seconds(1)) + (t2) + (senf::ClockService::milliseconds(500)) ); t1 = t2; delay(200); - BOOST_CHECK_PREDICATE( is_close_clock, - (t1 + senf::ClockService::milliseconds(200)) - (senf::ClockService::now()) - (senf::ClockService::milliseconds(100)) ); + if (enabled) + BOOST_CHECK_PREDICATE( is_close_clock, + (t1 + senf::ClockService::milliseconds(200)) + (senf::ClockService::now()) + (senf::ClockService::milliseconds(100)) ); // The next check validates that the clock service itimer/heartbeat_ is correctly reset after a // clock-skew is detected - BOOST_CHECK_PREDICATE( is_close_clock, - (t1 + senf::ClockService::milliseconds(200)) - (senf::ClockService::now()) - (senf::ClockService::milliseconds(100)) ); + if (enabled) + BOOST_CHECK_PREDICATE( is_close_clock, + (t1 + senf::ClockService::milliseconds(200)) + (senf::ClockService::now()) + (senf::ClockService::milliseconds(100)) ); } ///////////////////////////////cc.e//////////////////////////////////////// diff --git a/senf/Scheduler/FdEvent.test.cc b/senf/Scheduler/FdEvent.test.cc index cfb62db..9cf36c8 100644 --- a/senf/Scheduler/FdEvent.test.cc +++ b/senf/Scheduler/FdEvent.test.cc @@ -236,7 +236,7 @@ namespace { bool is_close(senf::ClockService::clock_type a, senf::ClockService::clock_type b) { - return (a