[Libreoffice-commits] online.git: test/test.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue May 14 20:48:01 UTC 2019


 test/test.cpp |   39 +++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)

New commits:
commit 65540da9dc7fdd533ae0a374ebe6c0b67ce25871
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon May 13 15:39:14 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Tue May 14 21:29:12 2019 +0100

    test: use process groups as well to allow concurrent make checks.
    
    Change-Id: Ib1a55f53c51835a8f9fb1c17146f30e887103906

diff --git a/test/test.cpp b/test/test.cpp
index b76bbb02d..6fb933dde 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -168,11 +168,14 @@ 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 = true)
+std::vector<int> getProcPids(const char* exec_filename)
 {
     std::vector<int> pids;
 
-    // Crash all lokit processes.
+    // Ensure we're in the same group.
+    int grp = getpgrp();
+
+    // Get all lokit processes.
     for (auto it = Poco::DirectoryIterator(std::string("/proc")); it != Poco::DirectoryIterator(); ++it)
     {
         try
@@ -196,24 +199,24 @@ std::vector<int> getProcPids(const char* exec_filename, bool ignoreZombies = tru
                 std::string statString;
                 Poco::StreamCopier::copyToString(stat, statString);
                 Poco::StringTokenizer tokens(statString, " ");
-                if (tokens.count() > 3 && tokens[1] == exec_filename)
+                if (tokens.count() > 6 && tokens[1] == exec_filename)
                 {
-                    if (ignoreZombies)
+                    // We could have several make checks running at once.
+                    int kidGrp = std::atoi(tokens[4].c_str());
+                    if (kidGrp != grp)
+                        continue;
+
+                    switch (tokens[2].c_str()[0])
                     {
-                        switch (tokens[2].c_str()[0])
-                        {
-                        // Dead & zombie markers for old and new kernels.
-                        case 'x':
-                        case 'X':
-                        case 'Z':
-                            break;
-                        default:
-                            pids.push_back(pid);
-                            break;
-                        }
-                    }
-                    else
+                    // Dead & zombie markers for old and new kernels.
+                    case 'x':
+                    case 'X':
+                    case 'Z':
+                        break;
+                    default:
                         pids.push_back(pid);
+                        break;
+                    }
                 }
             }
         }
@@ -235,7 +238,7 @@ std::vector<int> getKitPids()
 
 int getLoolKitProcessCount()
 {
-    return getProcPids("(loolkit)", true).size();
+    return getProcPids("(loolkit)").size();
 }
 
 std::vector<int> getForKitPids()


More information about the Libreoffice-commits mailing list