diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-09-22 12:31:15 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-09-23 00:24:43 -0400 |
commit | da1aa66f70f3ed1e5376baef053a0c76f33cc7d8 (patch) | |
tree | 3f73a0bda1b38ca705cc6f73fa49b756e472fbb8 | |
parent | d4b54549b83bbbfeb9c1d7d843ea244eed389c61 (diff) | |
download | tor-da1aa66f70f3ed1e5376baef053a0c76f33cc7d8.tar.gz tor-da1aa66f70f3ed1e5376baef053a0c76f33cc7d8.zip |
Move testing code into new src/test directory.
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/or/Makefile.am | 35 | ||||
-rw-r--r-- | src/test/Makefile.am | 25 | ||||
-rw-r--r-- | src/test/test.c (renamed from src/or/test.c) | 0 | ||||
-rw-r--r-- | src/test/test.h (renamed from src/or/test.h) | 0 | ||||
-rw-r--r-- | src/test/test_data.c (renamed from src/or/test_data.c) | 0 | ||||
-rw-r--r-- | src/test/tinytest.c (renamed from src/or/tinytest.c) | 0 | ||||
-rw-r--r-- | src/test/tinytest.h (renamed from src/or/tinytest.h) | 0 | ||||
-rw-r--r-- | src/test/tinytest_demo.c (renamed from src/or/tinytest_demo.c) | 0 | ||||
-rw-r--r-- | src/test/tinytest_macros.h (renamed from src/or/tinytest_macros.h) | 0 |
13 files changed, 50 insertions, 29 deletions
diff --git a/.gitignore b/.gitignore index b7bb31a18e..44e6bd0c47 100644 --- a/.gitignore +++ b/.gitignore @@ -127,7 +127,13 @@ /src/or/or_sha1.i /src/or/micro-revision.* /src/or/tor -/src/or/test +/src/or/libtor.a + +# /src/test +/src/test/Makefile +/src/test/Makefile.in +/src/test/test + # /src/tools/ /src/tools/tor-checkkey diff --git a/Makefile.am b/Makefile.am index 4e049a03a1..c5e985c173 100644 --- a/Makefile.am +++ b/Makefile.am @@ -59,14 +59,15 @@ doxygen: doxygen && cd doc/doxygen/latex && make test: - ./src/or/test + ./src/test/test # Avoid strlcpy.c, strlcat.c, tree.h check-spaces: ./contrib/checkSpace.pl -C \ src/common/*.h \ src/common/[^asO]*.c src/common/address.c \ - src/or/[^et]*.[ch] src/or/t[^i]*.c src/or/eventdns_tor.h + src/or/[^et]*.[ch] src/or/t*.c src/or/eventdns_tor.h \ + src/test/test*.[ch] check-docs: ./contrib/checkOptionDocs.pl diff --git a/configure.in b/configure.in index cf6e8fcb97..10c8396c12 100644 --- a/configure.in +++ b/configure.in @@ -826,7 +826,7 @@ fi CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib" -AC_CONFIG_FILES([Makefile tor.spec Doxyfile contrib/tor.sh contrib/torctl contrib/torify contrib/tor.logrotate contrib/Makefile contrib/osx/Makefile contrib/osx/TorBundleDesc.plist contrib/osx/TorBundleInfo.plist contrib/osx/TorDesc.plist contrib/osx/TorInfo.plist contrib/osx/TorStartupDesc.plist src/config/torrc.sample doc/tor.1 src/Makefile doc/Makefile doc/design-paper/Makefile doc/spec/Makefile src/config/Makefile src/common/Makefile src/or/Makefile src/win32/Makefile src/tools/Makefile contrib/suse/Makefile contrib/suse/tor.sh]) +AC_CONFIG_FILES([Makefile tor.spec Doxyfile contrib/tor.sh contrib/torctl contrib/torify contrib/tor.logrotate contrib/Makefile contrib/osx/Makefile contrib/osx/TorBundleDesc.plist contrib/osx/TorBundleInfo.plist contrib/osx/TorDesc.plist contrib/osx/TorInfo.plist contrib/osx/TorStartupDesc.plist src/config/torrc.sample doc/tor.1 src/Makefile doc/Makefile doc/design-paper/Makefile doc/spec/Makefile src/config/Makefile src/common/Makefile src/or/Makefile src/test/Makefile src/win32/Makefile src/tools/Makefile contrib/suse/Makefile contrib/suse/tor.sh]) AC_OUTPUT if test -x /usr/bin/perl && test -x ./contrib/updateVersions.pl ; then diff --git a/src/Makefile.am b/src/Makefile.am index ae647b2d61..fa2dd560a6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ # leave in dependency order, since common must be built first -SUBDIRS = common or tools win32 config -DIST_SUBDIRS = common or tools win32 config +SUBDIRS = common or test tools win32 config +DIST_SUBDIRS = common or test tools win32 config diff --git a/src/or/Makefile.am b/src/or/Makefile.am index 04a66d061c..097e3e24de 100644 --- a/src/or/Makefile.am +++ b/src/or/Makefile.am @@ -1,8 +1,5 @@ -TESTS = test - -noinst_PROGRAMS = test - bin_PROGRAMS = tor +noinst_LIBRARIES = libtor.a if BUILD_NT_SERVICES tor_platform_source=ntmain.c @@ -18,7 +15,7 @@ else evdns_source=eventdns.c endif -COMMON_SRC = buffers.c circuitbuild.c circuitlist.c \ +libtor_a_SOURCES = buffers.c circuitbuild.c circuitlist.c \ circuituse.c command.c config.c \ connection.c connection_edge.c connection_or.c control.c \ cpuworker.c directory.c dirserv.c dirvote.c \ @@ -28,7 +25,11 @@ COMMON_SRC = buffers.c circuitbuild.c circuitlist.c \ rendservice.c rephist.c router.c routerlist.c routerparse.c \ $(evdns_source) config_codedigest.c -tor_SOURCES = $(COMMON_SRC) tor_main.c +#libtor_a_LIBADD = ../common/libor.a ../common/libor-crypto.a \ +# ../common/libor-event.a + + +tor_SOURCES = tor_main.c AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \ -DLOCALSTATEDIR="\"$(localstatedir)\"" \ @@ -39,21 +40,11 @@ AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \ # matters a lot there, and is quite hard to debug if you forget to do it. tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@ -tor_LDADD = ../common/libor.a ../common/libor-crypto.a \ - ../common/libor-event.a \ - -lz -lm -levent -lssl -lcrypto @TOR_LIB_WS32@ @TOR_LIB_GDI@ -test_SOURCES = $(COMMON_SRC) test_data.c test.c tinytest.c - -test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \ - @TOR_LDFLAGS_libevent@ -test_LDADD = ../common/libor.a ../common/libor-crypto.a \ +tor_LDADD = ./libtor.a ../common/libor.a ../common/libor-crypto.a \ ../common/libor-event.a \ -lz -lm -levent -lssl -lcrypto @TOR_LIB_WS32@ @TOR_LIB_GDI@ -noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i tinytest.h \ - tinytest_macros.h - -EXTRA_DIST = tinytest_demo.c +noinst_HEADERS = or.h eventdns.h eventdns_tor.h micro-revision.i config_codedigest.o: or_sha1.i @@ -74,17 +65,15 @@ micro-revision.i: FORCE mv micro-revision.tmp micro-revision.i; \ fi; true -or_sha1.i: $(tor_SOURCES) test_data.c test.c +or_sha1.i: $(tor_SOURCES) if test "@SHA1SUM@" != none; then \ - @SHA1SUM@ $(tor_SOURCES) test_data.c test.c | @SED@ -n 's/^\(.*\)$$/"\1\\n"/p' > or_sha1.i; \ + @SHA1SUM@ $(tor_SOURCES) | @SED@ -n 's/^\(.*\)$$/"\1\\n"/p' > or_sha1.i; \ elif test "@OPENSSL@" != none; then \ - @OPENSSL@ sha1 $(tor_SOURCES) test_data.c test.c | @SED@ -n 's/SHA1(\(.*\))= \(.*\)/"\2 \1\\n"/p' > or_sha1.i; \ + @OPENSSL@ sha1 $(tor_SOURCES) | @SED@ -n 's/SHA1(\(.*\))= \(.*\)/"\2 \1\\n"/p' > or_sha1.i; \ else \ rm or_sha1.i; \ touch or_sha1.i; \ fi - - #Dummy target to ensure that micro-revision.i _always_ gets built. FORCE: diff --git a/src/test/Makefile.am b/src/test/Makefile.am new file mode 100644 index 0000000000..61b6f53c36 --- /dev/null +++ b/src/test/Makefile.am @@ -0,0 +1,25 @@ +TESTS = test + +noinst_PROGRAMS = test + +AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \ + -DLOCALSTATEDIR="\"$(localstatedir)\"" \ + -DBINDIR="\"$(bindir)\"" + +CFLAGS += -I../or + +# -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 +# matters a lot there, and is quite hard to debug if you forget to do it. + +test_SOURCES = test_data.c test.c tinytest.c + +test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \ + @TOR_LDFLAGS_libevent@ +test_LDADD = ../or/libtor.a ../common/libor.a ../common/libor-crypto.a \ + ../common/libor-event.a \ + -lz -lm -levent -lssl -lcrypto @TOR_LIB_WS32@ @TOR_LIB_GDI@ + +noinst_HEADERS = tinytest.h tinytest_macros.h + +EXTRA_DIST = tinytest_demo.c diff --git a/src/or/test.c b/src/test/test.c index 1af037ef5b..1af037ef5b 100644 --- a/src/or/test.c +++ b/src/test/test.c diff --git a/src/or/test.h b/src/test/test.h index e4bae6d78a..e4bae6d78a 100644 --- a/src/or/test.h +++ b/src/test/test.h diff --git a/src/or/test_data.c b/src/test/test_data.c index bd7d989856..bd7d989856 100644 --- a/src/or/test_data.c +++ b/src/test/test_data.c diff --git a/src/or/tinytest.c b/src/test/tinytest.c index b358bb3a4d..b358bb3a4d 100644 --- a/src/or/tinytest.c +++ b/src/test/tinytest.c diff --git a/src/or/tinytest.h b/src/test/tinytest.h index a0cb913138..a0cb913138 100644 --- a/src/or/tinytest.h +++ b/src/test/tinytest.h diff --git a/src/or/tinytest_demo.c b/src/test/tinytest_demo.c index 0117176eb4..0117176eb4 100644 --- a/src/or/tinytest_demo.c +++ b/src/test/tinytest_demo.c diff --git a/src/or/tinytest_macros.h b/src/test/tinytest_macros.h index 48c1fbdfb8..48c1fbdfb8 100644 --- a/src/or/tinytest_macros.h +++ b/src/test/tinytest_macros.h |