[CMake] Fwd: generating CTest tests

Alex H aditya15417 at hotmail.com
Fri Aug 28 15:11:58 EDT 2009


Hello,
So where do we specify/put in the CMakeLists.txt where test1 is expected to fail or pass? 
How does CTest knows this...
Just to clarify the add_test command should be put inside a CMakeLists.txt? What if I want to invokectest using the following  command:
ctest -R testpage
What should testpage have inside of it?
Alex H.


> Date: Fri, 28 Aug 2009 14:14:21 -0400
> Subject: Re: [CMake] Fwd: generating CTest tests
> From: drescherjm at gmail.com
> To: aditya15417 at hotmail.com; cmake at cmake.org
> 
> On Fri, Aug 28, 2009 at 2:07 PM, Alex H<aditya15417 at hotmail.com> wrote:
> > Hello,
> > My problem is actually really simple I have a .cpp file and the program just
> > basically take an int as an argument, if the argument is from certain
> > numbers it returns a 1 otherwise 0.
> > Now I need to create a unit test that would allow me to do this... how can I
> > check the return value of the program? The add_test command just adds the
> > test to be performed using a
> > specific argument but it never tests the output...
> 
> CMake automatically does this for you when you build the RUN_TESTS
> target on Visual Studio or do a make test on other systems
> 
> Here is an example of the output of RUN_TESTS under visual studio 2005
> for the project I posted the CMakeLists.txt
> 
> 
> 1>Performing Post-Build Event...
> 1>Start processing tests
> 1>Test project X:/32Bit/VC.80/Qt/QtBasicUtils
> 1>  1/ 48 Testing FileCMD0 .....................   Passed    0.55 sec
> 1>  2/ 48 Testing FileCMD1 .....................   Passed    1.58 sec
> 1>  3/ 48 Testing Test0 ........................   Passed    0.17 sec
> 1>  4/ 48 Testing Test1 ........................   Passed    0.16 sec
> 1>  5/ 48 Testing StringListArg0 ...............   Passed    0.06 sec
> 1>  6/ 48 Testing StringListArg1 ...............   Passed    0.06 sec
> 1>  7/ 48 Testing StringListOpt0 ...............   Passed    0.16 sec
> 1>  8/ 48 Testing StringListOpt1 ...............   Passed    0.06 sec
> 1>  9/ 48 Testing BoolOpt1 .....................   Passed    0.16 sec
> 1> 10/ 48 Testing BoolOpt2 .....................   Passed    0.14 sec
> 1> 11/ 48 Testing ExtBoolOpt1 ..................   Passed    0.25 sec
> 1> 12/ 48 Testing ExtBoolOpt2 ..................   Passed    0.16 sec
> 1> 13/ 48 Testing ExtBoolOpt3 ..................   Passed    0.06 sec
> 1> 14/ 48 Testing ExtBoolOpt4 ..................   Passed    0.16 sec
> 1> 15/ 48 Testing ExtBoolOpt5 ..................   Passed    0.17 sec
> 1> 16/ 48 Testing FloatArgs0 ...................   Passed    0.19 sec
> 1> 17/ 48 Testing FloatArgs1 ...................   Passed    0.06 sec
> 1> 18/ 48 Testing FloatArgs2 ...................   Passed    0.16 sec
> 1> 19/ 48 Testing FloatArgs3 ...................   Passed    0.16 sec
> 1> 20/ 48 Testing FloatArgs4 ...................   Passed    0.16 sec
> 1> 21/ 48 Testing FloatArgs5 ...................   Passed    0.16 sec
> 1> 22/ 48 Testing FloatArgs6 ...................   Passed    0.14 sec
> 1> 23/ 48 Testing FloatArgs7 ...................   Passed    0.16 sec
> 1> 24/ 48 Testing FloatArgs8 ...................   Passed    1.30 sec
> 1> 25/ 48 Testing DoubleArgs0 ..................   Passed    0.16 sec
> 1> 26/ 48 Testing DoubleArgs1 ..................   Passed    0.16 sec
> 1> 27/ 48 Testing DoubleArgs2 ..................   Passed    0.14 sec
> 1> 28/ 48 Testing DoubleArgs3 ..................   Passed    0.19 sec
> 1> 29/ 48 Testing DoubleArgs4 ..................   Passed    0.16 sec
> 1> 30/ 48 Testing DoubleArgs5 ..................   Passed    0.06 sec
> 1> 31/ 48 Testing DoubleArgs6 ..................   Passed    0.14 sec
> 1> 32/ 48 Testing DoubleArgs7 ..................   Passed    0.16 sec
> 1> 33/ 48 Testing DoubleArgs8 ..................   Passed    2.03 sec
> 1> 34/ 48 Testing XMLExport0 ...................   Passed    0.17 sec
> 1> 35/ 48 Testing XMLExport1 ...................   Passed    0.17 sec
> 1> 36/ 48 Testing XMLExport2 ...................   Passed    0.14 sec
> 1> 37/ 48 Testing XMLExport3 ...................   Passed    0.14 sec
> 1> 38/ 48 Testing XMLExport4 ...................   Passed    0.14 sec
> 1> 39/ 48 Testing XMLExport5 ...................   Passed    0.17 sec
> 1> 40/ 48 Testing XMLExport6 ...................   Passed    0.14 sec
> 1> 41/ 48 Testing UserProp0 ....................   Passed    0.14 sec
> 1> 42/ 48 Testing UserProp1 ....................   Passed    0.16 sec
> 1> 43/ 48 Testing UserProp2 ....................   Passed    0.06 sec
> 1> 44/ 48 Testing UserProp3 ....................   Passed    0.14 sec
> 1> 45/ 48 Testing UserProp4 ....................   Passed    0.16 sec
> 1> 46/ 48 Testing UserProp5 ....................   Passed    0.14 sec
> 1> 47/ 48 Testing UserProp6 ....................   Passed    0.22 sec
> 1> 48/ 48 Testing UserProp7 ....................   Passed    0.14 sec
> 1>100% tests passed, 0 tests failed out of 48
> 1>Total CPU time =  11.78 sec
> 1>Build log was saved at
> "file://x:\32Bit\VC.80\Qt\QtBasicUtils\RUN_TESTS.dir\RelWithDebInfo\BuildLog.htm"
> 1>RUN_TESTS - 0 error(s), 0 warning(s)
> ========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

_________________________________________________________________
Share your memories online with anyone you want.
http://www.microsoft.com/indonesia/windows/windowslive/products/photos-share.aspx?tab=1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090828/c1a1e726/attachment.htm>


More information about the CMake mailing list