diff options
author | Omar Polo <op@omarpolo.com> | 2023-07-24 08:51:35 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-07-24 08:51:35 +0000 |
commit | 60b4efa1e2df8b5465deaec5c5493e1b2bf6a6c4 (patch) | |
tree | 9cc1d6a408ccbb807afa26987e8ba35f6985efb6 /regress | |
parent | 226f13ece0b309abeee0ae8a4d8c9f049fe896a7 (diff) |
add a test for the file logging
Diffstat (limited to 'regress')
-rwxr-xr-x | regress/regress | 1 | ||||
-rw-r--r-- | regress/tests.sh | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/regress/regress b/regress/regress index 5854c91..dd019e4 100755 --- a/regress/regress +++ b/regress/regress @@ -58,6 +58,7 @@ run_test test_proxy_relay_to run_test test_proxy_with_certs # run_test test_unknown_host # XXX: breaks on some distro run_test test_include_mime +run_test test_log_file # TODO: add test that uses only a TLSv1.2 or TLSv1.3 # TODO: add a test that attempt to serve a non-regular file diff --git a/regress/tests.sh b/regress/tests.sh index 9aa083a..9020103 100644 --- a/regress/tests.sh +++ b/regress/tests.sh @@ -377,3 +377,23 @@ test_include_mime() { fetch_hdr /foo.1 check_reply '20 text/x-mandoc' || return 1 } + +test_log_file() { + rm -f log log.edited + setup_simple_test 'log access "'$PWD'/log"' '' + + fetch_hdr / + check_reply '20 text/gemini' + + # remove the <ip>:<port> leading part + awk '{$1 = ""; print substr($0, 2)}' log > log.edited + + echo GET gemini://localhost/ 20 text/gemini | cmp -s - log.edited + if [ $? -ne 0 ]; then + # keep the log for post-mortem analysis + return 1 + fi + + rm -f log log.edited + return 0 +} |