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 .PHONY: all data clean regres
9 all: data puny-test iri_test fcgi-test
10 ./regress ${TESTS}
12 data: testdata cert.pem testca.pem valid.crt invalid.cert.pem
14 puny-test: puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT}
15 ${CC} puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT} \
16 -o puny-test ${LDFLAGS}
18 iri_test: iri_test.o ../iri.o ../utf8.o ${COMPAT}
19 ${CC} iri_test.o ../iri.o ../utf8.o ${COMPAT} -o $@ ${LDFLAGS}
21 fill-file: fill-file.o
22 ${CC} fill-file.o -o $@ ${LDFLAGS}
24 fcgi-test: fcgi-test.o
25 ${CC} fcgi-test.o ${COMPAT} -o fcgi-test ${LDFLAGS}
27 key.pem: cert.pem
29 # XXX: key size is NOT GOOD. This is only for testing. Smaller keys
30 # are quicker to generate. DON'T DO THIS AT HOME.
31 cert.pem:
32 openssl req -x509 -newkey rsa:2048 \
33 -keyout key.pem \
34 -out cert.pem \
35 -days 365 -nodes \
36 -subj "/CN=localhost"
37 ln -s cert.pem localhost.cert.pem
38 ln -s key.pem localhost.key.pem
39 @echo
41 testca.pem:
42 openssl genrsa -out testca.key 2048
43 openssl req -x509 -new -sha256 \
44 -key testca.key \
45 -days 365 -nodes \
46 -out testca.pem \
47 -subj "/CN=testca"
48 @echo
50 valid.crt: testca.pem
51 openssl genrsa -out valid.key 2048
52 openssl req -new -key valid.key \
53 -out valid.csr \
54 -subj "/CN=valid"
55 @echo
56 openssl x509 -req -in valid.csr \
57 -CA testca.pem \
58 -CAkey testca.key \
59 -CAcreateserial \
60 -out valid.crt \
61 -days 365 \
62 -sha256 -extfile valid.ext
64 invalid.cert.pem: cert.pem
65 cp cert.pem invalid.cert.pem
66 cp key.pem invalid.key.pem
68 clean:
69 rm -f *.o iri_test cert.pem key.pem
70 rm -f localhost.cert.pem localhost.key.pem
71 rm -f testca.* valid.csr valid.key valid.crt invalid.*pem
72 rm -rf testdata fill-file puny-test fcgi-test
73 rm -f gmid.pid
75 testdata: fill-file
76 mkdir testdata
77 ./fill-file testdata/bigfile
78 ./sha testdata/bigfile testdata/bigfile.sha
79 printf "# hello world\n" > testdata/index.gmi
80 ./sha testdata/index.gmi testdata/index.gmi.sha
81 cp hello slow err invalid serve-bigfile env testdata/
82 cp max-length-reply testdata
83 mkdir testdata/dir
84 cp hello testdata/dir
85 cp testdata/index.gmi testdata/dir/foo.gmi