Compare commits

...

2 Commits

Author SHA1 Message Date
Omar Polo 42235e3fc2 add a test for the config dumping 2024-04-04 13:07:09 +00:00
Omar Polo f53f5e5fe1 fix config dumping (-nn) handling
with the privsep rework the config dumping was unadvertitely broken,
it prints the content of the key itself.
2024-04-04 11:22:06 +00:00
3 changed files with 33 additions and 2 deletions

4
gmid.c
View File

@ -605,8 +605,8 @@ main_print_conf(struct conf *conf)
TAILQ_FOREACH(h, &conf->hosts, vhosts) {
printf("\nserver \"%s\" {\n", h->domain);
printf(" cert \"%s\"\n", h->cert);
printf(" key \"%s\"\n", h->key);
printf(" cert \"%s\"\n", h->cert_path);
printf(" key \"%s\"\n", h->key_path);
/* TODO: print locations... */
printf("}\n");
}

View File

@ -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 "======================"

View File

@ -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