]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Move testing code into new src/test directory.
authorNick Mathewson <nickm@torproject.org>
Tue, 22 Sep 2009 16:31:15 +0000 (12:31 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 23 Sep 2009 04:24:43 +0000 (00:24 -0400)
13 files changed:
.gitignore
Makefile.am
configure.in
src/Makefile.am
src/or/Makefile.am
src/test/Makefile.am [new file with mode: 0644]
src/test/test.c [moved from src/or/test.c with 100% similarity]
src/test/test.h [moved from src/or/test.h with 100% similarity]
src/test/test_data.c [moved from src/or/test_data.c with 100% similarity]
src/test/tinytest.c [moved from src/or/tinytest.c with 100% similarity]
src/test/tinytest.h [moved from src/or/tinytest.h with 100% similarity]
src/test/tinytest_demo.c [moved from src/or/tinytest_demo.c with 100% similarity]
src/test/tinytest_macros.h [moved from src/or/tinytest_macros.h with 100% similarity]

index b7bb31a18e25c7302a1dc1775e97c00b5bac3c40..44e6bd0c47d8c58a2795758ac4ff336eb593fea8 100644 (file)
 /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
index 4e049a03a1a2d945122aaffe8fa03f24d8451833..c5e985c173c6c34cab582ea641ed76864f0cad3b 100644 (file)
@@ -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
index cf6e8fcb973a2464641273fdffd704e3d783299b..10c8396c121c25028744390121d8114620af9fd0 100644 (file)
@@ -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
index ae647b2d618a20baa8f456d5cfde5e0878bb735e..fa2dd560a6eaf054632806717d6eda29baacfbd3 100644 (file)
@@ -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
 
index 04a66d061c68f3a5f1ef8ddc4e38b627b4109850..097e3e24de065b18a2662c30d9f11a729bc936af 100644 (file)
@@ -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 (file)
index 0000000..61b6f53
--- /dev/null
@@ -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
similarity index 100%
rename from src/or/test.c
rename to src/test/test.c
similarity index 100%
rename from src/or/test.h
rename to src/test/test.h
similarity index 100%
rename from src/or/test_data.c
rename to src/test/test_data.c
similarity index 100%
rename from src/or/tinytest.c
rename to src/test/tinytest.c
similarity index 100%
rename from src/or/tinytest.h
rename to src/test/tinytest.h