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

-test-games

From Globulation2

Jump to: navigation, search

-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