fuzzer: Compile a separate binary that contains both loolwsd and loolforkit.

Change-Id: I158e4b19d0929de03f09645c106aebfdbc44ea74
private/Ashod/nonblocking
Jan Holesovsky 2017-02-06 15:59:14 +01:00
parent 02e118387a
commit 0dac1c4321
5 changed files with 29 additions and 11 deletions

View File

@ -2,7 +2,7 @@ SUBDIRS = . test loleaflet
export ENABLE_DEBUG
bin_PROGRAMS = loolwsd loolforkit loolmap loolmount looltool loolstress
bin_PROGRAMS = loolwsd loolforkit loolwsd_fuzzer loolmap loolmount looltool loolstress
dist_bin_SCRIPTS = loolwsd-systemplate-setup
@ -32,6 +32,8 @@ AM_LDFLAGS = -pthread -Wl,-E
loolforkit_LDFLAGS = -pthread -Wl,-E,-rpath,/snap/loolwsd/current/usr/lib
loolmount_LDFLAGS = -pthread -Wl,-E,-rpath,/snap/loolwsd/current/usr/lib
loolwsd_fuzzer_CPPFLAGS = -DKIT_IN_PROCESS=1 $(AM_CPPFLAGS)
AM_ETAGSFLAGS = --c++-kinds=+p --fields=+iaS --extra=+q -R --totals=yes *
AM_CTAGSFLAGS = $(AM_ETAGSFLAGS)
@ -47,7 +49,7 @@ shared_sources = common/FileUtil.cpp \
common/UnitHTTP.cpp \
common/Util.cpp
loolwsd_SOURCES = wsd/Admin.cpp \
loolwsd_sources = wsd/Admin.cpp \
wsd/AdminModel.cpp \
wsd/Auth.cpp \
wsd/DocumentBroker.cpp \
@ -55,7 +57,9 @@ loolwsd_SOURCES = wsd/Admin.cpp \
wsd/ClientSession.cpp \
wsd/FileServer.cpp \
wsd/Storage.cpp \
wsd/TileCache.cpp \
wsd/TileCache.cpp
loolwsd_SOURCES = $(loolwsd_sources) \
$(shared_sources)
noinst_PROGRAMS = connect \
@ -73,11 +77,17 @@ lokitclient_SOURCES = common/IoUtil.cpp \
common/Protocol.cpp \
common/Util.cpp
loolforkit_SOURCES = kit/ChildSession.cpp \
loolforkit_sources = kit/ChildSession.cpp \
kit/ForKit.cpp \
kit/Kit.cpp \
kit/Kit.cpp
loolforkit_SOURCES = $(loolforkit_sources) \
$(shared_sources)
loolwsd_fuzzer_SOURCES = $(loolwsd_sources) \
$(loolforkit_sources) \
$(shared_sources)
# build a binary with no caps to help debugging
loolforkit_nocaps_SOURCES = $(loolforkit_SOURCES)

View File

@ -46,7 +46,7 @@ namespace Util
bool windowingAvailable();
#ifndef BUILDING_TESTS
#if !defined(BUILDING_TESTS) && !defined(KIT_IN_PROCESS)
/// Send a message to all clients.
void alertAllUsers(const std::string& msg);

View File

@ -53,8 +53,10 @@ static std::atomic<unsigned> ForkCounter( 0 );
static std::map<Process::PID, std::string> childJails;
#ifndef KIT_IN_PROCESS
int ClientPortNumber = DEFAULT_CLIENT_PORT_NUMBER;
int MasterPortNumber = DEFAULT_MASTER_PORT_NUMBER;
#endif
/// Dispatcher class to demultiplex requests from
/// WSD and handles them.
@ -267,7 +269,11 @@ static void printArgumentHelp()
std::cout << "" << std::endl;
}
#ifndef KIT_IN_PROCESS
int main(int argc, char** argv)
#else
int loolforkit_main(int argc, char** argv)
#endif
{
if (!hasCorrectUID("loolforkit"))
{
@ -307,7 +313,7 @@ int main(int argc, char** argv)
std::string sysTemplate;
std::string loTemplate;
#if ENABLE_DEBUG
#if ENABLE_DEBUG && !defined(KIT_IN_PROCESS)
static const char* clientPort = std::getenv("LOOL_TEST_CLIENT_PORT");
if (clientPort)
ClientPortNumber = std::stoi(clientPort);
@ -340,6 +346,7 @@ int main(int argc, char** argv)
eq = std::strchr(cmd, '=');
childRoot = std::string(eq+1);
}
#ifndef KIT_IN_PROCESS
else if (std::strstr(cmd, "--clientport=") == cmd)
{
eq = std::strchr(cmd, '=');
@ -350,6 +357,7 @@ int main(int argc, char** argv)
eq = std::strchr(cmd, '=');
MasterPortNumber = std::stoll(std::string(eq+1));
}
#endif
else if (std::strstr(cmd, "--version") == cmd)
{
std::string version, hash;

View File

@ -1930,11 +1930,10 @@ bool globalPreinit(const std::string &loTemplate)
return true;
}
#if !defined(BUILDING_TESTS) && !defined(KIT_IN_PROCESS)
namespace Util
{
#ifndef BUILDING_TESTS
void alertAllUsers(const std::string& msg)
{
document->sendTextFrame(msg);
@ -1945,8 +1944,7 @@ void alertAllUsers(const std::string& cmd, const std::string& kind)
alertAllUsers("errortoall: cmd=" + cmd + " kind=" + kind);
}
}
#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -2541,6 +2541,7 @@ void UnitWSD::testHandleRequest(TestRequest type, UnitHTTPServerRequest& request
}
}
#if !defined(BUILDING_TESTS) && !defined(KIT_IN_PROCESS)
namespace Util
{
@ -2557,6 +2558,7 @@ void alertAllUsers(const std::string& msg)
}
}
#endif
POCO_SERVER_MAIN(LOOLWSD)