From 9e3ad3d03eb4b854353549316f9a5b438e95a6da Mon Sep 17 00:00:00 2001 From: bombcar Date: Wed, 16 Feb 2022 00:14:39 -0600 Subject: fix runserver (#18) * fix runserver * needs decop --- .github/scripts/test-no-error-reports.sh | 45 ---------------------------- .github/scripts/test_no_error_reports | 51 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 45 deletions(-) delete mode 100755 .github/scripts/test-no-error-reports.sh create mode 100755 .github/scripts/test_no_error_reports (limited to '.github/scripts') diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh deleted file mode 100755 index cfce0261a5..0000000000 --- a/.github/scripts/test-no-error-reports.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -RUNDIR="run" -CRASH="crash-reports" -SERVERLOG="server.log" - -# enable nullglob to get 0 results when no match rather than the pattern -shopt -s nullglob -# store matches in array (don't forget to double-quote variables expansion -crash_reports=( "$RUNDIR/$CRASH/crash"*.txt ) -if [ "${#crash_reports[@]}" -gt 0 ]; then - latest_crash_report="${crash_reports[-1]}" - { - printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}" - cat "$latest_crash_report" - } >&2 - exit 1 -fi - -if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then - { - printf 'Fatal errors detected:' - cat server.log - } >&2 - exit 1 -fi - -if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' "$SERVERLOG"; then - { - printf 'Server force stopped:' - cat server.log - } >&2 - exit 1 -fi - -if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then - { - printf 'Server did not finish startup:' - cat server.log - } >&2 - exit 1 -fi - -printf 'No crash reports detected' -exit 0 diff --git a/.github/scripts/test_no_error_reports b/.github/scripts/test_no_error_reports new file mode 100755 index 0000000000..1fcc7396c6 --- /dev/null +++ b/.github/scripts/test_no_error_reports @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# bashsupport disable=BP5006 # Global environment variables +RUNDIR="run" \ + CRASH="crash-reports" \ + SERVERLOG="server.log" + +# enable nullglob to get 0 results when no match rather than the pattern +shopt -s nullglob + +# store matches in array +crash_reports=("$RUNDIR/$CRASH/crash"*.txt) + +# if array not empty there are crash_reports +if [ "${#crash_reports[@]}" -gt 0 ]; then + # get the latest crash_report from array + latest_crash_report="${crash_reports[-1]}" + { + printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}" + cat "$latest_crash_report" + } >&2 + exit 1 +fi + +if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then + { + printf 'Fatal errors detected:\n' + cat server.log + } >&2 + exit 1 +fi + +if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \ + "$SERVERLOG"; then + { + printf 'Server force stopped:' + cat server.log + } >&2 + exit 1 +fi + +if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then + { + printf 'Server did not finish startup:' + cat server.log + } >&2 + exit 1 +fi + +printf 'No crash reports detected' +exit 0 -- cgit