use gg instead of gg.py for the regression suite

This commit is contained in:
Omar Polo 2021-01-23 17:10:00 +00:00
parent d760973a5b
commit 31a4993a94
3 changed files with 15 additions and 7 deletions

View File

@ -32,13 +32,13 @@ TAGS: ${SRCS}
-etags ${SRCS} || true
clean:
rm -f *.o lex.yy.c y.tab.c y.tab.h y.output gmid
rm -f *.o lex.yy.c y.tab.c y.tab.h y.output gmid gg
make -C regress clean
iri_test: iri_test.o iri.o utf8.o
${CC} iri_test.o iri.o utf8.o -o iri_test ${LDFLAGS}
regress: gmid
regress: gmid gg
make -C regress all
test: gmid iri_test

View File

@ -80,7 +80,7 @@ then you can build `gmid` with
### Testing
The regression suite requires python3 at the moment. Execute
Execute
make regress

View File

@ -26,19 +26,28 @@ checkconf() {
# usage: get <path>
# return the body of the request on stdout
get() {
(./gg.py "$1" 10965 | sed 1d) || true
./../gg -b "gemini://localhost:10965/$1"
}
# usage: head <path>
# return the meta response line on stdout
head() {
(./gg.py "$1" 10965 | sed 1q) || true
./../gg -h "gemini://localhost:10965/$1"
}
# usage: raw <path>
# return both header and body
raw() {
./../gg "gemini://localhost:10965/$1"
}
run() {
# filter out logs for GET requests
(./../gmid -c reg.conf 2>&1 | grep -v GET) >&2 &
pid=$!
# give gmid time to bind the port, otherwise we end up
# executing gg when gmid isn't ready yet.
sleep 1
}
# usage: check [exit-message]
@ -159,8 +168,7 @@ eq "$(head /err)" "" "Unexpected head for /err"
eq "$(get /err)" "" "Unexpected body for /err"
echo OK GET /err with cgi
eq "$(head /invalid | wc -c | xargs)" 2049 "Unexpected body for /invalid"
eq "$(get /invalid)" "" "Unexpected body for /invalid"
eq "$(raw /invalid | wc -c | xargs)" 2049 "Unexpected body for /invalid"
echo OK GET /invalid with cgi
check "should be running"