[Libreoffice-commits] core.git: vcl/qa

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 16 11:43:44 UTC 2019


 vcl/qa/cppunit/timer.cxx |   77 -----------------------------------------------
 1 file changed, 77 deletions(-)

New commits:
commit 98fb1f98031dc6ef5d100bb2af7b504a77a52b2c
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Aug 16 12:12:29 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Aug 16 13:43:06 2019 +0200

    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 at fbihome.de>
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

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();


More information about the Libreoffice-commits mailing list