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