From: Michal Nowak Date: Tue, 4 May 2021 10:58:23 +0000 (+0200) Subject: Process core dump from named which failed to start X-Git-Tag: v9.16.20~15^2~1 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=3e0f3e1d57bb0221422783716ce9d2a093b3017d;p=thirdparty%2Fbind9.git 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. (cherry picked from commit bc097d33588cd1e5b27b2ba832026e23559bc2af) --- diff --git a/bin/tests/system/run.sh b/bin/tests/system/run.sh index 89e530562d9..c0799cc0dc7 100755 --- a/bin/tests/system/run.sh +++ b/bin/tests/system/run.sh @@ -120,20 +120,14 @@ export HIGHPORT 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() { echoinfo "I:$systest:starting servers" if $restart; then - $PERL start.pl --restart --port "$PORT" "$systest" || start_servers_failed - else - restart=true - $PERL start.pl --port "$PORT" "$systest" || start_servers_failed + restart_opt="--restart" + fi + if ! $PERL start.pl ${restart_opt} --port "$PORT" "$systest"; then + echoinfo "I:$systest:starting servers failed" + return 1 fi } @@ -218,29 +212,38 @@ status=0 run=0 # Run the tests if [ -r "$systest/tests.sh" ]; then - start_servers - ( cd "$systest" && $SHELL tests.sh "$@" ) - status=$? - run=$((run+1)) - stop_servers || status=1 + if start_servers; then + ( cd "$systest" && $SHELL tests.sh "$@" ) + status=$? + run=$((run+1)) + stop_servers || status=1 + else + status=1 + fi fi -if [ -n "$PYTEST" ]; then - run=$((run+1)) - for test in $(cd "${systest}" && find . -name "tests*.py"); do - start_servers - rm -f "$systest/$test.status" - test_status=0 - (cd "$systest" && "$PYTEST" -v "$test" "$@" || echo "$?" > "$test.status") | SYSTESTDIR="$systest" cat_d - if [ -f "$systest/$test.status" ]; then - echo_i "FAILED" - test_status=$(cat "$systest/$test.status") - fi - status=$((status+test_status)) - stop_servers || status=1 - done -else - echoinfo "I:$systest:pytest not installed, skipping python tests" +if [ $status -eq 0 ]; then + if [ -n "$PYTEST" ]; then + run=$((run+1)) + for test in $(cd "${systest}" && find . -name "tests*.py"); do + if start_servers; then + rm -f "$systest/$test.status" + test_status=0 + (cd "$systest" && "$PYTEST" -v "$test" "$@" || echo "$?" > "$test.status") | SYSTESTDIR="$systest" cat_d + if [ -f "$systest/$test.status" ]; then + echo_i "FAILED" + test_status=$(cat "$systest/$test.status") + fi + status=$((status+test_status)) + stop_servers || status=1 + else + status=1 + break + fi + done + else + echoinfo "I:$systest:pytest not installed, skipping python tests" + fi fi if [ "$run" -eq "0" ]; then