From 31a4993a9478d17776d45ab9041001a4ced37c17 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Sat, 23 Jan 2021 17:10:00 +0000 Subject: [PATCH] use gg instead of gg.py for the regression suite --- Makefile | 4 ++-- README.md | 2 +- regress/runtime | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b2626f5..b2f7bb9 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 55c4229..6825fce 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ then you can build `gmid` with ### Testing -The regression suite requires python3 at the moment. Execute +Execute make regress diff --git a/regress/runtime b/regress/runtime index edfcf74..53a016c 100755 --- a/regress/runtime +++ b/regress/runtime @@ -26,19 +26,28 @@ checkconf() { # usage: get # return the body of the request on stdout get() { - (./gg.py "$1" 10965 | sed 1d) || true + ./../gg -b "gemini://localhost:10965/$1" } # usage: head # return the meta response line on stdout head() { - (./gg.py "$1" 10965 | sed 1q) || true + ./../gg -h "gemini://localhost:10965/$1" +} + +# usage: raw +# 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"