loolwsd/test/UnitPrefork.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
New commits: commit 4369cb1ff30acdcc3ce0d56a696d0c9b83add433 Author: Ashod Nakashian <[email protected]> Date: Sat May 7 09:44:48 2016 -0400 loolwsd: UnitPrefork times out while waiting on child to respond This prevents deadlocking in case of test failure. Change-Id: I3026311e9a67543a26acb0316546e6b5aacf61dc Reviewed-on: https://gerrit.libreoffice.org/24738 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/loolwsd/test/UnitPrefork.cpp b/loolwsd/test/UnitPrefork.cpp index e90ba79..a9fdbba 100644 --- a/loolwsd/test/UnitPrefork.cpp +++ b/loolwsd/test/UnitPrefork.cpp @@ -14,6 +14,7 @@ #include <sys/types.h> #include <dirent.h> +#include "Common.hpp" #include "IoUtil.hpp" #include "LOOLProtocol.hpp" #include "Unit.hpp" @@ -39,6 +40,12 @@ public: setHasKitHooks(); } + virtual void returnValue(int &retValue) override + { + // 0 when empty (success), otherwise failure. + retValue = !_failure.empty(); + } + virtual void preSpawnCount(int &numPrefork) override { numPrefork = NumToPrefork; @@ -52,6 +59,13 @@ public: int flags; char buffer[4096]; + static const Poco::Timespan waitTime(COMMAND_TIMEOUT_MS * 1000); + if (!socket->poll(waitTime, Poco::Net::Socket::SELECT_READ)) + { + _failure = "Timed out waiting for child to respond to unit-memdump command."; + return; + } + int length = IoUtil::receiveFrame(*socket, buffer, sizeof (buffer), flags); std::string memory = LOOLProtocol::getFirstLine(buffer, length); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
