2021-10-07 10:55:44 +02:00
|
|
|
# tests to run as a port of the regression suite. Leave empty to run
|
|
|
|
# all.
|
|
|
|
TESTS=
|
|
|
|
|
2021-01-22 17:48:04 +01:00
|
|
|
include ../Makefile.local
|
|
|
|
|
2022-02-03 11:08:30 +01:00
|
|
|
.PHONY: all data clean regress
|
2021-01-22 17:48:04 +01:00
|
|
|
|
2021-12-29 19:18:41 +01:00
|
|
|
all: data puny-test iri_test fcgi-test
|
2021-12-09 20:06:38 +01:00
|
|
|
./regress ${TESTS}
|
2021-06-12 15:47:01 +02:00
|
|
|
|
2021-12-09 20:02:09 +01:00
|
|
|
data: testdata cert.pem testca.pem valid.crt invalid.cert.pem
|
2021-01-22 17:48:04 +01:00
|
|
|
|
2021-02-10 23:06:16 +01:00
|
|
|
puny-test: puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT}
|
|
|
|
${CC} puny-test.o ../puny.o ../utf8.o ../utils.o ../log.o ${COMPAT} \
|
|
|
|
-o puny-test ${LDFLAGS}
|
2021-01-27 11:47:49 +01:00
|
|
|
|
2021-02-10 23:06:16 +01:00
|
|
|
iri_test: iri_test.o ../iri.o ../utf8.o ${COMPAT}
|
2021-07-08 16:05:04 +02:00
|
|
|
${CC} iri_test.o ../iri.o ../utf8.o ${COMPAT} -o $@ ${LDFLAGS}
|
2021-01-22 17:48:04 +01:00
|
|
|
|
2021-01-22 18:18:55 +01:00
|
|
|
fill-file: fill-file.o
|
2021-07-08 16:05:04 +02:00
|
|
|
${CC} fill-file.o -o $@ ${LDFLAGS}
|
2021-01-22 18:18:55 +01:00
|
|
|
|
2021-06-12 15:47:01 +02:00
|
|
|
fcgi-test: fcgi-test.o
|
|
|
|
${CC} fcgi-test.o ${COMPAT} -o fcgi-test ${LDFLAGS}
|
|
|
|
|
2021-01-22 17:48:04 +01:00
|
|
|
key.pem: cert.pem
|
|
|
|
|
|
|
|
# XXX: key size is NOT GOOD. This is only for testing. Smaller keys
|
|
|
|
# are quicker to generate. DON'T DO THIS AT HOME.
|
|
|
|
cert.pem:
|
2021-07-03 10:13:42 +02:00
|
|
|
openssl req -x509 -newkey rsa:2048 \
|
|
|
|
-keyout key.pem \
|
|
|
|
-out cert.pem \
|
|
|
|
-days 365 -nodes \
|
|
|
|
-subj "/CN=localhost"
|
2021-07-19 13:37:01 +02:00
|
|
|
ln -s cert.pem localhost.cert.pem
|
|
|
|
ln -s key.pem localhost.key.pem
|
2021-01-22 17:48:04 +01:00
|
|
|
@echo
|
|
|
|
|
2021-02-09 23:30:04 +01:00
|
|
|
testca.pem:
|
|
|
|
openssl genrsa -out testca.key 2048
|
2021-07-03 10:13:42 +02:00
|
|
|
openssl req -x509 -new -sha256 \
|
|
|
|
-key testca.key \
|
|
|
|
-days 365 -nodes \
|
|
|
|
-out testca.pem \
|
|
|
|
-subj "/CN=testca"
|
2021-02-09 23:30:04 +01:00
|
|
|
@echo
|
|
|
|
|
|
|
|
valid.crt: testca.pem
|
|
|
|
openssl genrsa -out valid.key 2048
|
2021-07-03 10:13:42 +02:00
|
|
|
openssl req -new -key valid.key \
|
|
|
|
-out valid.csr \
|
|
|
|
-subj "/CN=valid"
|
2021-02-09 23:30:04 +01:00
|
|
|
@echo
|
|
|
|
openssl x509 -req -in valid.csr \
|
|
|
|
-CA testca.pem \
|
|
|
|
-CAkey testca.key \
|
|
|
|
-CAcreateserial \
|
|
|
|
-out valid.crt \
|
|
|
|
-days 365 \
|
|
|
|
-sha256 -extfile valid.ext
|
|
|
|
|
|
|
|
invalid.cert.pem: cert.pem
|
|
|
|
cp cert.pem invalid.cert.pem
|
|
|
|
cp key.pem invalid.key.pem
|
|
|
|
|
2021-01-22 17:48:04 +01:00
|
|
|
clean:
|
|
|
|
rm -f *.o iri_test cert.pem key.pem
|
2021-07-19 13:37:01 +02:00
|
|
|
rm -f localhost.cert.pem localhost.key.pem
|
2021-10-02 21:35:30 +02:00
|
|
|
rm -f testca.* valid.csr valid.key valid.crt invalid.*pem
|
2021-12-29 19:18:41 +01:00
|
|
|
rm -rf testdata fill-file puny-test fcgi-test
|
2021-10-04 11:04:33 +02:00
|
|
|
rm -f gmid.pid
|
2021-01-22 17:48:04 +01:00
|
|
|
|
2021-01-22 18:18:55 +01:00
|
|
|
testdata: fill-file
|
2021-01-22 17:48:04 +01:00
|
|
|
mkdir testdata
|
2021-01-22 18:18:55 +01:00
|
|
|
./fill-file testdata/bigfile
|
2021-01-22 17:48:04 +01:00
|
|
|
./sha testdata/bigfile testdata/bigfile.sha
|
|
|
|
printf "# hello world\n" > testdata/index.gmi
|
|
|
|
./sha testdata/index.gmi testdata/index.gmi.sha
|
2021-02-06 19:28:43 +01:00
|
|
|
cp hello slow err invalid serve-bigfile env testdata/
|
2021-03-29 11:42:06 +02:00
|
|
|
cp max-length-reply testdata
|
2021-01-22 17:48:04 +01:00
|
|
|
mkdir testdata/dir
|
2021-01-24 15:11:40 +01:00
|
|
|
cp hello testdata/dir
|
2021-01-22 17:48:04 +01:00
|
|
|
cp testdata/index.gmi testdata/dir/foo.gmi
|
2022-02-26 15:02:45 +01:00
|
|
|
touch testdata/test.m3u8 testdata/foo.1
|