From a3dd7506d377b1434f913bd65c019eed52b64b6e Mon Sep 17 00:00:00 2001 From: truebrain Date: Mon, 12 Jan 2009 17:11:45 +0000 Subject: (svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see. NoAI is an API (a framework) to build your own AIs in. See: http://wiki.openttd.org/wiki/index.php/AI:Main_Page With many thanks to: - glx and Rubidium for their syncing, feedback and hard work - Yexo for his feedback, patches, and AIs which tested the system very deep - Morloth for his feedback and patches - TJIP for hosting a challenge which kept NoAI on track - All AI authors for testing our AI API, and all other people who helped in one way or another -Remove: all old AIs and their cheats/hacks --- bin/ai/regression/run.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 bin/ai/regression/run.sh (limited to 'bin/ai/regression/run.sh') diff --git a/bin/ai/regression/run.sh b/bin/ai/regression/run.sh new file mode 100644 index 000000000..3f9819e91 --- /dev/null +++ b/bin/ai/regression/run.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +if ! [ -f ai/regression/regression.nut ]; then + echo "Make sure you are in the root of OpenTTD before starting this script." + exit 1 +fi + +cp ai/regression/regression.nut ai/regression/main.nut +cp ai/regression/regression_info.nut ai/regression/info.nut + +if [ -f scripts/game_start.scr ]; then + mv scripts/game_start.scr scripts/game_start.src.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 [ -n "$gdb" ]; then + $gdb ./openttd -x -c ai/regression/regression.cfg $params -g ai/regression/regression.sav +else + ./openttd -x -c ai/regression/regression.cfg $params -g ai/regression/regression.sav -d ai=2 2>&1 | awk '{ gsub("0x\\(nil\\)", "0x00000000", $0); gsub("^dbg: \\[ai\\]", "", $0); gsub("^ ", "ERROR: ", $0); gsub("ERROR: \\[1\\] ", "", $0); gsub("\\[P\\] ", "", $0); print $0; }' > tmp.regression +fi + +if [ -z "$gdb" ]; then + res="`diff -ub ai/regression/regression.txt tmp.regression`" + if [ -z "$res" ]; then + echo "Regression test passed!" + else + echo "Regression test failed! Difference:" + echo "$res" + fi + echo "" + echo "Regression test done" +fi + +rm -f ai/regression/main.nut ai/regression/info.nut + +if [ -f scripts/game_start.scr.regression ]; then + mv scripts/game_start.scr.regression scripts/game_start.src +fi + +if [ "$1" != "-k" ]; then + rm -f tmp.regression +fi -- cgit v1.2.3-70-g09d2