aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-04-04 13:07:09 +0000
committerOmar Polo <op@omarpolo.com>2024-04-04 13:07:09 +0000
commit42235e3fc2853ac5c1b0fa355c1dda45d558ee11 (patch)
tree51e573e52af25f4840a63f45df5bdbb7aaee0133
parentf53f5e5fe13af9ae5b55eda34635e61a5c11b538 (diff)
add a test for the config dumping
-rwxr-xr-xregress/regress3
-rw-r--r--regress/tests.sh28
2 files changed, 31 insertions, 0 deletions
diff --git a/regress/regress b/regress/regress
index 548d551..13f8acb 100755
--- a/regress/regress
+++ b/regress/regress
@@ -20,6 +20,9 @@ fi
run_test test_punycode
run_test test_iri
+# Run configuration dumping test.
+run_test test_dump_config
+
if [ "${SKIP_RUNTIME_TESTS:-0}" -eq 1 ]; then
echo
echo "======================"
diff --git a/regress/tests.sh b/regress/tests.sh
index 72ad303..65c4903 100644
--- a/regress/tests.sh
+++ b/regress/tests.sh
@@ -8,6 +8,34 @@ test_iri() {
./iri_test
}
+test_dump_config() {
+ dont_check_server_alive=yes
+ gen_config '' ''
+
+ exp="$(mktemp)"
+ got="$(mktemp)"
+ cat <<EOF >$exp
+prefork 3
+
+server "localhost" {
+ cert "$PWD/localhost.pem"
+ key "$PWD/localhost.key"
+}
+EOF
+
+ $gmid -nn -c reg.conf > $got 2>/dev/null
+
+ ret=0
+ if ! cmp -s "$exp" "$got"; then
+ echo "config differs!" >&2
+ diff -u "$exp" "$got" >&2
+ ret=1
+ fi
+
+ rm "$exp" "$got"
+ return $ret
+}
+
test_gemexp() {
dont_check_server_alive=yes