Free and Open Source real time strategy game with a new take on micro-management

Difference between revisions of "-test-games"

From Globulation2

Jump to: navigation, search
(partly restored page and extended the testing ideas)
 
Line 1: Line 1:
-test-games is a new testing functionality included with Globulation 2 since 0.9.3 (Beta 3). It enables countless hours of testing and bug finding without needing to play a single game. This makes it easy to find as many bugs as possible and fix them, to provide the most stable release we can.
ok. -test-games is one of the sites gone since the move to my server. the essential parts are the two scripts i wrote to automate testing.


[[User:Giszmo|Giszmo]] has created some scripts that do automated testing using the -test-games-nox (the testing command without using the GUI (faster)), and makes it log info when a crash occurs. With them, you can leave the game running 24/7 and catch up to 10 crashes (limited to save space).

If you want to help with testing, follow these steps (designed for Linux users only):

== gdb Commands ==
* Create a new file, called gdbCommands (don't put .txt on the end) with the following contents
<pre>
<pre>
$ cat gdbCommands
run -test-games-nox
run -test-games-nox
bt
bt
bt full
bt full
q
q
</pre>


== Run Glob2 Tests ==
$ cat runGlob2Tests.sh
* Create a new file, called runGlob2Tests.sh with the following contents
<pre>
#!/bin/bash
#!/bin/bash
trap bashtrap INT
trap bashtrap INT
Line 30: Line 38:
X=$(($X+1))
X=$(($X+1))
done
done
</pre>


== Update source code automatically ==
$ cat runGlob2TestsWithGHAndScons.sh
* You can also make it pull the latest changes from mercurial, recompile, and restart the tests every 20 minutes. This way, a bug or several bugs can be fixed, and you don't need to interfere for it to update.
* Create a new file, called runGlob2TestsWithGHAndScons.sh with the following contents
<pre>
#!/bin/bash
#!/bin/bash
trap bashtrap INT
trap bashtrap INT
Line 54: Line 66:
</pre>
</pre>


== Putting it all together ==
an idea now is to use the random numbers to identify games that crash and find them faster using -O3. some
* Save the above three files to root of the Globulation 2 game directory (where you find INSTALL/README/SConstruct etc).
compile using -O3
* If you want to auto update the source code, run
run without gdb|grep Random>>random.txt
<pre>./runGlob2TestsWithGHAndScons.sh</pre>
compile
* If you just want to test the current code and not worry about updates to the source, run
run using gdb and tail of random.txt to get the bt like above
<pre>./runGlob2Tests.sh</pre>

== Future Automated Script ideas ==
* With the addition of random seeds in the games, an idea now is to use the random numbers to identify games that crash and find them faster using -O3. Basically:
:*compile using -O3
:*run ./glob2;grep Random>>random.txt
::*Without gdb, and optimized, the game will get through games at lightning speeds
:*when a crash occurs, run the random seed through an unoptimized version of the game using gdb and tail of random.txt to get the bt like above
::*this will be slower, but will allow the devs to find and fix the bug that occured

Revision as of 04:45, 7 April 2008

-test-games is a new testing functionality included with Globulation 2 since 0.9.3 (Beta 3). It enables countless hours of testing and bug finding without needing to play a single game. This makes it easy to find as many bugs as possible and fix them, to provide the most stable release we can.

Giszmo has created some scripts that do automated testing using the -test-games-nox (the testing command without using the GUI (faster)), and makes it log info when a crash occurs. With them, you can leave the game running 24/7 and catch up to 10 crashes (limited to save space).

If you want to help with testing, follow these steps (designed for Linux users only):

gdb Commands

  • Create a new file, called gdbCommands (don't put .txt on the end) with the following contents
run -test-games-nox
bt
bt full
q

Run Glob2 Tests

  • Create a new file, called runGlob2Tests.sh with the following contents
#!/bin/bash
trap bashtrap INT
bashtrap()
{
        killall -9 glob2
        exit
}
X=0
#max 10 bug reports as infinite repeation might result in nasty waste of resource
while [ $X -le 10 ] ; do
        echo $X crashes so far in round $1 ...
        gdb -x gdbCommands src/glob2 > gdbOutput.txt
        mkdir crash$1$X
        mv gdbOutput.txt crash$1$X/
        mv ~/.glob2/games/Auto_save.game ~/.glob2/games/crashed$1$X.game
        bzip2 --compress --keep -9 crash$1$X/gdbOutput.txt
        bzip2 --compress --keep -9 ~/.glob2/games/crashed$1$X.game
        mv ~/.glob2/games/crashed$1$X.game.bz2 crash$1$X/
        zenity --info --text="crash" &
        X=$(($X+1))
done

Update source code automatically

  • You can also make it pull the latest changes from mercurial, recompile, and restart the tests every 20 minutes. This way, a bug or several bugs can be fixed, and you don't need to interfere for it to update.
  • Create a new file, called runGlob2TestsWithGHAndScons.sh with the following contents
#!/bin/bash
trap bashtrap INT
bashtrap()
{
        killall runGlob2Tests.sh
        exit
}
cd /home/leo/projects/glob2_2
X=0
./runGlob2Tests.sh $X &
while true ; do
        hg pull http://hg.globulation2.org/glob2
        hg update -C -r beta3-rc
        killall runGlob2Tests.sh
        killall -9 glob2
        scons -j4
        X=$(($X+1))
        ./runGlob2Tests.sh $X &
        sleep $(( 60*30 ))
done

Putting it all together

  • Save the above three files to root of the Globulation 2 game directory (where you find INSTALL/README/SConstruct etc).
  • If you want to auto update the source code, run
./runGlob2TestsWithGHAndScons.sh
  • If you just want to test the current code and not worry about updates to the source, run
./runGlob2Tests.sh

Future Automated Script ideas

  • With the addition of random seeds in the games, an idea now is to use the random numbers to identify games that crash and find them faster using -O3. Basically:
  • compile using -O3
  • run ./glob2;grep Random>>random.txt
  • Without gdb, and optimized, the game will get through games at lightning speeds
  • when a crash occurs, run the random seed through an unoptimized version of the game using gdb and tail of random.txt to get the bt like above
  • this will be slower, but will allow the devs to find and fix the bug that occured
Misc