[CMake] Multiple tests in a single file

David Doria daviddoria at gmail.com
Fri Jan 6 18:47:03 EST 2012


On Fri, Jan 6, 2012 at 5:54 PM, Jean-Christophe Fillion-Robin
<jchris.fillionr at kitware.com> wrote:
> Hi David,
>
> Not too long ago I was browsing the project of a friend who worked on BTK
> (The toolkit used by Mokka, a motion kinematic & kinetic analyser) [1].
>
> I noticed that he is using cxxtest [2] along with ctest. It seems it could
> to address the use case you are describing.
>
> See Example integration [3] and cxxtest source [4]
>
> Hth
> Jc
>
> [1] https://b-tk.googlecode.com/svn/web/mokka/index.html
> [2] http://cxxtest.tigris.org/
> [3]
> https://code.google.com/p/b-tk/source/browse/BTK/trunk/Testing/Code/C3DFileReaderTest.h
> [4]
> https://code.google.com/p/b-tk/source/browse/#svn%2FBTK%2Ftrunk%2FUtilities%2FCxxTest%2Fcxxtest

Thanks Jean-Christophe. So I guess the short answer is "ctest can't do this".

It seems they have made significant modifications to CxxTest so that
the bin/cxxtestgen that ships with CxxTest is no longer required
(they've replaced it with C macros). I like the BTK way better :)

I guess I'm not sure what the advantage of using CTest along with
something like CxxTest is. If you build an executable using CMake,
then why not just run ./MyTests from the terminal instead of making an
interface so that you can call 'ctest'. CTest will report a single
pass or fail, because as far as it is concerned there is only one
test, right? The relevant file is
https://code.google.com/p/b-tk/source/browse/BTK/trunk/Testing/Code/CMakeLists.txt
that only has one add_test call.

Any thoughts?

David


More information about the CMake mailing list