Commit 58121f5f authored by Michał Kępień's avatar Michał Kępień

Improve portability of the "runtime" system test

The "runtime" system test currently fails on Windows because it waits
for named to log a message indicating successful startup ("running"),
but that never happens since named on Windows fails to open the
configuration file as its path includes control characters.

Instead of putting control characters in directory names, put them in
the value of the -D command line switch passed to named, which is used
for identifying an instance of named in a process listing and whose
value is completely ignored by named, but still logged.

While a similar check using special characters appears to be working
fine on Windows for the time being, modify it in the same way to avoid
potential future problems on other platforms and make the test cleaner.
parent b6c96f05
Pipeline #26693 canceled with stages
...@@ -19,5 +19,3 @@ rm -f rndc.out* ...@@ -19,5 +19,3 @@ rm -f rndc.out*
rm -rf ns2/nope rm -rf ns2/nope
rm -rf ns2/tmp.* rm -rf ns2/tmp.*
rm -f ns*/managed-keys.bind* rm -f ns*/managed-keys.bind*
rm -rf "ns2/`cat ctrl-char-dir-name`"
rm -rf "ns2/$;"
...@@ -22,6 +22,7 @@ copy_setports ns2/named-alt3.conf.in ns2/named-alt3.conf ...@@ -22,6 +22,7 @@ copy_setports ns2/named-alt3.conf.in ns2/named-alt3.conf
copy_setports ns2/named-alt4.conf.in ns2/named-alt4.conf copy_setports ns2/named-alt4.conf.in ns2/named-alt4.conf
copy_setports ns2/named-alt5.conf.in ns2/named-alt5.conf copy_setports ns2/named-alt5.conf.in ns2/named-alt5.conf
copy_setports ns2/named-alt6.conf.in ns2/named-alt6.conf copy_setports ns2/named-alt6.conf.in ns2/named-alt6.conf
copy_setports ns2/named-alt7.conf.in ns2/named-alt7.conf
mkdir ns2/nope mkdir ns2/nope
......
...@@ -165,10 +165,8 @@ status=$((status+ret)) ...@@ -165,10 +165,8 @@ status=$((status+ret))
n=$((n+1)) n=$((n+1))
echo_i "checking that named logs control characters in octal notation ($n)" echo_i "checking that named logs control characters in octal notation ($n)"
ret=0 ret=0
SPEC_DIR=$(cat ctrl-char-dir-name) INSTANCE_NAME="runtime-ns2-extra-7-$(cat ctrl-chars)"
mkdir "ns2/${SPEC_DIR}" (cd ns2 && $NAMED -c named-alt7.conf -D "${INSTANCE_NAME}" -d 99 -g > named$n.run 2>&1 &)
copy_setports ns2/named-alt7.conf.in "ns2/${SPEC_DIR}/named.conf"
(cd ns2 && $NAMED -c "${SPEC_DIR}/named.conf" -d 99 -g > named$n.run 2>&1 &)
wait_for_named "running$" ns2/named$n.run || ret=1 wait_for_named "running$" ns2/named$n.run || ret=1
grep 'running as.*\\177\\033' ns2/named$n.run > /dev/null || ret=1 grep 'running as.*\\177\\033' ns2/named$n.run > /dev/null || ret=1
kill_named ns2/named.pid || ret=1 kill_named ns2/named.pid || ret=1
...@@ -178,10 +176,8 @@ status=$((status+ret)) ...@@ -178,10 +176,8 @@ status=$((status+ret))
n=$((n+1)) n=$((n+1))
echo_i "checking that named escapes special characters in the logs ($n)" echo_i "checking that named escapes special characters in the logs ($n)"
ret=0 ret=0
SPEC_DIR="$;" INSTANCE_NAME="runtime-ns2-extra-8-$;"
mkdir "ns2/${SPEC_DIR}" (cd ns2 && $NAMED -c named-alt7.conf -D "${INSTANCE_NAME}" -d 99 -g > named$n.run 2>&1 &)
copy_setports ns2/named-alt7.conf.in "ns2/${SPEC_DIR}/named.conf"
(cd ns2 && $NAMED -c "${SPEC_DIR}/named.conf" -d 99 -g > named$n.run 2>&1 &)
wait_for_named "running$" ns2/named$n.run || ret=1 wait_for_named "running$" ns2/named$n.run || ret=1
grep 'running as.*\\$\\;' ns2/named$n.run > /dev/null || ret=1 grep 'running as.*\\$\\;' ns2/named$n.run > /dev/null || ret=1
kill_named ns2/named.pid || ret=1 kill_named ns2/named.pid || ret=1
...@@ -192,7 +188,6 @@ n=$((n+1)) ...@@ -192,7 +188,6 @@ n=$((n+1))
echo_i "checking that named logs an ellipsis when the command line is larger than 8k bytes ($n)" echo_i "checking that named logs an ellipsis when the command line is larger than 8k bytes ($n)"
ret=0 ret=0
LONG_CMD_LINE=$(cat long-cmd-line) LONG_CMD_LINE=$(cat long-cmd-line)
copy_setports ns2/named-alt7.conf.in "ns2/named-alt7.conf"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
(cd ns2 && $NAMED $LONG_CMD_LINE -c "named-alt7.conf" -g > named$n.run 2>&1 &) (cd ns2 && $NAMED $LONG_CMD_LINE -c "named-alt7.conf" -g > named$n.run 2>&1 &)
wait_for_named "running$" ns2/named$n.run || ret=1 wait_for_named "running$" ns2/named$n.run || ret=1
......
...@@ -1008,7 +1008,7 @@ ...@@ -1008,7 +1008,7 @@
./bin/tests/system/runsequential.sh SH 2018,2019 ./bin/tests/system/runsequential.sh SH 2018,2019
./bin/tests/system/runtime/README TXT.BRIEF 2014,2016,2018,2019 ./bin/tests/system/runtime/README TXT.BRIEF 2014,2016,2018,2019
./bin/tests/system/runtime/clean.sh SH 2014,2015,2016,2017,2018,2019 ./bin/tests/system/runtime/clean.sh SH 2014,2015,2016,2017,2018,2019
./bin/tests/system/runtime/ctrl-char-dir-name X 2019 ./bin/tests/system/runtime/ctrl-chars X 2019
./bin/tests/system/runtime/long-cmd-line X 2019 ./bin/tests/system/runtime/long-cmd-line X 2019
./bin/tests/system/runtime/setup.sh SH 2015,2016,2017,2018,2019 ./bin/tests/system/runtime/setup.sh SH 2015,2016,2017,2018,2019
./bin/tests/system/runtime/tests.sh SH 2014,2015,2016,2017,2018,2019 ./bin/tests/system/runtime/tests.sh SH 2014,2015,2016,2017,2018,2019
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment