bin/ai/regression/run.sh
author truelight
Mon, 19 Mar 2007 13:29:28 +0000
branchnoai
changeset 9481 39ba1c349d3d
parent 9470 4593c953a276
child 9523 cacf2f05f79b
permissions -rwxr-xr-x
(svn r9330) [NoAI] -Add: added -r as param for regression run.sh script to start the game, so you can check if it build what we expected him to for yourself
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
9470
4593c953a276 (svn r9308) [NoAI] -Change: make the regression scripts run without any user intervention; not manual enabling and disabling of AIs
rubidium
parents: 9469
diff changeset
     3
if ! [ -f ai/regression/regression.nut ]; then
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
     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
9470
4593c953a276 (svn r9308) [NoAI] -Change: make the regression scripts run without any user intervention; not manual enabling and disabling of AIs
rubidium
parents: 9469
diff changeset
     8
cp ai/regression/regression.nut ai/regression/main.nut
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
     9
9481
39ba1c349d3d (svn r9330) [NoAI] -Add: added -r as param for regression run.sh script to start the game, so you can check if it build what we expected him to for yourself
truelight
parents: 9470
diff changeset
    10
params=""
39ba1c349d3d (svn r9330) [NoAI] -Add: added -r as param for regression run.sh script to start the game, so you can check if it build what we expected him to for yourself
truelight
parents: 9470
diff changeset
    11
if [ "$1" != "-r" ]; then
39ba1c349d3d (svn r9330) [NoAI] -Add: added -r as param for regression run.sh script to start the game, so you can check if it build what we expected him to for yourself
truelight
parents: 9470
diff changeset
    12
	params="-snull -mnull -vnull"
39ba1c349d3d (svn r9330) [NoAI] -Add: added -r as param for regression run.sh script to start the game, so you can check if it build what we expected him to for yourself
truelight
parents: 9470
diff changeset
    13
fi
39ba1c349d3d (svn r9330) [NoAI] -Add: added -r as param for regression run.sh script to start the game, so you can check if it build what we expected him to for yourself
truelight
parents: 9470
diff changeset
    14
./openttd -a regression -x -c ai/regression/regression.cfg $params -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
    15
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
    16
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
    17
	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
    18
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
    19
	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
    20
	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
    21
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
    22
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
    23
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
    24
9470
4593c953a276 (svn r9308) [NoAI] -Change: make the regression scripts run without any user intervention; not manual enabling and disabling of AIs
rubidium
parents: 9469
diff changeset
    25
rm ai/regression/main.nut
4593c953a276 (svn r9308) [NoAI] -Change: make the regression scripts run without any user intervention; not manual enabling and disabling of AIs
rubidium
parents: 9469
diff changeset
    26
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
    27
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
    28
	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
    29
fi