wsd: add parameter --signal

To signal SIGUSR2 to parent to notify
that the server is ready to accept connections,
and begin the tests.

Change-Id: Ie936217243aa7a2e836f3d45cb508ede13fae8c5
Signed-off-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
Henry Castro 2022-04-13 14:53:49 -04:00 committed by Michael Meeks
parent 16e6494a21
commit 6bfe68ea93
2 changed files with 13 additions and 0 deletions

View file

@ -850,6 +850,7 @@ bool COOLWSD::NoCapsForKit = false;
bool COOLWSD::NoSeccomp = false;
bool COOLWSD::AdminEnabled = true;
bool COOLWSD::UnattendedRun = false;
bool COOLWSD::SignalParent = false;
#if ENABLE_DEBUG
bool COOLWSD::SingleKit = false;
#endif
@ -2478,6 +2479,10 @@ void COOLWSD::defineOptions(OptionSet& optionSet)
.required(false)
.repeatable(false));
optionSet.addOption(Option("signal", "", "Send signal SIGUSR2 to parent process when server is ready to accept connections")
.required(false)
.repeatable(false));
#if ENABLE_DEBUG
optionSet.addOption(Option("unitlib", "", "Unit testing library path.")
.required(false)
@ -2538,6 +2543,9 @@ void COOLWSD::handleOption(const std::string& optionName,
ConfigDir = value;
else if (optionName == "lo-template-path")
LoTemplate = value;
else if (optionName == "signal")
SignalParent = true;
#if ENABLE_DEBUG
else if (optionName == "unitlib")
UnitTestLibrary = value;
@ -4961,6 +4969,10 @@ int COOLWSD::innerMain()
#if !MOBILEAPP
std::cerr << "Ready to accept connections on port " << ClientPortNumber << ".\n" << std::endl;
if (SignalParent)
{
kill(getppid(), SIGUSR2);
}
#endif
#if !MOBILEAPP

View file

@ -227,6 +227,7 @@ public:
static bool NoSeccomp;
static bool AdminEnabled;
static bool UnattendedRun; //< True when run from an unattended test, not interactive.
static bool SignalParent;
#if ENABLE_DEBUG
static bool SingleKit;
#endif