summaryrefslogtreecommitdiff
path: root/test/Makefile.in
blob: d94a02d098a6f3001745bea40b99851e37fbe974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Makefile for neon test suite.

SHELL = @SHELL@
CPPFLAGS = @CPPFLAGS@ -I. -I$(top_srcdir)/src -I$(top_srcdir)/test/common
CFLAGS = @CFLAGS@ @NEON_CFLAGS@
LDFLAGS = @LDFLAGS@
DEFS = @DEFS@

top_builddir = ..
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

AR = ar

RANLIB = @RANLIB@
LIBS = $(LIBTEST)
CC = @CC@
OPENSSL = @OPENSSL@

HELPERS = @HELPERS@ foobar.txt
BASIC_TESTS = uri-tests util-tests string-tests socket \
	session request auth basic stubs redirect
ZLIB_TESTS = compress
ZLIB_HELPERS = file1.gz file2.gz trailing.gz badcsum.gz truncated.gz \
	corrupt1.gz corrupt2.gz empty.gz random.txt
DAV_TESTS = xml xmlreq oldacl acl3744 props lock
SSL_TESTS = socket-ssl ssl
SSL_HELPERS = ca-stamp
TESTS = @TESTS@
VALGRIND = valgrind --tool=memcheck --leak-check=yes --trace-children=no --show-reachable=yes

# Make every object depend on libneon.la to force a rebuild on any src/* changes
OBJDEPS = $(srcdir)/common/tests.h $(srcdir)/common/child.h $(srcdir)/utils.h \
	$(top_builddir)/config.h $(top_builddir)/src/libneon.la
# Test program just depends on libtest
DEPS = $(LIBTEST)

LIBTEST = libtest.la
LIBNEON = $(top_builddir)/src/libneon.la

LIBTOOL = @LIBTOOL@ --silent
TEST_LDFLAGS = @TEST_LDFLAGS@
LINK = $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) $(TEST_LDFLAGS)
COMPILE = $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@

INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL = @INSTALL@

INSTALL_HELPERS = $(HELPERS) server.key makekeys \
	$(srcdir)/openssl.conf $(srcdir)/notvalid.pem \
	$(srcdir)/expired.pem

.SUFFIXES:
.SUFFIXES: .lo .c

# By default, compile but don't run the tests.
all: $(TESTS)

clean:
	rm -f $(TESTS) $(HELPERS) *.*o common/*.*o libtest.*a *.log
	rm -f *.gc* *.da *.bb* common/*.bb* common/*.gc* common/*.da
	rm -rf ca ca2 .libs nssdb*
	rm -f ca-stamp client.key *.csr ssigned.pem wrongcn.pem \
	   server.cert client.cert *.p12 *.cert sparse.bin

check: $(TESTS) $(HELPERS)
	@SRCDIR=$(srcdir) $(SHELL) $(srcdir)/run.sh $(TESTS)

grind: $(TESTS) $(HELPERS)
	@SRCDIR=$(srcdir) HARNESS="$(VALGRIND)" $(SHELL) $(srcdir)/run.sh $(TESTS)

lfs-check: largefile $(LFS_HELPERS)
	@SRCDIR=$(srcdir) $(SHELL) $(srcdir)/run.sh largefile

install: $(TESTS) $(HELPERS)
	@$(INSTALL) -d $(DESTDIR)$(libdir)/neon-tests
	@$(INSTALL) -d $(DESTDIR)$(libdir)/neon-tests/bin
	@$(INSTALL) -d $(DESTDIR)$(libdir)/neon-tests/data
	@for t in $(TESTS); do \
	 $(LIBTOOL) --mode=install \
	      $(INSTALL_PROGRAM) $$t $(DESTDIR)$(libdir)/neon-tests/bin; \
	done
	@for h in $(INSTALL_HELPERS); do \
	 $(INSTALL_DATA) $$h $(DESTDIR)$(libdir)/neon-tests/data; \
	done
	@$(INSTALL_PROGRAM) $(srcdir)/run-tests.sh $(DESTDIR)$(libdir)/neon-tests

NEWS = $(top_srcdir)/NEWS

file1.gz: $(NEWS)
	gzip -c --no-name $(NEWS) > $@

file2.gz: $(NEWS)
	gzip -c --name $(NEWS) > $@

# gzip file with trailing bytes.
trailing.gz: $(NEWS)
	gzip -c --no-name $(NEWS) > $@
	echo "hello, world" >> $@

truncated.gz: file1.gz
	dd if=file1.gz of=$@ bs=2048 count=2

badcsum.gz: file1.gz
	dd of=$@ if=file1.gz bs=1 count=`perl -e 'printf "%d", (stat("file1.gz"))[7] - 8;'`
	echo 'broken!' >> $@

corrupt1.gz: file1.gz
	dd of=$@ if=file1.gz bs=1 count=500
	cat $(NEWS) >> $@

corrupt2.gz: $(NEWS)
	cat $(NEWS) > $@

empty.gz:
	touch $@

random.txt: $(NEWS)
	cat $(NEWS) > $@

foobar.txt:
	echo foobar > $@

# Dummy target to create the CA keys etc.  makekeys stderr is redirected
# since it changes for every invocation; not helpful for regression
# testing.
ca-stamp: makekeys $(srcdir)/openssl.conf
	rm -rf ca ca2
	OPENSSL=$(OPENSSL) \
	 $(SHELL) makekeys $(srcdir) 2>makekeys.out
	@echo timestamp > ca-stamp

Makefile: $(srcdir)/Makefile.in
	cd .. && ./config.status test/Makefile

makekeys: $(srcdir)/makekeys.sh
	cd .. && ./config.status test/makekeys

LIBOBJS = common/tests.lo common/child.lo utils.lo util-socks.lo

$(LIBTEST): $(LIBOBJS)
	$(LINK) -o $(LIBTEST) $(LIBOBJS) $(LIBNEON)

.c.lo:
	$(COMPILE) -c $< -o $@

# Recompile socket.c with SOCKET_SSL defined
socket-ssl.lo: $(srcdir)/socket.c $(HDRS)
	$(COMPILE) -DSOCKET_SSL -c $(srcdir)/socket.c -o $@

socket-ssl: socket-ssl.lo $(LIBTEST)
	$(LINK) -o $@ socket-ssl.lo $(LIBS)

resolve: resolve.lo $(LIBNEON)
	$(LINK) -o $@ resolve.lo $(LIBNEON)

common/tests.lo: $(srcdir)/common/tests.c $(OBJDEPS)
common/child.lo: $(srcdir)/common/child.c $(OBJDEPS) 
utils.lo: $(srcdir)/utils.c $(OBJDEPS)
util-socks.lo: $(srcdir)/util-socks.c $(OBJDEPS)
auth.lo: $(srcdir)/auth.c $(OBJDEPS)
uri-tests.lo: $(srcdir)/uri-tests.c $(OBJDEPS)
util-tests.lo: $(srcdir)/util-tests.c $(OBJDEPS)
string-tests.lo: $(srcdir)/string-tests.c $(OBJDEPS)
socket.lo: $(srcdir)/socket.c $(OBJDEPS)
server.lo: $(srcdir)/server.c $(OBJDEPS)
request.lo: $(srcdir)/request.c $(OBJDEPS)
regress.lo: $(srcdir)/regress.c $(OBJDEPS)
compress.lo: $(srcdir)/compress.c $(OBJDEPS)
oldacl.lo: $(srcdir)/oldacl.c $(OBJDEPS)
acl3744.lo: $(srcdir)/acl3744.c $(OBJDEPS)
utils.lo: $(srcdir)/utils.c $(OBJDEPS)
stubs.lo: $(srcdir)/stubs.c $(OBJDEPS)
props.lo: $(srcdir)/props.c $(OBJDEPS)
session.lo: $(srcdir)/session.c $(OBJDEPS)
redirect.lo: $(srcdir)/redirect.c $(OBJDEPS)
basic.lo: $(srcdir)/basic.c $(OBJDEPS)
ssl.lo: $(srcdir)/ssl.c $(OBJDEPS)
lock.lo: $(srcdir)/lock.c $(OBJDEPS)
largefile.lo: $(srcdir)/largefile.c $(OBJDEPS)

auth: auth.lo $(DEPS)
	$(LINK) -o $@ auth.lo $(DEPS)
basic: basic.lo $(DEPS)
	$(LINK) -o $@ basic.lo $(DEPS)
uri-tests: uri-tests.lo $(DEPS)
	$(LINK) -o $@ uri-tests.lo $(DEPS)
util-tests: util-tests.lo $(DEPS)
	$(LINK) -o $@ util-tests.lo $(DEPS)
string-tests: string-tests.lo $(DEPS)
	$(LINK) -o $@ string-tests.lo $(DEPS)
socket: socket.lo $(DEPS)
	$(LINK) -o $@ socket.lo $(DEPS)
server: server.lo $(DEPS)
	$(LINK) -o $@ server.lo $(DEPS)
request: request.lo $(DEPS)
	$(LINK) -o $@ request.lo $(DEPS)
regress: regress.lo $(DEPS)
	$(LINK) -o $@ regress.lo $(DEPS)
compress: compress.lo $(DEPS)
	$(LINK) -o $@ compress.lo $(DEPS)
oldacl: oldacl.lo $(DEPS)
	$(LINK) -o $@ oldacl.lo $(DEPS)
acl3744: acl3744.lo $(DEPS)
	$(LINK) -o $@ acl3744.lo $(DEPS)
utils: utils.lo $(DEPS)
	$(LINK) -o $@ utils.lo $(DEPS)
stubs: stubs.lo $(DEPS)
	$(LINK) -o $@ stubs.lo $(DEPS)
props: props.lo $(DEPS)
	$(LINK) -o $@ props.lo $(DEPS)
session: session.lo $(DEPS)
	$(LINK) -o $@ session.lo $(DEPS)
redirect: redirect.lo $(DEPS)
	$(LINK) -o $@ redirect.lo $(DEPS)
ssl: ssl.lo $(DEPS)
	$(LINK) -o $@ ssl.lo $(DEPS)
xml: xml.lo $(DEPS)
	$(LINK) -o $@ xml.lo $(DEPS)
xmlreq: xmlreq.lo $(DEPS)
	$(LINK) -o $@ xmlreq.lo $(DEPS)
lock: lock.lo $(DEPS)
	$(LINK) -o $@ lock.lo $(DEPS)
largefile: largefile.lo $(DEPS)
	$(LINK) -o $@ largefile.lo $(DEPS)