[Libreoffice-commits] online.git: test/countloolkits.hpp test/test.cpp wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri May 3 12:52:37 UTC 2019


 test/countloolkits.hpp |    7 +++++++
 test/test.cpp          |    2 +-
 wsd/DocumentBroker.hpp |    2 +-
 wsd/LOOLWSD.cpp        |    6 +++++-
 4 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit c08b2f2ba42f0d7ed1a0852382a5436067cdeda4
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri May 3 13:51:49 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri May 3 13:52:15 2019 +0100

    Improve pid collection and printout for tests.
    
    Change-Id: I820c1acbdbae41dd2c2c6bb7285b84bbb61e79d5

diff --git a/test/countloolkits.hpp b/test/countloolkits.hpp
index 0f7010ff0..782b19b50 100644
--- a/test/countloolkits.hpp
+++ b/test/countloolkits.hpp
@@ -62,6 +62,13 @@ static int countLoolKitProcesses(const int expected)
         TST_LOG("Found " << count << " LoKit processes but was expecting " << expected << ".");
     }
 
+    std::vector<int> pids = getKitPids();
+    std::ostringstream oss;
+    oss << "Test kit pids are ";
+    for (auto i : pids)
+        oss << i << " ";
+    TST_LOG(oss.str());
+
     return count;
 }
 
diff --git a/test/test.cpp b/test/test.cpp
index 91e3251c7..1dde93600 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -158,7 +158,7 @@ bool runClientTests(bool standalone, bool verbose)
 // Versions assuming a single user, on a single machine
 #ifndef UNIT_CLIENT_TESTS
 
-std::vector<int> getProcPids(const char* exec_filename, bool ignoreZombies = false)
+std::vector<int> getProcPids(const char* exec_filename, bool ignoreZombies = true)
 {
     std::vector<int> pids;
 
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 134ad8b77..5fd4cef48 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -331,7 +331,7 @@ public:
     void childSocketTerminated();
 
     /// Get the PID of the associated child process
-    Poco::Process::PID getPid() const { return _childProcess->getPid(); }
+    Poco::Process::PID getPid() const { return _childProcess ? _childProcess->getPid() : 0; }
 
     std::unique_lock<std::mutex> getLock() { return std::unique_lock<std::mutex>(_mutex); }
     std::unique_lock<std::mutex> getDeferredLock() { return std::unique_lock<std::mutex>(_mutex, std::defer_lock); }
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 116e7c560..81447db4d 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -3377,7 +3377,11 @@ std::vector<int> LOOLWSD::getKitPids()
     {
         std::unique_lock<std::mutex> lock(DocBrokersMutex);
         for (const auto &it : DocBrokers)
-            pids.push_back(it.second->getPid());
+        {
+            int pid = it.second->getPid();
+            if (pid > 0)
+                pids.push_back(pid);
+        }
     }
     return pids;
 }


More information about the Libreoffice-commits mailing list