commit afc025ff600c11e5cbe8794b944b560492290cce from: Omar Polo date: Sat Feb 06 17:35:48 2021 UTC restart the daemon instead of kill+start this way we can also test the reload capability! commit - cd761624942ce5bd06fcf939400ed41b8166d37d commit + afc025ff600c11e5cbe8794b944b560492290cce blob - 96ac135f8e0e6ce4dcfe4e9df6f56c859e6f4447 blob + 4d53f1ccd29af150e22849189b82db6dd54b3649 --- regress/runtime +++ regress/runtime @@ -58,6 +58,11 @@ check() { fi } +restart() { + pkill -SIGHUP gmid + sleep 1 +} + # quit gmid quit() { pkill gmid || true @@ -123,12 +128,11 @@ eq "$(head /hello)" "20 application/octet-stream" "Une echo OK GET /hello check "should be running" -quit # try with custom mime config 'mime "text/x-funny-text" "gmi"' 'default type "application/x-trash"' checkconf -run +restart eq "$(head /)" "20 text/x-funny-text" "Unexpected head for /" echo OK GET / with custom mime @@ -137,23 +141,21 @@ eq "$(head /hello)" "20 application/x-trash" "Unexpect echo OK GET /hello with custom mime check "should be running" -quit # try with custom lang config '' 'lang "it"' checkconf -run +restart eq "$(head /)" "20 text/gemini; lang=it" "Unexpected head for /" echo OK GET / with custom lang check "should be running" -quit # finally try with CGI scripts config '' 'cgi "*"' checkconf -run +restart eq "$(head /hello)" "20 text/gemini" "Unexpected head for /hello" eq "$(get /hello)" "# hello world$ln" "Unexpected body for /hello" @@ -178,22 +180,20 @@ eq "$(cat bigfile.sha)" "$(cat testdata/bigfile.sha)" echo OK GET /serve-bigfile with cgi check "should be running" -quit config '' 'index "foo.gmi"' checkconf -run +restart eq "$(head /dir/)" "20 text/gemini" "Unexpected head for /" eq "$(get /dir/)" "# hello world$ln" "Unexpected body for error" echo OK GET /dir/ with custom index check "should be running" -quit config '' 'location "/dir/" { default type "text/plain" index "hello" }' checkconf -run +restart eq "$(head /dir/hello)" "20 text/plain" "Unexpected head for /" echo OK GET /dir/hello with location and default type @@ -203,11 +203,10 @@ eq "$(get /dir/|tail -1)" 'echo "# hello world"' "Une echo OK GET /dir/ with location and custom index check "should be running" -quit config '' 'location "/dir/" { auto index on }' checkconf -run +restart eq "$(head /)" "20 text/gemini" "Unexpected head for /" eq "$(get /)" "# hello world$ln" "Unexpected body for /" @@ -219,13 +218,12 @@ eq "$(get /dir/|wc -l|xargs)" "5" "Unexpected body f echo OK GET /dir/ with auto index on check "should be running" -quit # test block return and strip config '' 'location "*" { block }' checkconf -run +restart eq "$(head /)" "40 temporary failure" "Unexpected head for /" eq "$(get /)" "" "Unexpected body for /" @@ -236,7 +234,6 @@ eq "$(get /nonexists)" "" "Unexpected body for /non echo OK GET /nonexists with block check "should be running" -quit config '' ' location "/dir" { @@ -248,7 +245,7 @@ location "*" { block return 40 "%% %p %q %P %N test" }' checkconf -run +restart eq "$(head /dir/foo.gmi)" "40 % /foo.gmi 10965 localhost test" echo OK GET /dir/foo.gmi with strip and block @@ -257,4 +254,5 @@ eq "$(head /bigfile)" "40 % 10965 localhost test" echo OK GET /bigfile with strip and block check "should be running" + quit