Latest Posts

Changes in RegressionTests

Editor Comment

Improved instructions.


Revision Differences of Revision 11

When you think your branch is ready for merging, there are two tests you can run to make sure that your code sticks to our coding style, and to test for a bunch of possible regression bugs. ¶

## Running Codecheck Manually ¶


We have codecheck rules that will help you stick to our coding style guidelines. These are run automatically whenever you compile a debug build, but they can be hard to see now, because cmake creates a lot of output around them. However, you can run the checks manually: ¶

`c
d build && make codecheck` ¶

If you see lots of "see_if_codecheck_needs_to_run_" messages, it will be easier to run: ¶

`c
make/codecheck/!CodeCheck.py src/* | grep -v "src/third_party"`

Note that this second command won't check the `CMakeLists.txt` files.



## Running Regression Tests ¶

Some tests can be run automatically wile compiling debug builds, but not all of them. We have some automated scenarios that will check for regression bugs. You can run all of them with ¶

`./regression_test.py -b ./widelands` ¶

orIf you caonly wish to run juspart speciofic the testsuite, you can filter with regex for thex filenampe, like this: ¶

`./
regression_test.py -b ./widelands --sr=portdocenk` ¶

Th
art wio=ll run all test/map(s/) (*lua_ files) with a kesyword (portdock in thisu example) in their file path.wm You can of --dcourse use the entire filename to run just one test. Have a look at the tests dir_ectory for_ which tests are avaing=lable.`

While debugging casome thisng specific, you can also use different commands to wget the output dirkiectly ong the console - note that this won't set upp the complete testing ednvironment, so you will always need to use one of the above commands to verify when you're done. Depending on whickh test, ayou pcan try the following two cuommands: ¶

`./wide
larnds --scenaript fro=test/m aps/lua_testsuite.wmf l--datadikr_for_testing=.` ¶

or
: ¶

`./widelands --datadir=data --datadir_for_testing=. -scenario=test/maps/ship_transportation.wmf --script=test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_worker_in_portdock.lua` ¶

Alternatively, you can use regex to filter test files like: ¶

`./regression_test.py -b ./widelands -r=portdock` ¶

that will run all test(s) (*lua files) with a keyword (portdock in this example) in a name. You can ofcourse use the entire filename to run just one test. Have a look at the tests directory what tests are available. ¶

For **help**
, run ¶

`./regression_test.py -h` ¶

or --help. ¶

###Required python version### ¶

Also note that !CodeCheck.py and regression_test.py **require python 2.x** (2.7 preferably), so if you get error like this: ¶

File "./regression_test.py", line 206 ¶
print "Using '%s' binary." % args.binary ¶
^ ¶
!SyntaxError: Missing parentheses in call to 'print' ¶

force python 2.7 this way: ¶

`python2.7 ./regression_test.py -b ./widelands` ¶

providing you are using **linux** or similar system. Chances are high that python2.7 is already installed on your box, if not use your package manager to install it. ¶