Process core dump from named which failed to start

When named failed to start and produced core dump, the core file wasn't
processed by GDB because of run.sh script exiting immediately. This
remedies the limitation, simplifies the surrounding code, and makes the
script shellcheck clean.
This commit is contained in:
Michal Nowak
2021-05-04 12:58:23 +02:00
parent 4339831e54
commit bc097d3358

View File

@@ -115,20 +115,14 @@ eval "$(cd "${srcdir}" && ./get_ports.sh -p "$baseport" -t "$systest")"
restart=false restart=false
start_servers_failed() {
echoinfo "I:$systest:starting servers failed"
echofail "R:$systest:FAIL"
echoend "E:$systest:$(date_with_args)"
exit 1
}
start_servers() { start_servers() {
echoinfo "I:$systest:starting servers" echoinfo "I:$systest:starting servers"
if $restart; then if $restart; then
$PERL start.pl --restart --port "$PORT" "$systest" || start_servers_failed restart_opt="--restart"
else fi
restart=true if ! $PERL start.pl ${restart_opt} --port "$PORT" "$systest"; then
$PERL start.pl --port "$PORT" "$systest" || start_servers_failed echoinfo "I:$systest:starting servers failed"
return 1
fi fi
} }
@@ -205,29 +199,38 @@ status=0
run=0 run=0
# Run the tests # Run the tests
if [ -r "$systest/tests.sh" ]; then if [ -r "$systest/tests.sh" ]; then
start_servers if start_servers; then
( cd "$systest" && $SHELL tests.sh "$@" ) ( cd "$systest" && $SHELL tests.sh "$@" )
status=$? status=$?
run=$((run+1)) run=$((run+1))
stop_servers || status=1 stop_servers || status=1
else
status=1
fi
fi fi
if [ -n "$PYTEST" ]; then if [ $status -eq 0 ]; then
run=$((run+1)) if [ -n "$PYTEST" ]; then
for test in $(cd "${systest}" && find . -name "tests*.py"); do run=$((run+1))
start_servers for test in $(cd "${systest}" && find . -name "tests*.py"); do
rm -f "$systest/$test.status" if start_servers; then
test_status=0 rm -f "$systest/$test.status"
(cd "$systest" && "$PYTEST" -v "$test" "$@" || echo "$?" > "$test.status") | SYSTESTDIR="$systest" cat_d test_status=0
if [ -f "$systest/$test.status" ]; then (cd "$systest" && "$PYTEST" -v "$test" "$@" || echo "$?" > "$test.status") | SYSTESTDIR="$systest" cat_d
echo_i "FAILED" if [ -f "$systest/$test.status" ]; then
test_status=$(cat "$systest/$test.status") echo_i "FAILED"
fi test_status=$(cat "$systest/$test.status")
status=$((status+test_status)) fi
stop_servers || status=1 status=$((status+test_status))
done stop_servers || status=1
else else
echoinfo "I:$systest:pytest not installed, skipping python tests" status=1
break
fi
done
else
echoinfo "I:$systest:pytest not installed, skipping python tests"
fi
fi fi
if [ "$run" -eq "0" ]; then if [ "$run" -eq "0" ]; then
@@ -291,9 +294,9 @@ fi
print_outstanding_files() { print_outstanding_files() {
if test -d ${srcdir}/../../../.git; then if test -d ${srcdir}/../../../.git; then
git status -su --ignored "${systest}/" 2>/dev/null | \ git status -su --ignored "${systest}/" 2>/dev/null | \
sed -n -e 's|^?? \(.*\)|I:'${systest}':file \1 not removed|p' \ sed -n -e 's|^?? \(.*\)|I:'"${systest}"':file \1 not removed|p' \
-e 's|^!! \(.*/named.run\)$|I:'${systest}':file \1 not removed|p' \ -e 's|^!! \(.*/named.run\)$|I:'"${systest}"':file \1 not removed|p' \
-e 's|^!! \(.*/named.memstats\)$|I:'${systest}':file \1 not removed|p' -e 's|^!! \(.*/named.memstats\)$|I:'"${systest}"':file \1 not removed|p'
fi fi
} }