[CMake] ctest meant to be re-entrant?

Chris Hillery chillery-cmake at lambda.nu
Mon Jun 21 19:42:33 EDT 2010


On Mon, Jun 21, 2010 at 10:53 AM, Convey, Christian J CIV NUWC NWPT <
christian.convey at navy.mil> wrote:

> Thanks, that does help.  Could you tell me if the following
> approach constent with what you guys intended?
>
> I want some parts of "CTestTestfile.cmake" to be automatically generated
> from the CMakeLists.txt files in my source directory tree.
>
> OTOH, I also want to supply some additional information ctest.  For
> example, 'set(CTEST_BUILD_NAME "myBuildName")'.
>
> So I do this:
>
> 1. Have a permanent (e.g., non-generated) file
>   "MyCTestScript.cmake" with the following content:
>
>   INCLUDE("CTestTestfile.cmake")
>   SET(CTEST_BUILD_NAME "myBuildName")
>
> 2. When I want to run tests, I use this command:
>   ctest -s MyCTestScript.cmake -D Nightly
>
>
I don't think that looks right. CTestTestfile.cmake is an internal,
generated file; I can't think of any circumstance where you'd want to be
including it directly. It is used *by* ctest to determine what tests to run,
but it is not a "ctest script".

I also don't think (although I'm less sure) that you can use both -S and -D
on the command line at the same time. They're exclusive options.

David is right; it's confusing because ctest can be used in several
different ways. I think it's actually much worse than he says, because as
far as I can tell, ctest can be used in four completely different and
mutually incompatible ways, each with their own idiosyncrasies. To make
things worse, two of the ways are actually invoked with the same arguments!

1. "ctest" by itself (when run from a binary directory) serves as a simple
test harness. It executes test cases previously configured by cmake and
reports on the results.

2. "ctest -D" serves as an "automatic dashboard". The term "dashboard",
IMHO, is a terrible one, but what it means is that it will perform a
pre-programmed set of operations, chosen from the set of Update, Configure,
Build, Test, Coverage, and Submit (upload results to a dashboard). The set
of operations it performs, and some details about how they are performed, is
determined by the parameter to -D: Experimental, Continuous, Nightly. You
have some amount of control over which steps get run using the -T option.

3. "ctest -S" can run a simple CTest script, which is basically a
"semi-automatic dashboard". In this kind of script (sometimes called
"old-style ctest script", you can set up some variables to modify how the
dashboard process is run. This is, again IMHO, a badly thought-out feature,
because it still does a lot of things automatically and the variables which
you can set to modify the behaviour are quirky and poorly-documented. It
really is in no meaningful sense a "script".

4. Finally, "ctest -S" can also run a "new-style CTest script". In this kind
of script, you have complete control over what happens - you don't even have
to "run a dashboard", but can do pretty much anything you want in whatever
order you want. The magic which makes a script a "new-style CTest script" is
that it uses the functions ctest_start(), ctest_configure(), etc.


Anyway, that was probably a lot more than you wanted to know at this time,
but hopefully it will serve some value in future. Meanwhile, I suspect
there's probably a straightforward way to do what you actually want to do,
I'm just afraid I don't know what it is that you want to do. :)

Ceej
aka Chris Hillery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100621/474f3227/attachment.htm>


More information about the CMake mailing list