debugging (Junit) subsequenttests made easy!

Posted by Bjoern Michaelsen on 8 June 2011

debugging (Junit) subsequenttests made easy!

The Junit-based subsequenttests for LibreOffice have up to now been quite annoying to debug.
Here is a quick reinteration on how to use the subsequenttests. To run the subsequenttests one would:

./configure ....
make dev-install
make check

or, to run just the checks in one module:
source LinuxX86-64Env.Set.sh
make -srf sw/Makefile subsequentcheck # or alternatively
cd sw && make -sr subsequentcheck

To really see the test execute one would set gb_JunitTest_HEADLESS explicitly to empty:
export gb_JunitTest_HEADLESS=
 

Now, and this is new: To make debugging easier, there is another variable to control the behavior of the build system when running unittests:
export gb_JunitTest_DEBUGCOMMAND="/bin/sh readlink -f gnomedebug.sh"

Now, whenever a office instance is started, the debugcommand is executed afterwards (and before the tests start). gnomedebug.sh is a small shell script that starts gdb in a gnome-terminal and attaches to the soffice process. So with this, when running the tests, you get a gdb watching over the office instance that gets to execute the commands it gets from the test via UNO, making it much easier to debug crashers and other weird behavior that might be exposed by the tests. If you want to use another script for your (maybe non-gnome) environment, feel free to do so! And feel free to contribute your script to cgit.freedesktop.org/libreoffice/contrib/dev-tools/tree/junitdebug.

This was originally published at 2011-06-08 13:24:00/2011-06-08 11:29:42 on livejournal.