aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xregress/regress2
-rw-r--r--regress/tests.sh46
2 files changed, 48 insertions, 0 deletions
diff --git a/regress/regress b/regress/regress
index 9551e53..d351c85 100755
--- a/regress/regress
+++ b/regress/regress
@@ -67,6 +67,8 @@ 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
+run_test test_log_common
+run_test test_log_combined
run_test test_ipv4_addr
run_test test_ipv6_addr need_ipv6
run_test test_ipv6_server need_ipv6
diff --git a/regress/tests.sh b/regress/tests.sh
index b2fe511..f4dc0eb 100644
--- a/regress/tests.sh
+++ b/regress/tests.sh
@@ -517,6 +517,52 @@ log style legacy'
return 0
}
+test_log_common() {
+ rm -f log log.edited
+ setup_simple_test '
+log access "'$PWD'/log"
+log style common'
+
+ fetch_hdr /
+ check_reply '20 text/gemini'
+
+ # remove the ip and timestamp
+ awk '{$2 = ""; $5 = "timestamp"; print $0}' log > log.edited
+
+ printf '%s\n' 'localhost - - timestamp +0200 "gemini://localhost/" 20 0' \
+ | 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
+}
+
+test_log_combined() {
+ rm -f log log.edited
+ setup_simple_test '
+log access "'$PWD'/log"
+log style combined'
+
+ fetch_hdr /
+ check_reply '20 text/gemini'
+
+ # remove the ip and timestamp
+ awk '{$1 = ""; print gensub("\\[.*\\]", "[timestamp]", 1)}' log > log.edited
+
+ printf '%s\n' ' - - [timestamp] "gemini://localhost/" 20 0 "-" ""' \
+ | 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
+}
+
test_ipv4_addr() {
server_name="*"
host="127.0.0.1"