diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-08-16 12:12:29 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-08-16 13:43:06 +0200 |
commit | 98fb1f98031dc6ef5d100bb2af7b504a77a52b2c (patch) | |
tree | 934970c5ffb2aaf67fcae54dbeca7b896e479ebb /vcl | |
parent | 889dc7bffa02236bf2ad56b382997771f0fcf3c6 (diff) |
Drop TimerTest::testStopwatch
(that had been added with 6e13585508ca3c9b66c6571ad1eb42bfcb66ef0b "Add a
TaskStopwatch to interrupt idle loops"). By the same reasoning as in
92e42a0fde32e3f2dbe2c786a0e41547e4912b4b "Drop bogus check from
TimerTest::testStopwatch", there is no guarantee that a StopwatchIdle would run
(close to) ten iterations of Invoke before calling Stop, so the two checks
CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, double(n1Iter), 1.1);
CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, double(n2Iter), 1.1);
are bogus, too. And there are reports of failures like
<https://ci.libreoffice.org//job/lo_tb_master_linux/37847/>:
> /home/tdf/lode/jenkins/workspace/lo_tb_master_linux/vcl/qa/cppunit/timer.cxx:603:TimerTest::testStopwatch
> double equality assertion failed
> - Expected: 10
> - Actual : 6
> - Delta : 1.1
So remove those two bogus checks. But with them gone, testStopwatch would be
rather pointless, so remove it completely.
Change-Id: Iec627de48d693665cde7b5eed445640fedee391c
Reviewed-on: https://gerrit.libreoffice.org/77570
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/timer.cxx | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx index 1c5913d287de..90705d26ec19 100644 --- a/vcl/qa/cppunit/timer.cxx +++ b/vcl/qa/cppunit/timer.cxx @@ -15,7 +15,6 @@ #include <osl/thread.hxx> #include <chrono> -#include <vcl/TaskStopwatch.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> #include <vcl/svapp.hxx> @@ -73,8 +72,6 @@ public: void testPriority(); void testRoundRobin(); - void testStopwatch(); - CPPUNIT_TEST_SUITE(TimerTest); CPPUNIT_TEST(testIdle); CPPUNIT_TEST(testIdleMainloop); @@ -94,8 +91,6 @@ public: CPPUNIT_TEST(testPriority); CPPUNIT_TEST(testRoundRobin); - CPPUNIT_TEST(testStopwatch); - CPPUNIT_TEST_SUITE_END(); }; @@ -532,78 +527,6 @@ void TimerTest::testRoundRobin() CPPUNIT_ASSERT( 3 == nCount1 && 3 == nCount2 ); } -class StopwatchIdle : public AutoIdle -{ - sal_uInt32 m_nIters; - sal_uInt64 m_nBusyTicks; - -public: - StopwatchIdle(sal_uInt64 nBusyTicks) - : AutoIdle("StopwatchIdle") - , m_nIters(0) - , m_nBusyTicks(nBusyTicks) - { - if (m_nBusyTicks > 0) - Start(); - } - - virtual void Invoke() override - { - TaskStopwatch aWatch; - // ignore all system events - aWatch.setInputStop(VclInputFlags::NONE); - - sal_uInt64 nStartTicks = tools::Time::GetSystemTicks(); - sal_uInt64 nCurTicks = nStartTicks; - - while (!aWatch.exceededRuntime()) - { - nCurTicks = tools::Time::GetSystemTicks(); - if (nCurTicks - nStartTicks >= m_nBusyTicks) - { - nCurTicks = nStartTicks + m_nBusyTicks; - break; - } - } - - assert(m_nBusyTicks >= (nCurTicks - nStartTicks)); - m_nBusyTicks -= (nCurTicks - nStartTicks); - m_nIters++; - - if (m_nBusyTicks == 0) - Stop(); - } - - bool isDone(sal_uInt32 &nIters) - { - nIters = m_nIters; - return (m_nBusyTicks == 0); - } -}; - -void TimerTest::testStopwatch() -{ - TaskStopwatch::setTimeSlice(10); - - StopwatchIdle a1Idle(100); - StopwatchIdle a2Idle(100); - - sal_uInt32 n1Iter, n2Iter; - while (true) - { - Application::Reschedule(); - - bool b1Done = a1Idle.isDone(n1Iter); - bool b2Done = a2Idle.isDone(n2Iter); - - if (b1Done && b2Done) - break; - } - - CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, double(n1Iter), 1.1); - CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, double(n2Iter), 1.1); -} - CPPUNIT_TEST_SUITE_REGISTRATION(TimerTest); CPPUNIT_PLUGIN_IMPLEMENT(); |