mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 13:53:31 +01:00
build: Always compile module support for tests
The --disable-module-* configure option removes code from the final binary but we still build the unit tests with the disable module(s) so we can actually test that code path all the time and not forget about it. Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
a2ff4975f3
commit
43bba89656
@ -51,14 +51,14 @@ AM_ETAGSFLAGS=--regex='{c}/MOCK_IMPL([^,]+,\W*\([a-zA-Z0-9_]+\)\W*,/\1/s'
|
|||||||
if COVERAGE_ENABLED
|
if COVERAGE_ENABLED
|
||||||
TEST_CFLAGS=-fno-inline -fprofile-arcs -ftest-coverage
|
TEST_CFLAGS=-fno-inline -fprofile-arcs -ftest-coverage
|
||||||
if DISABLE_ASSERTS_IN_UNIT_TESTS
|
if DISABLE_ASSERTS_IN_UNIT_TESTS
|
||||||
TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE -DDISABLE_ASSERTS_IN_UNIT_TESTS
|
TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE -DDISABLE_ASSERTS_IN_UNIT_TESTS @TOR_MODULES_ALL_ENABLED@
|
||||||
else
|
else
|
||||||
TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE
|
TEST_CPPFLAGS=-DTOR_UNIT_TESTS -DTOR_COVERAGE @TOR_MODULES_ALL_ENABLED@
|
||||||
endif
|
endif
|
||||||
TEST_NETWORK_FLAGS=--coverage --hs-multi-client 1
|
TEST_NETWORK_FLAGS=--coverage --hs-multi-client 1
|
||||||
else
|
else
|
||||||
TEST_CFLAGS=
|
TEST_CFLAGS=
|
||||||
TEST_CPPFLAGS=-DTOR_UNIT_TESTS
|
TEST_CPPFLAGS=-DTOR_UNIT_TESTS @TOR_MODULES_ALL_ENABLED@
|
||||||
TEST_NETWORK_FLAGS=--hs-multi-client 1
|
TEST_NETWORK_FLAGS=--hs-multi-client 1
|
||||||
endif
|
endif
|
||||||
TEST_NETWORK_WARNING_FLAGS=--quiet --only-warnings
|
TEST_NETWORK_WARNING_FLAGS=--quiet --only-warnings
|
||||||
|
12
configure.ac
12
configure.ac
@ -234,6 +234,9 @@ dnl ---
|
|||||||
dnl Tor modules options. These options are namespaced with --disable-module-XXX
|
dnl Tor modules options. These options are namespaced with --disable-module-XXX
|
||||||
dnl ---
|
dnl ---
|
||||||
|
|
||||||
|
dnl All our modules.
|
||||||
|
m4_define(MODULES, dirauth)
|
||||||
|
|
||||||
dnl Directory Authority module.
|
dnl Directory Authority module.
|
||||||
AC_ARG_ENABLE([module-dirauth],
|
AC_ARG_ENABLE([module-dirauth],
|
||||||
AS_HELP_STRING([--disable-module-dirauth],
|
AS_HELP_STRING([--disable-module-dirauth],
|
||||||
@ -243,6 +246,15 @@ AC_ARG_ENABLE([module-dirauth],
|
|||||||
[Compile with Directory Authority feature support]))
|
[Compile with Directory Authority feature support]))
|
||||||
AM_CONDITIONAL(BUILD_MODULE_DIRAUTH, [test "x$enable_module_dirauth" != "xno"])
|
AM_CONDITIONAL(BUILD_MODULE_DIRAUTH, [test "x$enable_module_dirauth" != "xno"])
|
||||||
|
|
||||||
|
dnl Helper variables.
|
||||||
|
TOR_MODULES_ALL_ENABLED=
|
||||||
|
AC_DEFUN([ADD_MODULE], [
|
||||||
|
MODULE=m4_toupper($1)
|
||||||
|
TOR_MODULES_ALL_ENABLED="${TOR_MODULES_ALL_ENABLED} -DHAVE_MODULE_${MODULE}=1"
|
||||||
|
])
|
||||||
|
m4_foreach_w([module], MODULES, [ADD_MODULE([module])])
|
||||||
|
AC_SUBST(TOR_MODULES_ALL_ENABLED)
|
||||||
|
|
||||||
dnl check for the correct "ar" when cross-compiling.
|
dnl check for the correct "ar" when cross-compiling.
|
||||||
dnl (AM_PROG_AR was new in automake 1.11.2, which we do not yet require,
|
dnl (AM_PROG_AR was new in automake 1.11.2, which we do not yet require,
|
||||||
dnl so kludge up a replacement for the case where it isn't there yet.)
|
dnl so kludge up a replacement for the case where it isn't there yet.)
|
||||||
|
@ -114,20 +114,23 @@ LIBTOR_A_SOURCES = \
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Modules are conditionnally compiled in tor starting here. We add the C files
|
# Modules are conditionnally compiled in tor starting here. We add the C files
|
||||||
# only if the modules has been enabled at configure time.
|
# only if the modules has been enabled at configure time. We always add the
|
||||||
|
# source files of every module to libtor-testing.a so we can build the unit
|
||||||
|
# tests for everything.
|
||||||
#
|
#
|
||||||
|
|
||||||
# The Directory Authority module.
|
# The Directory Authority module.
|
||||||
if BUILD_MODULE_DIRAUTH
|
MODULE_DIRAUTH_SOURCES = \
|
||||||
LIBTOR_A_SOURCES += \
|
|
||||||
src/or/dirauth/dircollate.c \
|
src/or/dirauth/dircollate.c \
|
||||||
src/or/dirauth/dirvote.c \
|
src/or/dirauth/dirvote.c \
|
||||||
src/or/dirauth/shared_random.c \
|
src/or/dirauth/shared_random.c \
|
||||||
src/or/dirauth/shared_random_state.c
|
src/or/dirauth/shared_random_state.c
|
||||||
|
if BUILD_MODULE_DIRAUTH
|
||||||
|
LIBTOR_A_SOURCES += $(MODULE_DIRAUTH_SOURCES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
src_or_libtor_a_SOURCES = $(LIBTOR_A_SOURCES)
|
src_or_libtor_a_SOURCES = $(LIBTOR_A_SOURCES)
|
||||||
src_or_libtor_testing_a_SOURCES = $(LIBTOR_A_SOURCES)
|
src_or_libtor_testing_a_SOURCES = $(LIBTOR_A_SOURCES) $(MODULE_DIRAUTH_SOURCES)
|
||||||
|
|
||||||
src_or_tor_SOURCES = src/or/tor_main.c
|
src_or_tor_SOURCES = src/or/tor_main.c
|
||||||
AM_CPPFLAGS += -I$(srcdir)/src/or -Isrc/or
|
AM_CPPFLAGS += -I$(srcdir)/src/or -Isrc/or
|
||||||
|
Loading…
Reference in New Issue
Block a user