[Libreoffice-commits] online.git: loolwsd/test
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Nov 14 05:14:57 UTC 2016
loolwsd/test/countloolkits.hpp | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
New commits:
commit ae3055c19ad4de84fbdbc8f1c559ba77a92b7718
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Fri Nov 11 22:23:05 2016 -0500
loolwsd: don't ignore zombies when counting loolkit processes
During tests we need to count the number of
oustanding loolkit processes. Since once a process
dies its parents must first reap it to get removed
from the proc table, we can't assume the process
is fully removed until and unless it's reaped.
In crash tests this becomes critical, since if
we load docs right after intentionally killing
loolkits, we will trick wsd into using a zombie
process. It will then fail at first communication
with the child. While this excercise early failure,
in practice this is unrealistic and will force
handling cases that in practice should not happen
(or when they do, nothing too horrible will happen).
By not counting zombies we can now wait in the crash
tests until forkit reaps the kits, then we test
the scenario where there are no ready children
when documents are loaded.
Change-Id: I0e5ca9a02d215ceca36d80071ba57e9a9c9c3240
Reviewed-on: https://gerrit.libreoffice.org/30813
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/test/countloolkits.hpp b/loolwsd/test/countloolkits.hpp
index d27ab3b..947604b 100644
--- a/loolwsd/test/countloolkits.hpp
+++ b/loolwsd/test/countloolkits.hpp
@@ -43,20 +43,22 @@ static int getLoolKitProcessCount()
{
switch (tokens[2].c_str()[0])
{
+ // Dead marker for old and new kernels.
case 'x':
- case 'X': // Kinds of dead-ness.
- case 'Z': // zombies
- break; // ignore
+ case 'X':
+ // Don't ignore zombies.
+ break;
default:
- result++;
+ ++result;
break;
}
// std::cout << "Process:" << pid << ", '" << tokens[1] << "'" << " state: " << tokens[2] << std::endl;
}
}
}
- catch (const Poco::Exception&)
+ catch (const std::exception& ex)
{
+ std::cerr << "Error while iterating processes: " << ex.what() << std::endl;
}
}
@@ -72,9 +74,9 @@ static int countLoolKitProcesses(const int expected)
// information about a successful auto-save. In the HTTPWSTest::testConnectNoLoad() there is
// nothing to auto-save, so it waits in vain.
- // This does not need to depend on any constant from Common.hpp. The shorter the better (the
- // quicker the test runs).
- const auto sleepMs = 200;
+ // This does not need to depend on any constant from Common.hpp.
+ // The shorter the better (the quicker the test runs).
+ const auto sleepMs = 100;
// This has to cause waiting for at least COMMAND_TIMEOUT_MS. Add one second for safety.
const size_t repeat = ((COMMAND_TIMEOUT_MS + 1000) / sleepMs);
More information about the Libreoffice-commits
mailing list