5 if ! [ -f ai
/regression
/run.sh
]; then
6 echo "Make sure you are in the root of OpenTTD before starting this script."
10 if [ -f scripts
/game_start.scr
]; then
11 mv scripts
/game_start.scr
scripts
/game_start.scr.regression
16 if [ "$1" != "-r" ]; then
17 params
="-snull -mnull -vnull:ticks=30000"
19 if [ "$1" = "-g" ]; then
20 gdb
="gdb --ex run --args "
23 if [ -d "ai/regression/tst_$1" ]; then
24 tests
="ai/regression/tst_$1"
25 elif [ -d "ai/regression/tst_$2" ]; then
26 tests
="ai/regression/tst_$2"
28 tests
=ai
/regression
/tst_
*
33 echo -n "Running $tst... "
35 # Make sure that only one info.nut is present for each test run. Otherwise openttd gets confused.
36 cp ai
/regression
/regression_info.nut
$tst/info.nut
39 if ! [ -f $sav ]; then
40 sav
=ai
/regression
/empty.sav
43 if [ -n "$gdb" ]; then
44 $gdb .
/openttd
-x -c ai
/regression
/regression.cfg
$params -g $sav
46 .
/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: \[.*\]' > tmp.regression
49 if [ -z "$gdb" ]; then
50 res
="`diff -ub $tst/result.txt tmp.regression`"
51 if [ -z "$res" ]; then
54 echo "failed! Difference:"
63 if [ -f scripts
/game_start.scr.regression
]; then
64 mv scripts
/game_start.scr.regression
scripts
/game_start.scr
67 if [ "$1" != "-k" ]; then