[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - 4 commits - loolwsd/debian loolwsd/loolwsd.spec.in loolwsd/test

Tor Lillqvist tml at collabora.com
Tue Oct 11 12:34:03 UTC 2016


 loolwsd/debian/control      |    2 +-
 loolwsd/loolwsd.spec.in     |    2 +-
 loolwsd/test/httpwstest.cpp |   35 ++++++++++++++++++++++++++++++-----
 3 files changed, 32 insertions(+), 7 deletions(-)

New commits:
commit beb38d409637c45c0139f7fd990e02d644201692
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Oct 11 15:30:54 2016 +0300

    Just give up on testEditLock
    
    Even after cherry-picking fixes made to it in the master branch
    (before it was removed completely there as it lost relevance), it
    causes the process to die with 'terminate called without an active
    exception'. Threads, huh.

diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 91cdf96..6985914 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -74,7 +74,9 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST(testPasswordProtectedDocumentWithCorrectPassword);
     CPPUNIT_TEST(testPasswordProtectedDocumentWithCorrectPasswordAgain);
     CPPUNIT_TEST(testInsertDelete);
+#if 0 // This test just doesn't work. Threads.
     CPPUNIT_TEST(testEditLock);
+#endif
     CPPUNIT_TEST(testSlideShow);
     CPPUNIT_TEST(testInactiveClient);
     CPPUNIT_TEST(testMaxColumn);
commit 9f923e3b1e768ed0017284b042980dac4269bc5f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun May 15 10:23:18 2016 -0400

    loolwsd: better editlock test
    
    Change-Id: Ia0fa59b3b6b61bd054bd3d25f126884f4e5211b7
    Reviewed-on: https://gerrit.libreoffice.org/25008
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 8f4499f..91cdf96 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -1033,6 +1033,10 @@ void HTTPWSTest::testEditLock()
     std::string documentPath, documentURL;
     getDocumentPathAndURL("hello.odt", documentPath, documentURL);
 
+    // This test doesn't really need to be multithreaded.
+    // But it's done this way as an experiment and to serve
+    // as an example for other similar tests (where necessary).
+    // Ultimately, the complexity doesn't justify it.
     std::mutex mutex;
     std::condition_variable cv;
     volatile bool second_client_died = false;
@@ -1065,7 +1069,7 @@ void HTTPWSTest::testEditLock()
                                     lock.unlock();
                                     cv.notify_one();
                                 }
-                                else if (editlock1 == "editlock: 1")
+                                else if (msg == "editlock: 1")
                                 {
                                     if (second_client_died)
                                     {
@@ -1080,6 +1084,7 @@ void HTTPWSTest::testEditLock()
                                     {
                                         // Normal broadcast when the second client joins.
                                         std::cerr << "First client still has the lock." << std::endl;
+                                        CPPUNIT_ASSERT_EQUAL(std::string("editlock: 1"), msg);
                                         CPPUNIT_ASSERT_MESSAGE("First doesn't have the lock", first_has_editlock);
                                     }
                                 }
@@ -1089,6 +1094,8 @@ void HTTPWSTest::testEditLock()
                                     std::cerr << "First client lost the lock." << std::endl;
                                     CPPUNIT_ASSERT_EQUAL(std::string("editlock: 0"), msg);
                                     first_has_editlock = false;
+                                    std::cerr << "Allowing the second to die." << std::endl;
+                                    cv.notify_one();
                                 }
                             }
 
@@ -1129,6 +1136,9 @@ void HTTPWSTest::testEditLock()
                             // But we will take it.
                             std::cerr << "Second client taking lock." << std::endl;
                             sendTextFrame(*socket, "takeedit");
+
+                            // Wait until the first gets the notification that we took it.
+                            cv.wait(lock);
                         }
                         else
                         {
@@ -1144,8 +1154,8 @@ void HTTPWSTest::testEditLock()
                 });
 
         std::cerr << "Second client out." << std::endl;
-        socket->shutdown();
         second_client_died = true;
+        socket->shutdown();
         first_client.join();
 
         // The second will think it had the lock when it died, but it will give it up.
commit 8b4f365577681f05d5db74b825187e0e37f8a99b
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri May 13 08:47:47 2016 -0400

    loolwsd: improved testEditLock to minimize random failures and maximize checks
    
    Change-Id: I8ae03d57c9f0f13ebf75122dc66ccdf5b756917d
    Reviewed-on: https://gerrit.libreoffice.org/24969
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 725edf6..8f4499f 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -1036,6 +1036,8 @@ void HTTPWSTest::testEditLock()
     std::mutex mutex;
     std::condition_variable cv;
     volatile bool second_client_died = false;
+    volatile bool first_has_editlock = false;
+    volatile bool second_has_editlock = false;
 
     // The first client loads the document and checks that it has the lock.
     // It then waits until the lock is taken away.
@@ -1046,8 +1048,8 @@ void HTTPWSTest::testEditLock()
                 std::cerr << "First client loading." << std::endl;
                 auto socket = loadDocAndGetSocket(_uri, documentURL, true);
                 std::string editlock1;
-                sendTextFrame(socket, "status");
-                SocketProcessor("First", socket, [&](const std::string& msg)
+                std::unique_lock<std::mutex> lock(mutex);
+                SocketProcessor("First ", socket, [&](const std::string& msg)
                         {
                             if (msg.find("editlock") == 0)
                             {
@@ -1055,10 +1057,12 @@ void HTTPWSTest::testEditLock()
                                 {
                                     std::cerr << "First client has the lock." << std::endl;
                                     CPPUNIT_ASSERT_EQUAL(std::string("editlock: 1"), msg);
+                                    first_has_editlock = true;
                                     editlock1 = msg;
 
                                     // Initial condition met, connect second client.
                                     std::cerr << "Starting second client." << std::endl;
+                                    lock.unlock();
                                     cv.notify_one();
                                 }
                                 else if (editlock1 == "editlock: 1")
@@ -1069,12 +1073,14 @@ void HTTPWSTest::testEditLock()
                                         // but we should get it back once they die.
                                         std::cerr << "First client is given the lock." << std::endl;
                                         CPPUNIT_ASSERT_EQUAL(std::string("editlock: 1"), msg);
+                                        first_has_editlock = true;
                                         return false; // Done!
                                     }
                                     else
                                     {
                                         // Normal broadcast when the second client joins.
                                         std::cerr << "First client still has the lock." << std::endl;
+                                        CPPUNIT_ASSERT_MESSAGE("First doesn't have the lock", first_has_editlock);
                                     }
                                 }
                                 else
@@ -1082,6 +1088,7 @@ void HTTPWSTest::testEditLock()
                                     // Another client took the lock.
                                     std::cerr << "First client lost the lock." << std::endl;
                                     CPPUNIT_ASSERT_EQUAL(std::string("editlock: 0"), msg);
+                                    first_has_editlock = false;
                                 }
                             }
 
@@ -1116,6 +1123,7 @@ void HTTPWSTest::testEditLock()
                             // We shouldn't have it.
                             std::cerr << "Second client doesn't have the lock." << std::endl;
                             CPPUNIT_ASSERT_EQUAL(std::string("editlock: 0"), msg);
+                            second_has_editlock = false;
                             editlock1 = msg;
 
                             // But we will take it.
@@ -1127,6 +1135,7 @@ void HTTPWSTest::testEditLock()
                             // Now it should be ours.
                             std::cerr << "Second client took the lock." << std::endl;
                             CPPUNIT_ASSERT_EQUAL(std::string("editlock: 1"), msg);
+                            second_has_editlock = true;
                             return false;
                         }
                     }
@@ -1137,8 +1146,12 @@ void HTTPWSTest::testEditLock()
         std::cerr << "Second client out." << std::endl;
         socket->shutdown();
         second_client_died = true;
-
         first_client.join();
+
+        // The second will think it had the lock when it died, but it will give it up.
+        CPPUNIT_ASSERT_MESSAGE("Second doesn't have the lock", second_has_editlock);
+        // The first must ultimately have the lock back.
+        CPPUNIT_ASSERT_MESSAGE("First didn't get back the lock", first_has_editlock);
     }
     catch (const Poco::Exception& exc)
     {
commit 0c17c913f19321220e6c8cd52bfa800a4f0a67a9
Author: Andras Timar <andras.timar at collabora.com>
Date:   Tue Oct 11 13:52:26 2016 +0200

    Bump Collabora Office version
    
    (cherry picked from commit a584cc0b76fd87e5a6ce4e3edc97da41781bc6e1)

diff --git a/loolwsd/debian/control b/loolwsd/debian/control
index d40074a..d06db78 100644
--- a/loolwsd/debian/control
+++ b/loolwsd/debian/control
@@ -8,7 +8,7 @@ Standards-Version: 3.9.7
 Package: loolwsd
 Section: web
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, libsm6, libssl1.0.0, libodbc1, libxinerama1, libcairo2, libgl1-mesa-glx, libcups2, libdbus-glib-1-2, cpio, collaboraofficebasis5.1-base (>= 5.1.10.8), collaboraofficebasis5.1-calc (>= 5.1.10.8), collaboraofficebasis5.1-core (>= 5.1.10.8), collaboraofficebasis5.1-draw (>= 5.1.10.8), collaboraofficebasis5.1-extension-beanshell-script-provider (>= 5.1.10.8), collaboraofficebasis5.1-extension-ct2n (>= 5.1.10.8), collaboraofficebasis5.1-extension-javascript-script-provider (>= 5.1.10.8), collaboraofficebasis5.1-extension-mediawiki-publisher (>= 5.1.10.8), collaboraofficebasis5.1-extension-nlpsolver (>= 5.1.10.8), collaboraofficebasis5.1-extension-numbertext (>= 5.1.10.8), collaboraofficebasis5.1-extension-pdf-import (>= 5.1.10.8), collaboraofficebasis5.1-extension-report-builder (>= 5.1.10.8), collaboraofficebasis5.1-gnome-integration (>= 5.1.10.8), collaboraofficebasis5.1-graphicfilter (>= 5.1.10.8), collaboraofficebasis5.1-images (>
 = 5.1.10.8), collaboraofficebasis5.1-impress (>= 5.1.10.8), collaboraofficebasis5.1-librelogo (>= 5.1.10.8), collaboraofficebasis5.1-math (>= 5.1.10.8), collaboraofficebasis5.1-ogltrans (>= 5.1.10.8), collaboraofficebasis5.1-ooofonts (>= 5.1.10.8), collaboraofficebasis5.1-ooolinguistic (>= 5.1.10.8), collaboraofficebasis5.1-postgresql-sdbc (>= 5.1.10.8), collaboraofficebasis5.1-python-script-provider (>= 5.1.10.8), collaboraofficebasis5.1-pyuno (>= 5.1.10.8), collaboraofficebasis5.1-writer (>= 5.1.10.8), collaboraofficebasis5.1-xsltfilter (>= 5.1.10.8), collaboraoffice5.1 (>= 5.1.10.8), collaboraoffice5.1-base (>= 5.1.10.8), collaboraoffice5.1-calc (>= 5.1.10.8), collaboraoffice5.1-dict-en (>= 5.1.10.8), collaboraoffice5.1-draw (>= 5.1.10.8), collaboraoffice5.1-debian-menus (>= 5.1.10.8), collaboraoffice5.1-impress (>= 5.1.10.8), collaboraoffice5.1-math (>= 5.1.10.8), collaboraoffice5.1-ure (>= 5.1.10.8), collaboraoffice5.1-writer (>= 5.1.10.8), collaboraofficebasis5.1-en-us (>= 5.1
 .10.8), collaboraofficebasis5.1-en-us-base (>= 5.1.10.8), collaboraofficebasis5.1-en-us-calc (>= 5.1.10.8), collaboraofficebasis5.1-en-us-math (>= 5.1.10.8), collaboraofficebasis5.1-en-us-res (>= 5.1.10.8), collaboraofficebasis5.1-en-us-writer (>= 5.1.10.8), collaboraoffice5.1-en-us (>= 5.1.10.8)
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, libsm6, libssl1.0.0, libodbc1, libxinerama1, libcairo2, libgl1-mesa-glx, libcups2, libdbus-glib-1-2, cpio, collaboraofficebasis5.1-base (>= 5.1.10.9), collaboraofficebasis5.1-calc (>= 5.1.10.9), collaboraofficebasis5.1-core (>= 5.1.10.9), collaboraofficebasis5.1-draw (>= 5.1.10.9), collaboraofficebasis5.1-extension-beanshell-script-provider (>= 5.1.10.9), collaboraofficebasis5.1-extension-ct2n (>= 5.1.10.9), collaboraofficebasis5.1-extension-javascript-script-provider (>= 5.1.10.9), collaboraofficebasis5.1-extension-mediawiki-publisher (>= 5.1.10.9), collaboraofficebasis5.1-extension-nlpsolver (>= 5.1.10.9), collaboraofficebasis5.1-extension-numbertext (>= 5.1.10.9), collaboraofficebasis5.1-extension-pdf-import (>= 5.1.10.9), collaboraofficebasis5.1-extension-report-builder (>= 5.1.10.9), collaboraofficebasis5.1-gnome-integration (>= 5.1.10.9), collaboraofficebasis5.1-graphicfilter (>= 5.1.10.9), collaboraofficebasis5.1-images (>
 = 5.1.10.9), collaboraofficebasis5.1-impress (>= 5.1.10.9), collaboraofficebasis5.1-librelogo (>= 5.1.10.9), collaboraofficebasis5.1-math (>= 5.1.10.9), collaboraofficebasis5.1-ogltrans (>= 5.1.10.9), collaboraofficebasis5.1-ooofonts (>= 5.1.10.9), collaboraofficebasis5.1-ooolinguistic (>= 5.1.10.9), collaboraofficebasis5.1-postgresql-sdbc (>= 5.1.10.9), collaboraofficebasis5.1-python-script-provider (>= 5.1.10.9), collaboraofficebasis5.1-pyuno (>= 5.1.10.9), collaboraofficebasis5.1-writer (>= 5.1.10.9), collaboraofficebasis5.1-xsltfilter (>= 5.1.10.9), collaboraoffice5.1 (>= 5.1.10.9), collaboraoffice5.1-base (>= 5.1.10.9), collaboraoffice5.1-calc (>= 5.1.10.9), collaboraoffice5.1-dict-en (>= 5.1.10.9), collaboraoffice5.1-draw (>= 5.1.10.9), collaboraoffice5.1-debian-menus (>= 5.1.10.9), collaboraoffice5.1-impress (>= 5.1.10.9), collaboraoffice5.1-math (>= 5.1.10.9), collaboraoffice5.1-ure (>= 5.1.10.9), collaboraoffice5.1-writer (>= 5.1.10.9), collaboraofficebasis5.1-en-us (>= 5.1
 .10.9), collaboraofficebasis5.1-en-us-base (>= 5.1.10.9), collaboraofficebasis5.1-en-us-calc (>= 5.1.10.9), collaboraofficebasis5.1-en-us-math (>= 5.1.10.9), collaboraofficebasis5.1-en-us-res (>= 5.1.10.9), collaboraofficebasis5.1-en-us-writer (>= 5.1.10.9), collaboraoffice5.1-en-us (>= 5.1.10.9)
 Description: LibreOffice On-Line WebSocket Daemon
  LOOLWSD is a daemon that talks to web browser clients and provides LibreOffice
  services.
diff --git a/loolwsd/loolwsd.spec.in b/loolwsd/loolwsd.spec.in
index 70c80eb..4d32ce1 100644
--- a/loolwsd/loolwsd.spec.in
+++ b/loolwsd/loolwsd.spec.in
@@ -27,7 +27,7 @@ BuildRequires:  libcap-progs systemd-rpm-macros
 %endif
 %endif
 
-Requires:       collaboraoffice5.1 >= 5.1.10.8 collaboraoffice5.1-en-US >= 5.1.10.8 collaboraoffice5.1-ure >= 5.1.10.8 collaboraofficebasis5.1-core >= 5.1.10.8 collaboraofficebasis5.1-writer >= 5.1.10.8 collaboraofficebasis5.1-impress >= 5.1.10.8 collaboraofficebasis5.1-graphicfilter >= 5.1.10.8 collaboraofficebasis5.1-en-US >= 5.1.10.8 collaboraofficebasis5.1-calc >= 5.1.10.8 collaboraofficebasis5.1-en-US-res >= 5.1.10.8 collaboraofficebasis5.1-en-US-calc >= 5.1.10.8 collaboraofficebasis5.1-ooofonts >= 5.1.10.8 collaboraofficebasis5.1-images >= 5.1.10.8 collaboraofficebasis5.1-filter-data >= 5.1.10.8 collaboraofficebasis5.1-draw >= 5.1.10.8 collaboraofficebasis5.1-base >= 5.1.10.8 collaboraofficebasis5.1-en-US-writer >= 5.1.10.8 collaboraofficebasis5.1-en-US-math >= 5.1.10.8 collaboraofficebasis5.1-en-US-base >= 5.1.10.8
+Requires:       collaboraoffice5.1 >= 5.1.10.9 collaboraoffice5.1-en-US >= 5.1.10.9 collaboraoffice5.1-ure >= 5.1.10.9 collaboraofficebasis5.1-core >= 5.1.10.9 collaboraofficebasis5.1-writer >= 5.1.10.9 collaboraofficebasis5.1-impress >= 5.1.10.9 collaboraofficebasis5.1-graphicfilter >= 5.1.10.9 collaboraofficebasis5.1-en-US >= 5.1.10.9 collaboraofficebasis5.1-calc >= 5.1.10.9 collaboraofficebasis5.1-en-US-res >= 5.1.10.9 collaboraofficebasis5.1-en-US-calc >= 5.1.10.9 collaboraofficebasis5.1-ooofonts >= 5.1.10.9 collaboraofficebasis5.1-images >= 5.1.10.9 collaboraofficebasis5.1-filter-data >= 5.1.10.9 collaboraofficebasis5.1-draw >= 5.1.10.9 collaboraofficebasis5.1-base >= 5.1.10.9 collaboraofficebasis5.1-en-US-writer >= 5.1.10.9 collaboraofficebasis5.1-en-US-math >= 5.1.10.9 collaboraofficebasis5.1-en-US-base >= 5.1.10.9
 Requires:       systemd
 Requires(post): coreutils grep sed
 %if 0%{?fedora} || 0%{?rhel} >= 7


More information about the Libreoffice-commits mailing list