[CMake] Error in running tests
Petr Kmoch
petr.kmoch at gmail.com
Mon Apr 15 02:40:12 EDT 2013
The errors VS spews out aren't really useful. However, if you go to
${CMAKE_BINARY_DIR}/Testing/Temporary, there are log files. LastTest.log
should tell you a bit more.
Can you also try/report on my second question? (2. Does it work if you use
the enhanced signature of add_test? I mean 'add_test(NAME Test COMMAND
test_rev)')
Petr
On Mon, Apr 15, 2013 at 6:43 AM, Lloyd <lloydkl.tech at gmail.com> wrote:
>
> On Fri, Apr 12, 2013 at 5:00 PM, Lloyd <lloydkl.tech at gmail.com> wrote:
>
>> of course... This is the source of my test cmake file
>>
>> #Cmake file of Tests
>> cmake_minimum_required (VERSION 2.6)
>>
>> SET(TST_SRC test_rev.cpp test_runner.cpp)
>>
>> FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
>>
>> INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
>> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}../../src/lib/reverse)
>> ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
>> ADD_EXECUTABLE(test_rev ${TST_SRC})
>> TARGET_LINK_LIBRARIES(test_rev ${Boost_LIBRARIES})
>> TARGET_LINK_LIBRARIES(test_rev Reverse)
>>
>
>
> As a temporary solution to this I have copied the test executable and its
> dependent dlls to the root folder of the build directory. When I run
> "RUN_TETS" project in Visual Studio, it throws me some other error like
>
>
> ------ Build started: Project: RUN_TESTS, Configuration: Debug Win32 ------
> Test project E:/CMakeDemo/BuildDir
> Start 1: Test
> 1/1 Test #1: Test .............................***Failed 0.16 sec
>
> 0% tests passed, 1 tests failed out of 1
>
> Total Test time (real) = 2.42 sec
>
> The following tests FAILED:
> 1 - Test (Failed)
> Errors while running CTest
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: The command "setlocal
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: "C:\Program Files\CMake 2.8\bin\ctest.exe"
> --force-new-ctest-process -C Debug
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: if %errorlevel% neq 0 goto :cmEnd
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: :cmEnd
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: :cmErrorLevel
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: exit /b %1
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: :cmDone
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: if %errorlevel% neq 0 goto :VCEnd
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: :VCEnd" exited with code 8.
> ======== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>
> I cannot interpret these errors, can you please give some hint?
>
> Thanks,
> Lloyd
>
>
>
>
>>
>>
>> On Fri, Apr 12, 2013 at 4:55 PM, Petr Kmoch <petr.kmoch at gmail.com> wrote:
>>
>>> 1. Can you post tests/CMakeLists.txt (or at least the parts relevant to
>>> creating test_rev)?
>>>
>>> 2. Does it work if you use the enhanced signature of add_test? I mean
>>> 'add_test(NAME Test COMMAND test_rev)'
>>>
>>> Petr
>>>
>>>
>>> On Fri, Apr 12, 2013 at 1:18 PM, Lloyd <lloydkl.tech at gmail.com> wrote:
>>>
>>>> Yes I built the test and it is in
>>>>
>>>> E:\CMakeDemo\BuildDir\tests\Debug\test_rev.exe
>>>>
>>>> I don't know the right way to locate this test executable for cmake
>>>>
>>>> Thanks,
>>>> Lloyd
>>>>
>>>>
>>>>
>>>> On Fri, Apr 12, 2013 at 4:42 PM, Petr Kmoch <petr.kmoch at gmail.com>wrote:
>>>>
>>>>> Hi Lloyd.
>>>>>
>>>>> Do you actually have a target (executable) named "test_rev"? And have
>>>>> you built it before running RUN_TESTS? RUN_TEST (or its Makefile equivalent
>>>>> 'make test') doesn't automatically build the test executables before
>>>>> running them.
>>>>>
>>>>> Petr
>>>>>
>>>>>
>>>>> On Fri, Apr 12, 2013 at 1:08 PM, Lloyd <lloydkl.tech at gmail.com> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I was successful in creating and compiling a simple project
>>>>>> C++/Visual studio using cmake. I have also included one unit test project.
>>>>>> All these projects builds successfully. The test project source and main
>>>>>> project source resides in the root directory of the project. When I try to
>>>>>> run "RUN_TESTS" it gives me an error
>>>>>>
>>>>>> Test project E:/CMakeDemo/BuildDir
>>>>>> 1> Start 1: Test
>>>>>> 1> Could not find executable test_rev
>>>>>> 1> Looked in the following places:
>>>>>> 1> Unable to find executable: test_rev
>>>>>> 1> test_rev
>>>>>> 1> test_rev.exe
>>>>>> 1> Debug/test_rev
>>>>>> 1> Debug/test_rev.exe
>>>>>> 1> Debug/test_rev
>>>>>> 1> Debug/test_rev.exe
>>>>>> 1> 1/1 Test #1: Test .............................***Not Run 0.00
>>>>>> sec
>>>>>>
>>>>>> I have added the tests in my main cmake file as shown below
>>>>>>
>>>>>> #Root cmake file
>>>>>> cmake_minimum_required (VERSION 2.6)
>>>>>> PROJECT (Tutorial)
>>>>>>
>>>>>> ADD_SUBDIRECTORY(src/lib/reverse)
>>>>>> ADD_SUBDIRECTORY(src)
>>>>>> #SUBDIRS(src/lib/reverse src)
>>>>>>
>>>>>> ############################################################
>>>>>> SET (DO_TEST false CACHE BOOL "Enable Testing?")
>>>>>> if(DO_TEST)
>>>>>> MESSAGE (STATUS "Testing is enabled")
>>>>>> ENABLE_TESTING()
>>>>>> ADD_SUBDIRECTORY(tests)
>>>>>>
>>>>>>
>>>>>> ADD_TEST(Test test_rev)
>>>>>>
>>>>>>
>>>>>> endif(DO_TEST)
>>>>>> #############################################################
>>>>>>
>>>>>>
>>>>>> What am i missing here?
>>>>>>
>>>>>> Thanks a lot,
>>>>>> Lloyd
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> 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
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
> --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130415/ebf0e607/attachment-0001.htm>
More information about the CMake
mailing list