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