2016-06-15 17:46:13 -05:00
|
|
|
# Cap threadpools to 4 threads.
|
|
|
|
export MAX_CONCURRENCY=4
|
2016-04-06 13:50:55 -05:00
|
|
|
AUTOMAKE_OPTION = serial-tests
|
|
|
|
|
2016-09-30 03:43:04 -05:00
|
|
|
# unittest: tests that do not need loolwsd running, and that are run during a
|
|
|
|
# normal build
|
2016-10-02 09:01:46 -05:00
|
|
|
# test: tests that need loolwsd running, and that are run via 'make check'
|
2018-11-01 04:18:07 -05:00
|
|
|
check_PROGRAMS = test fakesockettest
|
2016-09-30 03:43:04 -05:00
|
|
|
|
2018-11-01 04:18:07 -05:00
|
|
|
noinst_PROGRAMS = test fakesockettest unittest
|
2015-10-21 05:01:47 -05:00
|
|
|
|
2019-05-23 06:58:34 -05:00
|
|
|
AM_CXXFLAGS = -fPIC -DPIC $(CPPUNIT_CFLAGS) -DTDOC=\"$(top_srcdir)/test/data\" \
|
2017-02-24 13:52:36 -06:00
|
|
|
-I${top_srcdir}/common -I${top_srcdir}/net -I${top_srcdir}/wsd -I${top_srcdir}/kit
|
2015-10-21 05:01:47 -05:00
|
|
|
|
2019-05-23 06:58:34 -05:00
|
|
|
noinst_PROGRAMS += \
|
|
|
|
unit-convert.so unit-typing.so \
|
|
|
|
unit-timeout.so unit-prefork.so \
|
|
|
|
unit-storage.so unit-client.so \
|
|
|
|
unit-admin.so unit-tilecache.so \
|
|
|
|
unit-fuzz.so unit-oob.so unit-http.so unit-oauth.so \
|
|
|
|
unit-wopi.so unit-wopi-saveas.so \
|
|
|
|
unit-wopi-ownertermination.so unit-wopi-versionrestore.so \
|
|
|
|
unit-wopi-documentconflict.so unit_wopi_renamefile.so \
|
|
|
|
unit-wopi-loadencoded.so
|
2018-02-08 08:24:37 -06:00
|
|
|
|
2016-04-05 11:41:10 -05:00
|
|
|
|
2019-05-23 06:58:34 -05:00
|
|
|
AM_LDFLAGS = -pthread $(ZLIB_LIBS)
|
2016-09-28 14:07:07 -05:00
|
|
|
|
2018-05-04 11:47:33 -05:00
|
|
|
if ENABLE_SSL
|
|
|
|
AM_LDFLAGS += -lssl -lcrypto
|
|
|
|
endif
|
|
|
|
|
2016-09-28 14:07:07 -05:00
|
|
|
# We work around some of the mess of using the same sources both on
|
|
|
|
# the server side and here in unit tests with conditional compilation
|
|
|
|
# based on BUILDING_TESTS
|
|
|
|
|
|
|
|
AM_CPPFLAGS = -pthread -I$(top_srcdir) -DBUILDING_TESTS
|
2016-04-05 11:41:10 -05:00
|
|
|
|
2016-05-01 11:35:42 -05:00
|
|
|
wsd_sources = \
|
2016-11-12 15:38:13 -06:00
|
|
|
../common/FileUtil.cpp \
|
2016-11-14 07:58:04 -06:00
|
|
|
../common/SigUtil.cpp \
|
2016-11-24 08:56:06 -06:00
|
|
|
../common/IoUtil.cpp \
|
|
|
|
../common/Log.cpp \
|
|
|
|
../common/Protocol.cpp \
|
|
|
|
../common/Session.cpp \
|
2019-05-03 11:05:52 -05:00
|
|
|
../common/SpookyV2.cpp \
|
2017-03-30 12:14:40 -05:00
|
|
|
../common/Util.cpp \
|
2016-12-10 21:33:45 -06:00
|
|
|
../common/MessageQueue.cpp \
|
2018-11-22 05:03:42 -06:00
|
|
|
../common/Authorization.cpp \
|
2016-11-24 08:56:06 -06:00
|
|
|
../kit/Kit.cpp \
|
2019-05-03 11:05:52 -05:00
|
|
|
../kit/TestStubs.cpp \
|
2017-08-16 09:38:00 -05:00
|
|
|
../wsd/Auth.cpp \
|
2016-11-24 08:56:06 -06:00
|
|
|
../wsd/TileCache.cpp \
|
2017-03-15 07:07:17 -05:00
|
|
|
../wsd/TestStubs.cpp \
|
2016-11-24 08:56:06 -06:00
|
|
|
../common/Unit.cpp \
|
2017-03-02 12:12:52 -06:00
|
|
|
../net/Socket.cpp
|
2016-05-01 11:35:42 -05:00
|
|
|
|
2018-05-04 11:47:33 -05:00
|
|
|
|
2019-05-23 06:58:34 -05:00
|
|
|
WsdSources.cpp :
|
|
|
|
for F in $(wsd_sources); do \
|
|
|
|
echo '#include "'$$F'"'; \
|
|
|
|
done >WsdSources.cpp
|
|
|
|
|
2019-05-24 04:08:54 -05:00
|
|
|
Ssl.cpp :
|
|
|
|
echo '#include "../net/Ssl.cpp"' >Ssl.cpp
|
|
|
|
|
2017-09-19 15:16:44 -05:00
|
|
|
test_base_source = \
|
|
|
|
TileQueueTests.cpp \
|
|
|
|
WhiteBoxTests.cpp \
|
2017-09-16 11:32:20 -05:00
|
|
|
DeltaTests.cpp \
|
2019-05-23 06:58:34 -05:00
|
|
|
WsdSources.cpp
|
2017-09-19 15:16:44 -05:00
|
|
|
|
2019-05-24 04:08:54 -05:00
|
|
|
if ENABLE_SSL
|
|
|
|
test_base_source += Ssl.cpp
|
|
|
|
endif
|
|
|
|
|
2017-09-19 15:16:44 -05:00
|
|
|
test_all_source = \
|
|
|
|
$(test_base_source) \
|
|
|
|
TileCacheTests.cpp \
|
|
|
|
integration-http-server.cpp \
|
|
|
|
httpwstest.cpp \
|
|
|
|
httpcrashtest.cpp \
|
|
|
|
httpwserror.cpp
|
|
|
|
|
2016-09-30 03:43:04 -05:00
|
|
|
unittest_CPPFLAGS = -I$(top_srcdir) -DBUILDING_TESTS
|
2017-09-19 15:16:44 -05:00
|
|
|
unittest_SOURCES = $(test_base_source) test.cpp
|
2016-09-30 03:43:04 -05:00
|
|
|
unittest_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
|
2016-12-17 08:54:19 -06:00
|
|
|
test_CPPFLAGS = -I$(top_srcdir) -DBUILDING_TESTS
|
2017-09-19 15:16:44 -05:00
|
|
|
test_SOURCES = $(test_all_source) test.cpp
|
2016-12-17 08:54:19 -06:00
|
|
|
test_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
|
2018-11-01 04:18:07 -05:00
|
|
|
fakesockettest_SOURCES = fakesockettest.cpp ../net/FakeSocket.cpp
|
|
|
|
fakesockettest_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
|
2016-04-05 11:41:10 -05:00
|
|
|
# unit test modules:
|
2019-05-23 06:58:34 -05:00
|
|
|
unit_oob_so_SOURCES = UnitOOB.cpp
|
|
|
|
unit_oob_so_LDFLAGS = -shared
|
|
|
|
unit_http_so_SOURCES = UnitHTTP.cpp
|
|
|
|
unit_http_so_LDFLAGS = -shared
|
|
|
|
unit_fuzz_so_SOURCES = UnitFuzz.cpp
|
|
|
|
unit_fuzz_so_LDFLAGS = -shared
|
|
|
|
unit_admin_so_SOURCES = UnitAdmin.cpp
|
|
|
|
unit_admin_so_LDFLAGS = -shared
|
|
|
|
unit_admin_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_client_so_SOURCES = UnitClient.cpp ${test_all_source}
|
|
|
|
unit_client_so_LDFLAGS = -shared
|
|
|
|
unit_client_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_typing_so_SOURCES = UnitTyping.cpp
|
|
|
|
unit_typing_so_LDFLAGS = -shared
|
|
|
|
unit_typing_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_convert_so_SOURCES = UnitConvert.cpp
|
|
|
|
unit_convert_so_LDFLAGS = -shared
|
|
|
|
unit_timeout_so_SOURCES = UnitTimeout.cpp
|
|
|
|
unit_timeout_so_LDFLAGS = -shared
|
|
|
|
unit_prefork_so_SOURCES = UnitPrefork.cpp
|
|
|
|
unit_prefork_so_LDFLAGS = -shared
|
|
|
|
unit_storage_so_SOURCES = UnitStorage.cpp
|
|
|
|
unit_storage_so_LDFLAGS = -shared
|
|
|
|
unit_tilecache_so_SOURCES = UnitTileCache.cpp
|
|
|
|
unit_tilecache_so_LDFLAGS = -shared
|
|
|
|
unit_oauth_so_SOURCES = UnitOAuth.cpp
|
|
|
|
unit_oauth_so_LDFLAGS = -shared $(CPPUNIT_LIBS)
|
|
|
|
unit_wopi_so_SOURCES = UnitWOPI.cpp
|
|
|
|
unit_wopi_so_LDFLAGS = -shared
|
|
|
|
unit_wopi_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_wopi_saveas_so_SOURCES = UnitWOPISaveAs.cpp
|
|
|
|
unit_wopi_saveas_so_LDFLAGS = -shared
|
|
|
|
unit_wopi_saveas_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_wopi_ownertermination_so_SOURCES = UnitWopiOwnertermination.cpp
|
|
|
|
unit_wopi_ownertermination_so_LDFLAGS = -shared
|
|
|
|
unit_wopi_ownertermination_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_wopi_versionrestore_so_SOURCES = UnitWOPIVersionRestore.cpp
|
|
|
|
unit_wopi_versionrestore_so_LDFLAGS = -shared
|
|
|
|
unit_wopi_versionrestore_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_wopi_documentconflict_so_SOURCES = UnitWOPIDocumentConflict.cpp
|
|
|
|
unit_wopi_documentconflict_so_LDFLAGS = -shared
|
|
|
|
unit_wopi_documentconflict_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_wopi_renamefile_so_SOURCES = UnitWOPIRenameFile.cpp
|
|
|
|
unit_wopi_renamefile_so_LDFLAGS = -shared
|
|
|
|
unit_wopi_renamefile_so_LDADD = $(CPPUNIT_LIBS)
|
|
|
|
unit_wopi_loadencoded_so_SOURCES = UnitWOPILoadEncoded.cpp
|
|
|
|
unit_wopi_loadencoded_so_LDFLAGS = -shared
|
|
|
|
unit_wopi_loadencoded_so_LDADD = $(CPPUNIT_LIBS)
|
2016-04-05 11:41:10 -05:00
|
|
|
|
2016-04-12 01:29:57 -05:00
|
|
|
if HAVE_LO_PATH
|
2016-04-12 01:37:24 -05:00
|
|
|
SYSTEM_STAMP = @SYSTEMPLATE_PATH@/system_stamp
|
2016-04-12 01:29:57 -05:00
|
|
|
else
|
|
|
|
SYSTEM_STAMP =
|
|
|
|
endif
|
|
|
|
|
2016-04-05 11:41:10 -05:00
|
|
|
if HAVE_LO_PATH
|
2016-10-11 07:26:02 -05:00
|
|
|
check-local:
|
2018-11-01 05:10:47 -05:00
|
|
|
./fakesockettest
|
2017-04-05 08:44:44 -05:00
|
|
|
@fc-cache "@LO_PATH@"/share/fonts/truetype
|
2016-04-30 12:15:41 -05:00
|
|
|
./run_unit.sh --log-file test.log --trs-file test.trs
|
2017-01-16 03:15:47 -06:00
|
|
|
# FIXME 2: unit-oob.la fails with symbol undefined:
|
|
|
|
# UnitWSD::testHandleRequest(UnitWSD::TestRequest, UnitHTTPServerRequest&, UnitHTTPServerResponse&) ,
|
2019-02-14 15:40:33 -06:00
|
|
|
|
2019-05-23 06:58:34 -05:00
|
|
|
TESTS = unit-typing.so unit-convert.so unit-prefork.so unit-tilecache.so \
|
|
|
|
unit-timeout.so unit-oauth.so unit-wopi.so unit-wopi-saveas.so \
|
|
|
|
unit-wopi-ownertermination.so unit-wopi-versionrestore.so \
|
|
|
|
unit-wopi-documentconflict.so unit_wopi_renamefile.so \
|
|
|
|
unit-http.so \
|
|
|
|
unit-wopi-loadencoded.so
|
|
|
|
# TESTS = unit-client.so
|
|
|
|
# TESTS += unit-admin.so
|
|
|
|
# TESTS += unit-storage.so
|
2016-04-05 11:41:10 -05:00
|
|
|
else
|
2016-04-06 13:50:55 -05:00
|
|
|
TESTS = ${top_builddir}/test/test
|
2016-04-05 11:41:10 -05:00
|
|
|
endif
|
|
|
|
|
2019-05-23 06:58:34 -05:00
|
|
|
TEST_EXTENSIONS = .so
|
|
|
|
SO_LOG_DRIVER = ${top_srcdir}/test/run_unit.sh
|
2016-04-15 10:39:05 -05:00
|
|
|
|
2018-03-07 06:48:56 -06:00
|
|
|
EXTRA_DIST = data/delta-text.png data/delta-text2.png data/hello.odt data/hello.txt $(test_SOURCES) $(unittest_SOURCES) run_unit.sh
|
2016-05-12 17:40:59 -05:00
|
|
|
|
|
|
|
check_valgrind: all
|
2017-04-05 08:44:44 -05:00
|
|
|
@fc-cache "@LO_PATH@"/share/fonts/truetype
|
2016-05-12 17:40:59 -05:00
|
|
|
./run_unit.sh --log-file test.log --trs-file test.trs --valgrind
|
|
|
|
|
2016-09-30 03:43:04 -05:00
|
|
|
# run unittest during the normal build
|
|
|
|
all-local: unittest
|
|
|
|
@echo
|
|
|
|
@echo "Running build-time unit tests. For more thorough testing, please run 'make check'."
|
|
|
|
@echo
|
2017-04-05 08:44:44 -05:00
|
|
|
@fc-cache "@LO_PATH@"/share/fonts/truetype
|
2017-08-17 07:04:22 -05:00
|
|
|
@${top_builddir}/test/unittest
|