test: add --debugrun switch

Normally we use getgrp() to find out which lool* processes are ours when
running 'make check', to support running multiple of these in parallel.

However, in case you try to debug a failure, it's handy to start loolwsd
manually and invoke ./test manually in two different shells.

So add a switch which allows this: the result is that the failing test
doesn't fail early in an uninteresting way (complaining that it can't
find any loolkit processes) but fails the same way as during 'make
check'.

Let's call this --debugrun, since core has similar
gb_UITest_DEBUGRUN/gb_JunitTest_DEBUGRUN switches, which also allow
connecting to an already running "main" process.

Change-Id: Ic7e29eb143ae70f199ef3a09ec9d6b6f8ee0650d
This commit is contained in:
Miklos Vajna 2019-08-29 09:00:16 +02:00
parent 1e044a40aa
commit 38e06bf94e

View file

@ -64,9 +64,12 @@ bool filterTests(CPPUNIT_NS::TestRunner& runner, CPPUNIT_NS::Test* testRegistry,
return haveTests;
}
static bool IsDebugrun = false;
int main(int argc, char** argv)
{
const bool verbose = (argc > 1 && std::string("--verbose") == argv[1]);
IsDebugrun = (argc > 2 && std::string("--debugrun") == argv[2]);
const char* loglevel = verbose ? "trace" : "error";
Log::initialize("tst", loglevel, true, false, {});
@ -203,7 +206,8 @@ std::vector<int> getProcPids(const char* exec_filename)
{
// We could have several make checks running at once.
int kidGrp = std::atoi(tokens[4].c_str());
if (kidGrp != grp)
// Don't require matching grp for --debugrun invocations.
if (kidGrp != grp && !IsDebugrun)
continue;
switch (tokens[2].c_str()[0])