aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-09-22 12:31:15 -0400
committerNick Mathewson <nickm@torproject.org>2009-09-23 00:24:43 -0400
commitda1aa66f70f3ed1e5376baef053a0c76f33cc7d8 (patch)
tree3f73a0bda1b38ca705cc6f73fa49b756e472fbb8 /src
parentd4b54549b83bbbfeb9c1d7d843ea244eed389c61 (diff)
downloadtor-da1aa66f70f3ed1e5376baef053a0c76f33cc7d8.tar
tor-da1aa66f70f3ed1e5376baef053a0c76f33cc7d8.tar.gz
Move testing code into new src/test directory.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/or/Makefile.am35
-rw-r--r--src/test/Makefile.am25
-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
10 files changed, 39 insertions, 25 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index ae647b2d6..fa2dd560a 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 04a66d061..097e3e24d 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 000000000..61b6f53c3
--- /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 1af037ef5..1af037ef5 100644
--- a/src/or/test.c
+++ b/src/test/test.c
diff --git a/src/or/test.h b/src/test/test.h
index e4bae6d78..e4bae6d78 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 bd7d98985..bd7d98985 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 b358bb3a4..b358bb3a4 100644
--- a/src/or/tinytest.c
+++ b/src/test/tinytest.c
diff --git a/src/or/tinytest.h b/src/test/tinytest.h
index a0cb91313..a0cb91313 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 0117176eb..0117176eb 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 48c1fbdfb..48c1fbdfb 100644
--- a/src/or/tinytest_macros.h
+++ b/src/test/tinytest_macros.h