From d3daa2d9d952a9dceca9b171859f8deea124998f Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 5 Oct 2016 22:36:40 +0100 Subject: [PATCH] Mend UnitPrefork. Count pre-forked processes more correctly. Use Unit's returnValue implementation to fix failure exit codes. Accept new loolwsd.log socket as being authentic. --- loolwsd/Unit.cpp | 1 + loolwsd/test/UnitPrefork.cpp | 14 ++------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/loolwsd/Unit.cpp b/loolwsd/Unit.cpp index 6c050cffe..5eb7fb64a 100644 --- a/loolwsd/Unit.cpp +++ b/loolwsd/Unit.cpp @@ -164,6 +164,7 @@ void UnitBase::exitTest(TestResult result) void UnitBase::timeout() { + Log::error("Timed out waiting for unit test to complete"); exitTest(TestResult::TEST_TIMED_OUT); } diff --git a/loolwsd/test/UnitPrefork.cpp b/loolwsd/test/UnitPrefork.cpp index e2522a510..d3c2804bc 100644 --- a/loolwsd/test/UnitPrefork.cpp +++ b/loolwsd/test/UnitPrefork.cpp @@ -50,17 +50,6 @@ public: setHasKitHooks(); } - virtual void returnValue(int &retValue) override - { - // 0 when empty (success), otherwise failure. - if (!_failure.empty()) - { - Log::error("UnitPrefork failed due to: " + _failure); - } - - retValue = !_failure.empty(); - } - virtual void preSpawnCount(int &numPrefork) override { numPrefork = NumToPrefork; @@ -111,7 +100,7 @@ public: virtual void newChild(const std::shared_ptr &socket) override { _childSockets.push_back(socket); - if (_childSockets.size() > NumToPrefork) + if (_childSockets.size() >= NumToPrefork) { Poco::Timestamp::TimeDiff elapsed = _startTime.elapsed(); @@ -260,6 +249,7 @@ public: else if (extDot && !strcmp(extDot, ".rdb")) rdbCount++; else if (strstr(buffer, "unit-prefork.log") || // our log + strstr(buffer, "loolwsd.log") || // debug log (strstr(buffer, "/proc/") && // our readdir strstr(buffer, "/fd"))) ; // ignore