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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun May 8 04:26:54 UTC 2016


 loolwsd/test/UnitPrefork.cpp |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 641038ef4748d23144b29535eb2ed6d798b380a6
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat May 7 16:58:20 2016 -0400

    loolwsd: noisy failure when test can't collect stats
    
    Change-Id: I6a1693954d84d175478b08f3a49e07e9447e1517
    Reviewed-on: https://gerrit.libreoffice.org/24742
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/UnitPrefork.cpp b/loolwsd/test/UnitPrefork.cpp
index 58fbccc..0124782 100644
--- a/loolwsd/test/UnitPrefork.cpp
+++ b/loolwsd/test/UnitPrefork.cpp
@@ -150,9 +150,17 @@ namespace {
             else if ((value = startsWith(line, "Pss:")))
                 numPSSKb += atoi(value);
         }
+
         std::ostringstream oss;
         oss << numPSSKb << " " << numDirtyKb;
-        return oss.str();
+        const auto res = oss.str();
+        Log::info("readMemorySize: [" + res + "].");
+        if (res.empty())
+        {
+            throw std::runtime_error("Failed to read memory stats.");
+        }
+
+        return res;
     }
 }
 
@@ -240,6 +248,11 @@ public:
                                      std::to_string(getpid()) +
                                      std::string("/smaps");
         _procSMaps = fopen(procName.c_str(), "r");
+        if (_procSMaps == NULL)
+        {
+            _failure = "Failed to open process: " + procName;
+            throw std::runtime_error(_failure);
+        }
     }
 
     virtual bool filterKitMessage(const std::shared_ptr<Poco::Net::WebSocket> &ws,


More information about the Libreoffice-commits mailing list