From 6991eb58c315fc777d30fd4481b4c9f06d935df2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 14 Nov 2014 12:09:55 -0500 Subject: Skip LLFrameTimer test<3>, which fails with Xcode 6.x builds. Hopefully this is temporary until we figure out the real problem! --- indra/llcommon/tests/llframetimer_test.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/tests/llframetimer_test.cpp') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 8ac1c91a3a..40a028867c 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -84,6 +84,7 @@ namespace tut template<> template<> void frametimer_object_t::test<3>() { + skip("fails with Xcode 6.x builds"); F64 seconds_since_epoch = LLFrameTimer::getTotalSeconds(); seconds_since_epoch += 2.0; LLFrameTimer timer; -- cgit v1.2.3 From dbdbcbbd3cc3ba21b255f992fae291ab3f13edcf Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 14 Nov 2014 17:22:26 -0500 Subject: rewrite an llframetimer test to be less sensitive to extended ms_sleep calls --- indra/llcommon/tests/llframetimer_test.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'indra/llcommon/tests/llframetimer_test.cpp') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 8ac1c91a3a..46fc4ce93a 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -88,21 +88,24 @@ namespace tut seconds_since_epoch += 2.0; LLFrameTimer timer; timer.setExpiryAt(seconds_since_epoch); - ensure("timer not expired on create", !timer.hasExpired()); - int ii; - for(ii = 0; ii < 10; ++ii) + /* + * Note that the ms_sleep(200) below is only guaranteed to return + * in 200ms _or_more_, so it should be true that by the 10th + * iteration we've gotten to the 2 seconds requested above + * and the timer should expire, but it can expire in fewer iterations + * if one or more of the ms_sleep calls takes longer. + * (as it did when we moved to Mac OS X 10.10) + */ + int iterations_until_expiration = 0; + while ( !timer.hasExpired() ) { - ms_sleep(150); - LLFrameTimer::updateFrameTime(); - } - ensure("timer not expired after a bit", !timer.hasExpired()); - for(ii = 0; ii < 10; ++ii) - { - ms_sleep(100); - LLFrameTimer::updateFrameTime(); + ms_sleep(200); + LLFrameTimer::updateFrameTime(); + iterations_until_expiration++; } - ensure("timer expired", timer.hasExpired()); + ensure("timer took too long to expire", iterations_until_expiration <= 10); } + /* template<> template<> void frametimer_object_t::test<4>() -- cgit v1.2.3 From a74d0d44d15d5cdc8f86b1b80153721415afa82e Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 14 Nov 2014 22:34:13 -0500 Subject: remove skip from llframetimer_test now that it is fixed --- indra/llcommon/tests/llframetimer_test.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llcommon/tests/llframetimer_test.cpp') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 47e7913cf9..46fc4ce93a 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -84,7 +84,6 @@ namespace tut template<> template<> void frametimer_object_t::test<3>() { - skip("fails with Xcode 6.x builds"); F64 seconds_since_epoch = LLFrameTimer::getTotalSeconds(); seconds_since_epoch += 2.0; LLFrameTimer timer; -- cgit v1.2.3 From a54188cb3d215db94e0392cb33e7ef999963335a Mon Sep 17 00:00:00 2001 From: callum_linden Date: Mon, 22 Dec 2014 14:19:19 -0800 Subject: Investigative check-in to see if system clock() function can be used to time ms_sleep() calls and adjust expectations accordingly --- indra/llcommon/tests/llframetimer_test.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/tests/llframetimer_test.cpp') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index 46fc4ce93a..c36b6a1c42 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -83,7 +83,13 @@ namespace tut } template<> template<> void frametimer_object_t::test<3>() - { + { + clock_t t1 = clock(); + ms_sleep(200); + clock_t t2 = clock(); + clock_t elapsed = t2 - t1 + 1; + std::cout << "Note: using clock(), ms_sleep() actually took " << (long)elapsed << "ms" << std::endl; + F64 seconds_since_epoch = LLFrameTimer::getTotalSeconds(); seconds_since_epoch += 2.0; LLFrameTimer timer; -- cgit v1.2.3 From d91fe250ace0ebbc0f22bbe8b60a3a542cb1e6be Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 23 Dec 2014 11:12:19 -0500 Subject: fix dos line endings --- indra/llcommon/tests/llframetimer_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/tests/llframetimer_test.cpp') diff --git a/indra/llcommon/tests/llframetimer_test.cpp b/indra/llcommon/tests/llframetimer_test.cpp index c36b6a1c42..be372bb855 100755 --- a/indra/llcommon/tests/llframetimer_test.cpp +++ b/indra/llcommon/tests/llframetimer_test.cpp @@ -83,7 +83,7 @@ namespace tut } template<> template<> void frametimer_object_t::test<3>() - { + { clock_t t1 = clock(); ms_sleep(200); clock_t t2 = clock(); -- cgit v1.2.3