summaryrefslogtreecommitdiff
path: root/bin/ai/regression/run.sh
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2019-04-07 11:45:52 +0200
committerglx22 <glx22@users.noreply.github.com>2020-06-05 19:36:05 +0200
commit203a77c1dc722df677302e84c6d5c0d4cb06d8ee (patch)
treef14d2016746b24640b0dd8d7dd9d0b342ece9cde /bin/ai/regression/run.sh
parent84b71f796220b382c2bf943a406234ffb18098b8 (diff)
downloadopenttd-203a77c1dc722df677302e84c6d5c0d4cb06d8ee.tar.xz
Codechange: move regression outside of bin and make it work via CMake script
The tst_stationlist savegame had to be changed to start the correct AI. In the old setup, all regression AIs had the same name, which made it impossible to run both regressions in parallel. With the new setup this is possible. Although all files are available to run the regression, it won't really work till CMake is introduced (which will happen in a few commits from here)
Diffstat (limited to 'bin/ai/regression/run.sh')
-rwxr-xr-xbin/ai/regression/run.sh69
1 files changed, 0 insertions, 69 deletions
diff --git a/bin/ai/regression/run.sh b/bin/ai/regression/run.sh
deleted file mode 100755
index 7574b0b38..000000000
--- a/bin/ai/regression/run.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/sh
-
-if ! [ -f ai/regression/run.sh ]; then
- echo "Make sure you are in the root of OpenTTD before starting this script."
- exit 1
-fi
-
-if [ -f scripts/game_start.scr ]; then
- mv scripts/game_start.scr scripts/game_start.scr.regression
-fi
-
-params=""
-gdb=""
-if [ "$1" != "-r" ]; then
- params="-snull -mnull -vnull:ticks=30000"
-fi
-if [ "$1" = "-g" ]; then
- gdb="gdb --ex run --args "
-fi
-
-if [ -d "ai/regression/tst_$1" ]; then
- tests="ai/regression/tst_$1"
-elif [ -d "ai/regression/tst_$2" ]; then
- tests="ai/regression/tst_$2"
-else
- tests=ai/regression/tst_*
-fi
-
-ret=0
-for tst in $tests; do
- echo -n "Running $tst... "
-
- # Make sure that only one info.nut is present for each test run. Otherwise openttd gets confused.
- cp ai/regression/regression_info.nut $tst/info.nut
-
- sav=$tst/test.sav
- if ! [ -f $sav ]; then
- sav=ai/regression/empty.sav
- fi
-
- if [ -n "$gdb" ]; then
- $gdb ./openttd -x -c ai/regression/regression.cfg $params -g $sav
- else
- ./openttd -x -c ai/regression/regression.cfg $params -g $sav -d script=2 -d misc=9 2>&1 | awk '{ gsub("0x(\\(nil\\)|0+)(x0)?", "0x00000000", $0); gsub("^dbg: \\[script\\]", "", $0); gsub("^ ", "ERROR: ", $0); gsub("ERROR: \\[1\\] ", "", $0); gsub("\\[P\\] ", "", $0); print $0; }' | grep -v '^dbg: \[.*\]' > $tst/tmp.regression
- fi
-
- if [ -z "$gdb" ]; then
- res="`diff -ub $tst/result.txt $tst/tmp.regression`"
- if [ -z "$res" ]; then
- echo "passed!"
- else
- echo "failed! Difference:"
- echo "$res"
- ret=1
- fi
- fi
-
- rm $tst/info.nut
-
- if [ "$1" != "-k" ]; then
- rm -f $tst/tmp.regression
- fi
-done
-
-if [ -f scripts/game_start.scr.regression ]; then
- mv scripts/game_start.scr.regression scripts/game_start.scr
-fi
-
-exit $ret