diff options
author | truebrain <truebrain@openttd.org> | 2009-01-12 17:11:45 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2009-01-12 17:11:45 +0000 |
commit | a3dd7506d377b1434f913bd65c019eed52b64b6e (patch) | |
tree | ced1a262eb143ad6e64ec02f4a4c89835c0c32fd /bin/ai/regression/run.sh | |
parent | 9294f9616866b9778c22076c19b5a32b4f85f788 (diff) | |
download | openttd-a3dd7506d377b1434f913bd65c019eed52b64b6e.tar.xz |
(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
Diffstat (limited to 'bin/ai/regression/run.sh')
-rw-r--r-- | bin/ai/regression/run.sh | 49 |
1 files changed, 49 insertions, 0 deletions
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 |