QMTest Advice - Dependencies

Adrien Guillon aj.guillon at gmail.com
Mon Dec 21 20:11:47 UTC 2009


Hello all,

I've used qmtest for some simple things, and now I want to do more
with it.  I am using a CompilationTestDatabase, and my
QMTest/configuration file looks like this:

<?xml version="1.0" ?><!DOCTYPE extension  PUBLIC
'-//QM/2.6/Extension//EN'
'http://www.codesourcery.com/qm/dtds/2.6/-//qm/2.6/extension//en.dtd'><extension
class="compilation_test_database.CompilationTestDatabase"
kind="database"><argument
name="srcdir"><text>tests/unit_tests/</text></argument></extension>

I also have tests/unit_tests/test_context:

CompilerTable.languages=cplusplus
CompilerTable.cplusplus_kind=GCC
CompilerTable.cplusplus_path=g++
CompilerTable.cplusplus_options=-O2 -I../../../include

My project normally generates an executable as the final result,
however for testing I can generate a shared library and link tests to
it, so that I can do my unit testing.  However there are a couple of
modules which have different behaviours based upon some preprocessor
defines.  In particular, some debugging functions.  These functions
have different behaviours if extra debugging has been enabled,
otherwise they should do nothing.  For instance, I might define
EXTRA_DEBUGGING or GATHER_STATISTICS to enable special code.  I want
to test these types of functions to make sure they work as part of my
normal test suite.

These functions are only enabled with the appropriate preprocessor
macro, and are cleanly separable from the whole project.  So for that
reason, I'd like to test my C++ test case debugging_test_1.cpp with
the #define EXTRA_DEBUGGING and since it's cleanly separable from the
rest of the project, I only want to link it with extra_debugging.cpp
(which was compiled with the same flags).  This comes down to the
question of doing a compile and run test which has different
dependencies than everything else.

How can I do this with QMTest?

Thanks!

AJ Guillon



More information about the qmtest mailing list