[Libreoffice-commits] online.git: 3 commits - common/MessageQueue.hpp net/Socket.cpp net/Socket.hpp test/helpers.hpp test/test.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri May 10 16:55:27 UTC 2019


 common/MessageQueue.hpp |    4 ++--
 net/Socket.cpp          |    2 +-
 net/Socket.hpp          |    2 +-
 test/helpers.hpp        |   21 +++++++++++++++------
 test/test.cpp           |    4 ++--
 5 files changed, 21 insertions(+), 12 deletions(-)

New commits:
commit 501caaa1647e1693a2c94c5020c086c1e5e14dcd
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri May 10 17:25:18 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri May 10 17:38:08 2019 +0100

    test: better zombie handling for more recent kernels.
    
    Change-Id: I2ae0bcc4c42100ee08ee3fcf68cb7022f38aed7b

diff --git a/test/test.cpp b/test/test.cpp
index 31a248d84..b76bbb02d 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -202,10 +202,10 @@ std::vector<int> getProcPids(const char* exec_filename, bool ignoreZombies = tru
                     {
                         switch (tokens[2].c_str()[0])
                         {
-                            // Dead marker for old and new kernels.
+                        // Dead & zombie markers for old and new kernels.
                         case 'x':
                         case 'X':
-                            // Don't ignore zombies.
+                        case 'Z':
                             break;
                         default:
                             pids.push_back(pid);
commit 638fb0316d7e41e842ca54c04815f0484c569c36
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri May 10 16:45:01 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri May 10 17:37:59 2019 +0100

    unipoll: restore missing asserts & some cleanup.
    
    Change-Id: I4277b5e044ead54d91bc834ea05bec649a608678

diff --git a/common/MessageQueue.hpp b/common/MessageQueue.hpp
index f07b4be2a..bf5f6c950 100644
--- a/common/MessageQueue.hpp
+++ b/common/MessageQueue.hpp
@@ -83,7 +83,7 @@ public:
     Payload pop()
     {
         std::unique_lock<std::mutex> lock(_mutex);
-        if (!_queue.size())
+        if (_queue.empty())
             return Payload();
         return get_impl();
     }
@@ -92,7 +92,7 @@ public:
     bool isEmpty()
     {
         std::unique_lock<std::mutex> lock(_mutex);
-        return _queue.size() == 0;
+        return _queue.empty();
     }
 
     /// Thread safe removal of all the pending messages.
diff --git a/net/Socket.cpp b/net/Socket.cpp
index 0f2a68346..fb7e701ee 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -376,7 +376,7 @@ void ServerSocket::dumpState(std::ostream& os)
 void SocketDisposition::execute()
 {
     // We should have hard ownership of this socket.
-    // assert(_socket->getThreadOwner() == std::this_thread::get_id());
+    assert(_socket->getThreadOwner() == std::this_thread::get_id());
     if (_socketMove)
     {
         // Drop pretentions of ownership before _socketMove.
diff --git a/net/Socket.hpp b/net/Socket.hpp
index ded409804..c7712339e 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -470,7 +470,7 @@ public:
                     Log::to_string(_owner) << " (" << Util::getThreadId() <<
                     ") but called from " << std::this_thread::get_id() << ", stop: " << _stop);
 
-        // assert(_stop || sameThread);
+        assert(_stop || sameThread);
     }
 
     /// Poll the sockets for available data to read or buffer to write.
commit 47a0f836dd0e2ec49cd9f40c78a05f5c281dbdd6
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon May 6 20:02:52 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri May 10 17:37:50 2019 +0100

    tests: re-factor PNG save to allow easy re-use elsewhere.
    
    Change-Id: Ic24f67d9a078ae49fa4ac187cc924fe36f482879

diff --git a/test/helpers.hpp b/test/helpers.hpp
index 0bbd3c686..c0f9d112c 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -586,6 +586,20 @@ inline void sendText(std::shared_ptr<LOOLWebSocket>& socket, const std::string&
     }
 }
 
+inline void saveTileAs(const std::vector<char> &tileResponse,
+                       const std::string &filename,
+                       const std::string &testname)
+{
+    const std::string firstLine = LOOLProtocol::getFirstLine(tileResponse);
+    std::vector<char> res(tileResponse.begin() + firstLine.size() + 1, tileResponse.end());
+    std::stringstream streamRes;
+    std::copy(res.begin(), res.end(), std::ostream_iterator<char>(streamRes));
+    std::fstream outStream(filename, std::ios::out);
+    outStream.write(res.data(), res.size());
+    outStream.close();
+    TST_LOG("Saved [" << firstLine << "] to [" << filename << "]");
+}
+
 inline std::vector<char> getTileAndSave(std::shared_ptr<LOOLWebSocket>& socket,
                                         const std::string& req,
                                         const std::string& filename,
@@ -603,12 +617,7 @@ inline std::vector<char> getTileAndSave(std::shared_ptr<LOOLWebSocket>& socket,
     std::copy(res.begin(), res.end(), std::ostream_iterator<char>(streamRes));
 
     if (!filename.empty())
-    {
-        std::fstream outStream(filename, std::ios::out);
-        outStream.write(res.data(), res.size());
-        outStream.close();
-        TST_LOG("Saved [" << firstLine << "] to [" << filename << "]");
-    }
+        saveTileAs(tile, filename, testname);
 
     return res;
 }


More information about the Libreoffice-commits mailing list