loolwsd/loolwsd-systemplate-setup |    4 +++-
 loolwsd/test/countloolkits.hpp    |   17 +++++++++++++++++
 loolwsd/test/httpposttest.cpp     |   29 +++++++++++++++++++++++++++++
 loolwsd/test/httpwstest.cpp       |   11 +++++------
 4 files changed, 54 insertions(+), 7 deletions(-)

New commits:
commit b1aa059bc35bc6b770bb171fe83416ad415c0893
Author: Tor Lillqvist <t...@collabora.com>
Date:   Fri Apr 15 17:19:04 2016 +0300

    I don't have any ~/.fonts

diff --git a/loolwsd/loolwsd-systemplate-setup 
b/loolwsd/loolwsd-systemplate-setup
index 54a2df0..d6539e3 100755
--- a/loolwsd/loolwsd-systemplate-setup
+++ b/loolwsd/loolwsd-systemplate-setup
@@ -99,5 +99,7 @@ ln -s /lo $CHROOT/$INSTDIR
 if test "z$ENABLE_DEBUG" != "z" -a "z$HOME" != "z"; then
     echo "Copying development users's fonts into systemplate"
     mkdir -p $CHROOT/$HOME
-    cp -r -p -L $HOME/.fonts $CHROOT/$HOME
+    test -d $HOME/.fonts && cp -r -p -L $HOME/.fonts $CHROOT/$HOME
 fi
+
+exit 0
commit 947f8bcf138b3eaa01daa2787069528c03defe44
Author: Tor Lillqvist <t...@collabora.com>
Date:   Fri Apr 15 17:01:02 2016 +0300

    Test number of loolkit processes also before and after the HTTPPostTest 
suite

diff --git a/loolwsd/test/countloolkits.hpp b/loolwsd/test/countloolkits.hpp
new file mode 100644
index 0000000..1fb1ba5
--- /dev/null
+++ b/loolwsd/test/countloolkits.hpp
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COUNTLOOLKITPROCESSES_HPP
+#define INCLUDED_COUNTLOOLKITPROCESSES_HPP
+
+extern int countLoolKitProcesses();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/test/httpposttest.cpp b/loolwsd/test/httpposttest.cpp
index 5255830..f7eec55 100644
--- a/loolwsd/test/httpposttest.cpp
+++ b/loolwsd/test/httpposttest.cpp
@@ -26,14 +26,28 @@
 #include <Common.hpp>
 #include <Util.hpp>
 
+#include "countloolkits.hpp"
+
 /// Tests the HTTP POST API of loolwsd. The server has to be started manually 
before running this test.
 class HTTPPostTest : public CPPUNIT_NS::TestFixture
 {
+    static int _initialLoolKitCount;
+
     CPPUNIT_TEST_SUITE(HTTPPostTest);
+
+    // This should be the first test:
+    CPPUNIT_TEST(testCountHowManyLoolkits);
+
     CPPUNIT_TEST(testConvertTo);
+
+    // This should be the last test:
+    CPPUNIT_TEST(testNoExtraLoolKitsLeft);
+
     CPPUNIT_TEST_SUITE_END();
 
+    void testCountHowManyLoolkits();
     void testConvertTo();
+    void testNoExtraLoolKitsLeft();
 
 #if ENABLE_SSL
 public:
@@ -54,6 +68,14 @@ public:
 #endif
 };
 
+int HTTPPostTest::_initialLoolKitCount = 0;
+
+void HTTPPostTest::testCountHowManyLoolkits()
+{
+    _initialLoolKitCount = countLoolKitProcesses();
+    CPPUNIT_ASSERT(_initialLoolKitCount > 0);
+}
+
 void HTTPPostTest::testConvertTo()
 {
     const auto srcPath = Util::getTempFilePath(TDOC, "hello.odt");
@@ -96,6 +118,13 @@ void HTTPPostTest::testConvertTo()
     CPPUNIT_ASSERT_EQUAL(expectedStream.str(), actualString);
 }
 
+void HTTPPostTest::testNoExtraLoolKitsLeft()
+{
+    int countNow = countLoolKitProcesses();
+
+    CPPUNIT_ASSERT_EQUAL(_initialLoolKitCount, countNow);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(HTTPPostTest);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 2d8ef10..91dfb79 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -36,6 +36,8 @@
 #include <Util.hpp>
 #include <LOOLProtocol.hpp>
 
+#include "countloolkits.hpp"
+
 /// Tests the HTTP WebSocket API of loolwsd. The server has to be started 
manually before running this test.
 class HTTPWSTest : public CPPUNIT_NS::TestFixture
 {
@@ -103,9 +105,6 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     connectLOKit(Poco::Net::HTTPRequest& request,
                  Poco::Net::HTTPResponse& response);
 
-    static
-    int countLoolKitProcesses();
-
 public:
     HTTPWSTest()
 #if ENABLE_SSL
@@ -942,10 +941,10 @@ void HTTPWSTest::getResponseMessage(Poco::Net::WebSocket& 
ws, const std::string&
     }
 }
 
-int HTTPWSTest::countLoolKitProcesses()
+int countLoolKitProcesses()
 {
-    // Give polls in the lool processes time to time out
-    Poco::Thread::sleep(POLL_TIMEOUT_MS*3);
+    // Give polls in the lool processes time to time out etc
+    Poco::Thread::sleep(POLL_TIMEOUT_MS*5);
 
     int result = 0;
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to