unsolved! Re: solved! Re: [CMake] ctest command

Juan Sanchez Juan.Sanchez at amd.com
Thu Oct 4 15:41:55 EDT 2007


I'll just have to go back to the wrapper script.  I can't figure out why
 running make test can no trigger a rebuild.  Also, "--build-noclean"
does not help.

Is there any natural way to get verbose output to the screen from an
executable being run by ctest?  Aside from a wrapper script, is there
any way to tell ctest to run in a specific directory?

Thanks,

Juan

Juan Sanchez wrote:
> To solve my issue, I only need to specify the following.  Otherwise, no
> error is printed, the test will always past, and ctest --debug prints
> pages and pages of debug info.
> 
> ENABLE_TESTING()
> ADD_TEST("foo"  ${CMAKE_CTEST_COMMAND} --build-and-test
> ${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR} --build-generator
> ${CMAKE_GENERATOR}  --build-makeprogram ${CMAKE_MAKE_PROGRAM}
> --build-nocmake --build-run-dir ${PROJECT_SOURCE_DIR} -VV --test-command
> /bin/ls)
> 
> 
> Primary goals:
> 1. Run regression script which must be run from PROJECT_SOURCE_DIR.
> 2. Verbose output from the script being run
> 
> Thanks,
> 
> Juan
> 
> 
> Juan Sanchez wrote:
>> I am trying to follow an example that is in the cmake book.  It is in
>> section 8.5 "Using CTest to Drive Complex Tests" on page 109.  While my
>> example differs in that it doesn't use all the arguments being used in
>> the book's example, it is very important that I understand how to do this.
>>
>> My primary motivation was getting the "-V" or "-VV" option passed to the
>> test in order that cmake doesn't void the output from the test, but now
>> I just want to understand what it takes to get CMAKE_CTEST_COMMAND to
>> work inside the ADD_TEST statement.
>>
>> Regards,
>>
>> Juan
>>
>>
>>
>>
>> Alan W. Irwin wrote:
>>> On 2007-10-04 13:03-0500 Juan Sanchez wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm trying to run the following test:
>>>> ADD_TEST("foo" ${CMAKE_TEST_COMMAND} --build-run-dir
>>>> ${PROJECT_SOURCE_DIR} -VV --test-command "ls -ltar /tmp")
>>>>
>>>> But it doesn't seem to be running correctly.  It needs to be run from
>>>> ${PROJECT_SOURCE_DIR}, and the test command needs to be able to take the
>>>> arguments given.
>>> I don't have practical experience with many of these ctest options, but I
>>> was curious and looked them up in the documentation, and it appears you are
>>> not using them correctly.  For example, --test-command is documented (by
>>> ctest --help-full) as
>>>
>>> "The test to run with the --build-and-test option."
>>>
>>> but you don't have a --build-and-test option above so I think that's why
>>> your --test-command option is being ignored.
>>>
>>> Also, I am curious about your practical goal.  If/when the above test
>>> works it looks like it would create a a simple test that would allow ctest
>>> to invoke ctest on the command line. Do you need that extra level of ctest
>>> indirection?
>>>
>>> An alternative to the above extra layer of ctest indirection is to write a
>>> configurable bash or python or perl script to do what you want at ctest time
>>> and set up ctest for it using
>>>
>>> ADD_TEST("foo" full_path/scriptname).
>>>
>>> The configurable script, of course, allows you to change directories to any
>>> configured directory before you run your actual test.
>>>
>>> Alan
>>> __________________________
>>> Alan W. Irwin
>>>
>>> Astronomical research affiliation with Department of Physics and Astronomy,
>>> University of Victoria (astrowww.phys.uvic.ca).
>>>
>>> Programming affiliations with the FreeEOS equation-of-state implementation
>>> for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
>>> package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
>>> Linux Links project (loll.sf.net); and the Linux Brochure Project
>>> (lbproject.sf.net).
>>> __________________________
>>>
>>> Linux-powered Science
>>> __________________________
>>>
>>>
>>
> 
> 


-- 
Juan Sanchez
Juan.Sanchez at amd.com
800-538-8450 Ext. 54395
512-602-4395




More information about the CMake mailing list