[CMake] CMake and Ctest and CppUnit
Pascal Fleury
fleury at users.sourceforge.net
Mon Mar 26 04:08:43 EST 2007
On Monday 26 March 2007 01:49:10 BigWave at web.de wrote:
> Hi Pascal,
>
> wow, thank you for your response - that helped a lot!
Happy to hear it :-)
> After some struggles, I got it to register one test, and to execute it.
> Great. But, if I add two tests, both get registered, but only one gets
> executed ... therefore twice though.
The testrunner.cpp you use does not seem to select the appropriate test. CTest
runs a test in calling the test runner with the name of the test to run. I
have this
Test* test_to_run = registry.makeTest();
if (argc>1)
test_to_run = test_to_run->findTest(argv[1]);
This is so because you will have one executable, containing all tests, so that
all get registered. This is normal. But with this selection, only the
appropriate tet should be picked, and run.
But your tests are registered *twice* with this:
> CPPUNIT_TEST_SUITE_REGISTRATION( S1CUTest );
> CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( S1CUTest, "S1CUTest" );
Once with your name, and once with a CppUnit selected name, which I bet, is
S1CUTest as well. The findTest() call will surely find both of them.
If you remove the first Registration line, I guess it should solve yur current
problem.
That starts to be off-topic on this CMake list, so either we move it to the
CppUnit list, or you can contact me directly.
--pascal
More information about the CMake
mailing list