From 2c4efeb5f36cbe90f6e1fb507d73dbd959a5c033 Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Thu, 7 Jul 2016 14:59:51 -0400 Subject: [PATCH] loolwsd: fix PreFork test We could have up to 3 pipes and we should tollerate them when testing for leaking FDs and pipes. The 3rd is probably a file redirection. Change-Id: I913072307646e62e1802587c9142b2eb8c9dd7bb Reviewed-on: https://gerrit.libreoffice.org/27021 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian --- loolwsd/test/UnitPrefork.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/loolwsd/test/UnitPrefork.cpp b/loolwsd/test/UnitPrefork.cpp index 2b804ee7a..e2522a510 100644 --- a/loolwsd/test/UnitPrefork.cpp +++ b/loolwsd/test/UnitPrefork.cpp @@ -252,7 +252,7 @@ public: assert(len %s\n", ent->d_name, buffer); + Log::info() << "fd:" << ent->d_name << " -> " << buffer << Log::end; if (!strncmp(buffer, "/dev/", sizeof ("/dev/") -1)) deviceCount++; else if (extDot && !strcmp(extDot, ".res")) @@ -274,7 +274,8 @@ public: } fprintf(stderr, "%d devices, %d rdb %d resources, %d pipes, %d descriptors total: %d unexpected\n", deviceCount, rdbCount, resCount, pipeCount, numSockets, numUnexpected); - if (pipeCount > 2 || numUnexpected > 0) + // 3 Pipes at most: 1 input, 1 output, file redirection (or so I imagine them). + if (pipeCount > 3 || numUnexpected > 0) _failure = std::string("Error: unexpected inherited sockets ") + std::to_string(numUnexpected) + " and pipes " + std::to_string(pipeCount);