aboutsummaryrefslogtreecommitdiff
path: root/.github/scripts
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2022-02-23 13:03:46 +0800
committerGitHub <noreply@github.com>2022-02-23 06:03:46 +0100
commitd246612148b9b6dfaa4dfabd399f077ea0544096 (patch)
treea96dab0db8900faf6e344c1a1c7b58549c3cead3 /.github/scripts
parent7252f84377957aadcbb3b64b1b369209f1846e95 (diff)
downloadGT5-Unofficial-d246612148b9b6dfaa4dfabd399f077ea0544096.tar.gz
GT5-Unofficial-d246612148b9b6dfaa4dfabd399f077ea0544096.tar.bz2
GT5-Unofficial-d246612148b9b6dfaa4dfabd399f077ea0544096.zip
Consolidate boro glass stuff into a real API (#95)
* Consolidate boro glass stuff into a real API * pull in changes from ExampleMod * Fix underflow * attempt to fix build Former-commit-id: 2413c93bc2bb5ab32a0e8078dbcf01a4b23b1f7d
Diffstat (limited to '.github/scripts')
-rw-r--r--.github/scripts/test-no-crash-reports.sh9
-rwxr-xr-x.github/scripts/test_no_error_reports51
2 files changed, 51 insertions, 9 deletions
diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh
deleted file mode 100644
index c67e342c06..0000000000
--- a/.github/scripts/test-no-crash-reports.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-directory="run/crash-reports"
-if [ -d $directory ]; then
- echo "Crash reports detected:"
- cat $directory/*
- exit 1
-else
- echo "No crash reports detected"
- exit 0
-fi
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