Blob


1 # tests to run as a port of the regression suite. Leave empty to run
2 # all.
3 TESTS=
5 GENCERT_FLAGS=
7 # host to bind to during regress
8 REGRESS_HOST = localhost
10 DISTFILES = Makefile \
11 env \
12 err \
13 example.mime.types \
14 fcgi-test.c \
15 fill-file.c \
16 hello \
17 invalid \
18 iri_test.c \
19 lib.sh \
20 max-length-reply \
21 puny-test.c \
22 regress \
23 serve-bigfile \
24 slow \
25 tests.sh \
26 valid.ext
28 include ../config.mk
30 COBJS = ${COMPATS:.c=.o}
31 REG_COMPATS = ${COBJS:%=../%}
33 PUNY_SRCS = puny-test.c ../puny.c ../utf8.c ../utils.c ../log.c
34 PUNY_OBJS = ${PUNY_SRCS:.c=.o} ${REG_COMPATS}
36 IRI_SRCS = iri_test.c ../iri.c ../utf8.c ../log.c
37 IRI_OBJS = ${IRI_SRCS:.c=.o} ${REG_COMPATS}
39 .PHONY: all data clean dist
41 all: data puny-test iri_test fcgi-test
42 env REGRESS_HOST="${REGRESS_HOST}" ./regress ${TESTS}
44 data: testdata localhost.pem testca.pem valid.crt invalid.pem
46 puny-test: ${PUNY_OBJS}
47 ${CC} ${PUNY_OBJS} -o puny-test ${LIBS} ${LDFLAGS}
49 iri_test: ${IRI_OBJS}
50 ${CC} ${IRI_OBJS} -o $@ ${LIBS} ${LDFLAGS}
52 fill-file: fill-file.o
53 ${CC} fill-file.o -o $@ ${LIBS} ${LDFLAGS}
55 fcgi-test: fcgi-test.o
56 ${CC} fcgi-test.o ../log.o ${REG_COMPATS} -o fcgi-test ${LIBS} ${LDFLAGS}
58 localhost.key: localhost.pem
60 localhost.pem:
61 ./../contrib/gencert ${GENCERT_FLAGS} localhost >/dev/null
63 testca.pem:
64 openssl genrsa -out testca.key 2048
65 openssl req -x509 -new -sha256 \
66 -key testca.key \
67 -days 365 -nodes \
68 -out testca.pem \
69 -subj "/CN=testca"
70 @echo
72 valid.crt: testca.pem
73 openssl genrsa -out valid.key 2048
74 openssl req -new -key valid.key \
75 -out valid.csr \
76 -subj "/CN=valid"
77 @echo
78 openssl x509 -req -in valid.csr \
79 -CA testca.pem \
80 -CAkey testca.key \
81 -CAcreateserial \
82 -out valid.crt \
83 -days 365 \
84 -sha256 -extfile valid.ext
86 invalid.pem: localhost.pem
87 cp localhost.pem invalid.pem
88 cp localhost.key invalid.key
90 clean:
91 rm -f *.o iri_test localhost.pem localhost.key
92 rm -f localhost.pem localhost.key
93 rm -f testca.* valid.csr valid.key valid.crt invalid.pem invalid.key
94 rm -rf testdata fill-file puny-test fcgi-test
95 rm -f gmid.pid fcgi.sock
97 testdata: fill-file
98 mkdir testdata
99 ./fill-file testdata/bigfile
100 printf "# hello world\n" > testdata/index.gmi
101 cp hello slow err invalid serve-bigfile env testdata/
102 cp max-length-reply testdata
103 mkdir testdata/dir
104 date > 'testdata/dir/current date'
105 cp hello testdata/dir
106 cp testdata/index.gmi testdata/dir/foo.gmi
107 touch testdata/test.m3u8 testdata/foo.1
109 dist: ${DISTFILES}
110 mkdir -p ${DESTDIR}/
111 ${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/
112 cd ${DESTDIR}/ && chmod +x env err hello invalid \
113 max-length-reply regress slow