diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-06-06 14:56:05 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-07-10 15:20:09 -0400 |
commit | f7d654b81e1a65803c22bb53fc1d3a2021d87d50 (patch) | |
tree | f97ef47c02419b0d38f03b85ad62f745e653cf41 /src/test/include.am | |
parent | fab99844fc324b2c9d415b1b1c192a25cf1c4230 (diff) | |
download | tor-f7d654b81e1a65803c22bb53fc1d3a2021d87d50.tar.gz tor-f7d654b81e1a65803c22bb53fc1d3a2021d87d50.zip |
Start work on fancy compiler tricks to expose extra stuff to our tests
This is mainly a matter of automake trickery: we build each static
library in two versions now: one with the TOR_UNIT_TESTS macro
defined, and one without. When TOR_UNIT_TESTS is defined, we can
enable mocking and expose more functions. When it's not defined, we
can lock the binary down more.
The alternatives would be to have alternate build modes: a "testing
configuration" for building the libraries with test support, and a
"production configuration" for building them without. I don't favor
that approach, since I think it would mean more people runnning
binaries build for testing, or more people not running unit tests.
Diffstat (limited to 'src/test/include.am')
-rw-r--r-- | src/test/include.am | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/test/include.am b/src/test/include.am index 112d1a79d8..08eb7fba67 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -1,11 +1,15 @@ TESTS+= src/test/test -noinst_PROGRAMS+= src/test/test src/test/test-child src/test/bench +noinst_PROGRAMS+= src/test/bench +if UNITTESTS_ENABLED +noinst_PROGRAMS+= src/test/test src/test/test-child +endif src_test_AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \ -DLOCALSTATEDIR="\"$(localstatedir)\"" \ -DBINDIR="\"$(bindir)\"" \ - -I"$(top_srcdir)/src/or" -I"$(top_srcdir)/src/ext" + -I"$(top_srcdir)/src/or" -I"$(top_srcdir)/src/ext" \ + -DTOR_UNIT_TESTS # -L flags need to go in LDFLAGS. -l flags need to go in LDADD. # This seems to matter nowhere but on Windows, but I assure you that it @@ -36,9 +40,9 @@ src_test_bench_CPPFLAGS= $(src_test_AM_CPPFLAGS) src_test_test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \ @TOR_LDFLAGS_libevent@ -src_test_test_LDADD = src/or/libtor.a src/common/libor.a \ - src/common/libor-crypto.a $(LIBDONNA) \ - src/common/libor-event.a \ +src_test_test_LDADD = src/or/libtor-testing.a src/common/libor-testing.a \ + src/common/libor-crypto-testing.a $(LIBDONNA) \ + src/common/libor-event-testing.a \ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ |