[CMake] CTest integration in Visual Studio TestExplorer
Máté Ferenc Nagy-Egri
csiga.biga at aol.com
Thu Feb 4 11:51:17 EST 2016
Indeed, both RUN_TESTS and the CTest files exist, I have even found a file created by the add-in which seems to hold correct target names.
Recompiling will take some time, but will try to help with it.
----- Eredeti üzenet -----
Feladó: "Stuermer, Michael SP/HZA-ZSEP" <michael.stuermer at schaeffler.com>
Feladva: 2016.02.04. 16:27
Címzett: "Nagy-Egri Máté Ferenc" <csiga.biga at aol.com>; "cmake at cmake.org" <cmake at cmake.org>
Tárgy: RE: CTest integration in Visual Studio TestExplorer
Hi Máté,
thanks for trying the extension!
Some questions before going more into details:
- do you have a CTestTestfile.cmake in your build root i.e. where the.sln file is you have opened with Visual Studio?
- do you have a RUN_TESTS target/project in your visual studio solution? It could be in the “CMakePredefinedTargets” folder…
The basic concept of test discovery for the plugin is, to look for a CTestTestfile.cmake file in the same folder where the .sln file is. From there all CTestTestfile.cmake files are searched recursively and all tests which are defined by add_test() within the files are added to the test list.
There are some debug logging lines in the plugin, but I deactivated them for now. Unfortunately there is no option-page where you can switch the logging on/off (should move that to the top of the feature list). You could get the sources from github, enable logging, build your custom version and see what message you get.
The changes would be in “CTestExecutor.cs” (line 27) and “CTestDiscoverer.cs” (line 29). Change the line
public bool EnableLogging { get; set; } = false;
to
public bool EnableLogging { get; set; } = true;
further comments inline.
From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Nagy-Egri Máté Ferenc via CMake
Sent: Thursday, February 04, 2016 3:33 PM
To: cmake at cmake.org
Subject: Re: [CMake] CTest integration in Visual Studio TestExplorer
Hi Michael,
first of all, let me congratulate you on the integration. Great stuff and much apreciated.
I gave your add-in a spin, however it fails to find my unit tests. I set the output directory globally in the top-level CMakeLists.txt file as
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Build_Root}/bin/${Configuration_Name})
[>] this should be perfectly OK, ctest should take care for itself where to find the binaries to execute when testing.
inside my unit-tests’ file I have entries such as
# Adding library target for build
add_executable (STL-Test1-RK4 ${STL_Test1_RK4_BUILD})
…
# Add CTest entry
add_test( ${PROJECT_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/STL-Test1-RK4 )
[>] what do you mean by „unit-test file”? Is it just another CMakeLists.txt or cmake script in your cmake script tree? or is this some script you run using ctest? I am not familiar with the ctest scripting options and I am pretty sure this is not supported by the extension right now. It is mainly thought to provide the tests which are executed by the RUN_TESTS target within the test explorer and allow more comfortable separate test running from within VS.
I have configured my build to use VS2015 Win64 platform. Because the default is to look for x86 targets, I changed the default test platform to be x64 within VS, but it still won’t find my tests. Could you give some directions what might I be doing wrong?
[>] AFAIK you don’t have to switch any
[Az eredeti üzenetnek csak egy része van beillesztve.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160204/c784e02a/attachment.html>
More information about the CMake
mailing list