Blob


1 # tests to run as a port of the regression suite. Leave empty to run
2 # all.
3 TESTS=
5 include ../Makefile.local
7 COMPAT= ${COBJS:%=../%}
9 .PHONY: all data clean regress
11 all: data puny-test iri_test fcgi-test
12 ./regress ${TESTS}
14 data: testdata cert.pem testca.pem valid.crt invalid.cert.pem
16 puny-test: puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT}
17 ${CC} puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT} \
18 -o puny-test ${LDFLAGS}
20 iri_test: iri_test.o ../iri.o ../utf8.o ${COMPAT}
21 ${CC} iri_test.o ../iri.o ../utf8.o ${COMPAT} -o $@ ${LDFLAGS}
23 fill-file: fill-file.o
24 ${CC} fill-file.o -o $@ ${LDFLAGS}
26 fcgi-test: fcgi-test.o
27 ${CC} fcgi-test.o ${COMPAT} -o fcgi-test ${LDFLAGS}
29 key.pem: cert.pem
31 # XXX: key size is NOT GOOD. This is only for testing. Smaller keys
32 # are quicker to generate. DON'T DO THIS AT HOME.
33 cert.pem:
34 openssl req -x509 -newkey rsa:2048 \
35 -keyout key.pem \
36 -out cert.pem \
37 -days 365 -nodes \
38 -subj "/CN=localhost"
39 ln -s cert.pem localhost.cert.pem
40 ln -s key.pem localhost.key.pem
41 @echo
43 testca.pem:
44 openssl genrsa -out testca.key 2048
45 openssl req -x509 -new -sha256 \
46 -key testca.key \
47 -days 365 -nodes \
48 -out testca.pem \
49 -subj "/CN=testca"
50 @echo
52 valid.crt: testca.pem
53 openssl genrsa -out valid.key 2048
54 openssl req -new -key valid.key \
55 -out valid.csr \
56 -subj "/CN=valid"
57 @echo
58 openssl x509 -req -in valid.csr \
59 -CA testca.pem \
60 -CAkey testca.key \
61 -CAcreateserial \
62 -out valid.crt \
63 -days 365 \
64 -sha256 -extfile valid.ext
66 invalid.cert.pem: cert.pem
67 cp cert.pem invalid.cert.pem
68 cp key.pem invalid.key.pem
70 clean:
71 rm -f *.o iri_test cert.pem key.pem
72 rm -f localhost.cert.pem localhost.key.pem
73 rm -f testca.* valid.csr valid.key valid.crt invalid.*pem
74 rm -rf testdata fill-file puny-test fcgi-test
75 rm -f gmid.pid
77 testdata: fill-file
78 mkdir testdata
79 ./fill-file testdata/bigfile
80 ./sha testdata/bigfile testdata/bigfile.sha
81 printf "# hello world\n" > testdata/index.gmi
82 ./sha testdata/index.gmi testdata/index.gmi.sha
83 cp hello slow err invalid serve-bigfile env testdata/
84 cp max-length-reply testdata
85 mkdir testdata/dir
86 date > 'testdata/dir/current date'
87 cp hello testdata/dir
88 cp testdata/index.gmi testdata/dir/foo.gmi
89 touch testdata/test.m3u8 testdata/foo.1