[CMake] make test missing

Marcel Loose loose at astron.nl
Tue Nov 9 04:02:35 EST 2010


On Mon, 2010-11-08 at 18:28 -0800, Alan W. Irwin wrote:
> On 2010-11-09 02:52+0100 Michael Hertling wrote:
> 
> > On 11/08/2010 10:03 PM, Jochen Issing wrote:
> >> Hi list,
> >>
> >> I tried to add ctest to my project and did this by adding
ENABLE_TESTING() and several ADD_TEST(...) to my CMakeLists.txt file.
> >> The tests are run on executables, which are built inside a
dedicated test directory in my project root and the execs show up in my
Makefile.
> >> After reading through some docs, I am told to call make test after
building. However, no target named 'test' is available.
> >
> > I.e. it doesn't show up in the listing of "make help"?
> >
> >> Here my question: Does my directory 'test' interfere with the
'test' rule or do I have to install the executables before testing or do
I still miss something?
> >
> > On *nix, I can see the following CMakeLists.txt work:
> >
> > CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
> > PROJECT(TEST C)
> > ENABLE_TESTING()
> > FILE(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/test
${CMAKE_BINARY_DIR}/test)
> > FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "int main(void){return 0;}\n")
> > ADD_EXECUTABLE(main main.c)
> > SET_TARGET_PROPERTIES(
> >    main
> >    PROPERTIES
> >    RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test
> > )
> > ADD_TEST(NAME main COMMAND main)
> >
> > The output of "make test" - without installation - is:
> >
> > Running tests...
> > Test project /home/hertling/work/cmake/issing/obj
> >    Start 1: main
> > 1/1 Test #1: main .............................   Passed    0.00 sec
> >
> > 100% tests passed, 0 tests failed out of 1
> >
> > Total Test time (real) =   0.11 sec
> >
> > So, I'd conclude the "test" directories' presence doesn't matter,
> > nor does the fact if an installation has already been performed.
> 
> In the past this mattered a lot so the PLplot project had to rename
> our test source tree directory to plplot_test to avoid the clash with
> the name of the test target.
> 
> It is possible your example above is not complicated
> enough to trigger the clash.  For example, your test
> subdirectories are just created, but you do not have an
> add_subdirectory(test) command to actually run cmake within that
> test subdirectory.
> 
> So I would suggest to the OP that they do rename their test directory
> to something else because I am pretty sure that will solve the issue.
> Until PLplot did that (for a much earlier version of CMake) "make
> test" failed to work for us.
> 
> Alan
> 
> 
> 
> >
> > Maybe, you could post your CMakeLists.txt for further inspection.
> >
> > Regards,
> >
> > Michael
> >
> >> Anyhow, 'ctest -D Experimental' seems to do something :/
> >>
> >> Also, I am not sure if I need to setup a Dashboard-Server to use
testing at all. I suppose it's possible without a dashboard, but don't
know how.
> >> Thanks in advance!
> >> Cheers,
> >>
> >> - jochen
> >> gpg: 1024D/013400C7
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
> >
> 
> __________________________
> 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
> __________________________

Hi Alan and others,

We have lots of directories named 'test' that contain test programs. I
add them with add_subdirectory() and never ran into problems of target
'test' not existing. My assumption is that there's something else going
wrong here.

Best regards,
Marcel Loose.



More information about the CMake mailing list