[CMake] Compilation failure req'd for successful test
Walter E Brown
wb at fnal.gov
Wed Apr 27 12:11:13 EDT 2005
Brad King wrote:
> Walter E Brown wrote:
>
>> As part of a project's testing, we need to ensure that a compilation
>> failure will correctly occur under specific circumstances. In
>> particular, we wish at ctest time:
>>
>> - to compile (but not link) a specific program that we expect to
>> fail compilation, then
>>
>> - to capture the detailed output of that compilation into a file,
>> and then
>>
>> - to run some other program (perhaps a tool like grep or perhaps a
>> custom script) that inspects that attempted compilation's output for
>> certain characteristics of interest, and finally
>>
>> - to indicate the success or failure of the test based on the
>> results of such inspection.
>>
>> Alas, it is unclear to us how to set this up; neither the book nor the
>> online help seem on point. Can someone advise us, preferably with
>> sample cmake/ctest code that we can use as a model?
>
>
> Currently there is no easy way to do this. You may have to create a
> program that drives this process itself and then add the program as the
> test. It can use "ctest --build-and-test ..." to drive the build and
> then capture the exit code and output. You can look at
> CMake/Source/kwsys (and even copy the library) to get some nice
> cross-platform process execution code to help achieve this.
>
> In the long run this should be a ctest feature accessible through an
> option like "--build-fail-compile". Please add it as a feature request
> here:
>
> http://www.cmake.org/Bug
>
> Thanks,
> -Brad
I sincerely appreciate the prompt reply, but this is a truly unfortunate
state of affairs. Since we are not cmake/ctest experts, we will likely
be unable to make effective progress along the lines you suggest; it is
alas not in our work schedule to divert development effort in this
direction.
You are certainly welcome to refer to my original email as a feature
request. Since our need is urgent, we will need to look elsewhere, I'm
afraid; the rather sparse available documentation seems to leave us few
choices.
(Incidentally, you may enjoy knowing that my spell-checker seems rather
desperate to have me rewrite "ctest" as "cutest"!)
Best wishes,
-- WEB
More information about the CMake
mailing list