Blob


1 include ../Makefile.local
3 .PHONY: all data clean runtime
5 all: data gg puny-test fcgi-test
6 ./puny-test
7 ./iri_test
8 ./runtime
10 data: testdata iri_test cert.pem testca.pem valid.crt invalid.cert.pem
12 gg: gg.o ../iri.o ../utf8.o ${COMPAT}
13 ${CC} gg.o ../iri.o ../utf8.o ${COMPAT} -o $@ ${LDFLAGS}
15 puny-test: puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT}
16 ${CC} puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT} \
17 -o puny-test ${LDFLAGS}
19 iri_test: iri_test.o ../iri.o ../utf8.o ${COMPAT}
20 ${CC} iri_test.o ../iri.o ../utf8.o ${COMPAT} -o iri_test
22 fill-file: fill-file.o
23 ${CC} fill-file.o -o fill-file
25 fcgi-test: fcgi-test.o
26 ${CC} fcgi-test.o ${COMPAT} -o fcgi-test ${LDFLAGS}
28 key.pem: cert.pem
30 # XXX: key size is NOT GOOD. This is only for testing. Smaller keys
31 # are quicker to generate. DON'T DO THIS AT HOME.
32 cert.pem:
33 printf ".\n.\n.\n.\n.\nlocalhost\n.\n" | \
34 openssl req -x509 -newkey rsa:2048 \
35 -keyout key.pem \
36 -out cert.pem \
37 -days 365 -nodes
38 @echo
40 testca.pem:
41 openssl genrsa -out testca.key 2048
42 printf ".\n.\n.\n.\n.\ntestca\n.\n" | \
43 openssl req -x509 -new -sha256 \
44 -key testca.key \
45 -days 365 -nodes \
46 -out testca.pem
47 @echo
49 valid.crt: testca.pem
50 openssl genrsa -out valid.key 2048
51 printf ".\n.\n.\n.\n.\nvalid\n.\n\n\n"| \
52 openssl req -new -key valid.key \
53 -out valid.csr
54 @echo
55 openssl x509 -req -in valid.csr \
56 -CA testca.pem \
57 -CAkey testca.key \
58 -CAcreateserial \
59 -out valid.crt \
60 -days 365 \
61 -sha256 -extfile valid.ext
63 invalid.cert.pem: cert.pem
64 cp cert.pem invalid.cert.pem
65 cp key.pem invalid.key.pem
67 clean:
68 rm -f *.o iri_test cert.pem key.pem
69 rm -f testca.* valid.csr valid.key invalid.*pem
70 rm -rf testdata fill-file puny-test gg
72 testdata: fill-file
73 mkdir testdata
74 ./fill-file testdata/bigfile
75 ./sha testdata/bigfile testdata/bigfile.sha
76 printf "# hello world\n" > testdata/index.gmi
77 ./sha testdata/index.gmi testdata/index.gmi.sha
78 cp hello slow err invalid serve-bigfile env testdata/
79 cp max-length-reply testdata
80 mkdir testdata/dir
81 cp hello testdata/dir
82 cp testdata/index.gmi testdata/dir/foo.gmi
84 runtime: testdata
85 ./runtime