mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 06:15:04 +00:00
Fix: make -k switch useful when testing regression (#7053)
This commit is contained in:
parent
4fc1b2baae
commit
efc44466d6
@ -43,11 +43,11 @@ for tst in $tests; do
|
|||||||
if [ -n "$gdb" ]; then
|
if [ -n "$gdb" ]; then
|
||||||
$gdb ./openttd -x -c ai/regression/regression.cfg $params -g $sav
|
$gdb ./openttd -x -c ai/regression/regression.cfg $params -g $sav
|
||||||
else
|
else
|
||||||
./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
|
./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: \[.*\]' > $tst/tmp.regression
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$gdb" ]; then
|
if [ -z "$gdb" ]; then
|
||||||
res="`diff -ub $tst/result.txt tmp.regression`"
|
res="`diff -ub $tst/result.txt $tst/tmp.regression`"
|
||||||
if [ -z "$res" ]; then
|
if [ -z "$res" ]; then
|
||||||
echo "passed!"
|
echo "passed!"
|
||||||
else
|
else
|
||||||
@ -58,14 +58,14 @@ for tst in $tests; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
rm $tst/info.nut
|
rm $tst/info.nut
|
||||||
|
|
||||||
|
if [ "$1" != "-k" ]; then
|
||||||
|
rm -f $tst/tmp.regression
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -f scripts/game_start.scr.regression ]; then
|
if [ -f scripts/game_start.scr.regression ]; then
|
||||||
mv scripts/game_start.scr.regression scripts/game_start.scr
|
mv scripts/game_start.scr.regression scripts/game_start.scr
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" != "-k" ]; then
|
|
||||||
rm -f tmp.regression
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $ret
|
exit $ret
|
||||||
|
@ -99,11 +99,11 @@ Function RunTest(test, params, ret)
|
|||||||
|
|
||||||
command = ".\openttd -x -c ai/regression/regression.cfg " & params & " -g " & sav & " -d script=2 -d misc=9"
|
command = ".\openttd -x -c ai/regression/regression.cfg " & params & " -g " & sav & " -d script=2 -d misc=9"
|
||||||
' 2>&1 must be after >tmp.regression, else stderr is not redirected to the file
|
' 2>&1 must be after >tmp.regression, else stderr is not redirected to the file
|
||||||
WshShell.Run "cmd /c " & command & " >tmp.regression 2>&1", 0, True
|
WshShell.Run "cmd /c " & command & " >"& test & "/tmp.regression 2>&1", 0, True
|
||||||
|
|
||||||
FilterFile "tmp.regression"
|
FilterFile test & "/tmp.regression"
|
||||||
|
|
||||||
If CompareFiles(test & "/result.txt", "tmp.regression") Then
|
If CompareFiles(test & "/result.txt", test & "/tmp.regression") Then
|
||||||
RunTest = "passed!"
|
RunTest = "passed!"
|
||||||
Else
|
Else
|
||||||
RunTest = "failed!"
|
RunTest = "failed!"
|
||||||
@ -111,6 +111,14 @@ Function RunTest(test, params, ret)
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
FSO.DeleteFile test & "/info.nut"
|
FSO.DeleteFile test & "/info.nut"
|
||||||
|
|
||||||
|
If WScript.Arguments.Count > 0 Then
|
||||||
|
If WScript.Arguments.Item(0) = "-k" Then
|
||||||
|
Exit Function
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
FSO.DeleteFile test & "/tmp.regression"
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
On Error Resume Next
|
On Error Resume Next
|
||||||
@ -143,12 +151,4 @@ If FSO.FileExists("scripts/game_start.scr.regression") Then
|
|||||||
FSO.MoveFile "scripts/game_start.scr.regression", "scripts/game_start.scr"
|
FSO.MoveFile "scripts/game_start.scr.regression", "scripts/game_start.scr"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If WScript.Arguments.Count > 0 Then
|
|
||||||
If WScripts.Arguments.Items(0) = "-k" Then
|
|
||||||
WScript.Quit ret
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
FSO.DeleteFile "tmp.regression"
|
|
||||||
|
|
||||||
WScript.Quit ret
|
WScript.Quit ret
|
||||||
|
Loading…
Reference in New Issue
Block a user