bin/ai/regression/run.sh
author glx
Sun, 18 Mar 2007 22:44:53 +0000
branchnoai
changeset 9466 ce783f899b3c
parent 9464 6c2cbcb79ff7
child 9469 7072beb81014
permissions -rwxr-xr-x
(svn r9304) [NoAI] -Fix r9296: use awk instead of sed to prevent eol problems
9461
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     1
#!/bin/sh
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     2
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     3
if ! [ -f ai/regression/main.nut ]; then
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     4
	echo "Make sure you are in the root of OpenTTD before starting this script."
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     5
	exit 1
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     6
fi
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     7
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     8
if [ -n "`cat ai/regression/main.nut | grep '//iFRegression <-FRegression();'`" ]; then
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
     9
	echo "Enable the Regression AI before starting the regression test."
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    10
	echo "Also disable any other AI. Check main.nut in ai/regression for"
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    11
	echo "more information about this."
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    12
	exit 1
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    13
fi
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    14
9466
ce783f899b3c (svn r9304) [NoAI] -Fix r9296: use awk instead of sed to prevent eol problems
glx
parents: 9464
diff changeset
    15
./openttd -x -c ai/regression/regression.cfg -snull -mnull -vnull -g ai/regression/regression.sav | awk '{ gsub("0x(nil)", "0x00000000", $0); print $0; }' > tmp.regression
9461
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    16
res="`diff -u ai/regression/regression.txt tmp.regression`"
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    17
if [ -z "$res" ]; then
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    18
	echo "Regression test passed!"
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    19
else
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    20
	echo "Regression test failed! Difference:"
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    21
	echo "$res"
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    22
fi
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    23
echo ""
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    24
echo "Regression test done"
ab1079656642 (svn r9293) [NoAI] -Add: added regression.sav, regression.txt and a small script to test if the regression passes. Make sure to disable any other AI when running this!
truelight
parents:
diff changeset
    25
9464
6c2cbcb79ff7 (svn r9296) [NoAI] -Fix: regression test now replaced 0x(nil) with 0x0000000 to make everything the same on all platforms
truelight
parents: 9463
diff changeset
    26
if [ "$1" != "-k" ]; then
6c2cbcb79ff7 (svn r9296) [NoAI] -Fix: regression test now replaced 0x(nil) with 0x0000000 to make everything the same on all platforms
truelight
parents: 9463
diff changeset
    27
	rm -f tmp.regression
6c2cbcb79ff7 (svn r9296) [NoAI] -Fix: regression test now replaced 0x(nil) with 0x0000000 to make everything the same on all platforms
truelight
parents: 9463
diff changeset
    28
fi