MantisBT - CMake
View Issue Details
0015599CMakeCTestpublic2015-06-01 05:352016-06-10 14:31
trsystran 
Kitware Robot 
normalminoralways
closedmoved 
CMake 3.2.2 
 
0015599: CTEST_USE_LAUNCHERS drops diagnostics generated by the build tool
When the build command fails (returns a non-zero return code), CTest creates a ~fake warning in cmCTestBuildHandler::RunMakeCommand: "this->ErrorsAndWarnings.push_back(errorwarning);".

(Sub-question: Why is it a Warning and not an Error? all non-zero return code should be errors)

Then, normally the "ErrorsAndWarnings" object is parsed and converted to "Build.xml" in cmCTestBuildHandler::GenerateXMLLogScraped.
However, when CTest is run with Launchers enabled, then GenerateXMLLogScraped is never called: cmCTestBuildHandler::GenerateXMLLaunched is called instead, using a different source of information for errors and warnings: the xml files generated by ctest in launcher mode.

This means that the build return code value is ignored.


Why is it an issue when we have launchers?
Because launchers only catch build errors as they wrap the compiler command.
If the generator fails early (ie before executing any build command), then the ctest launchers won't catch anything here.

It happens with the Ninja generator, when we import an external lib, but forcing an invalid path to the lib.
$ cmake . -G Ninja -DCTEST_USE_LAUNCHERS=ON
$ ninja
ninja: error: '/invalid/path/to/libmissingLib.so', needed by 'executableFailed', missing and no known rule to make it

No call to ctest in launcher mode confirmed with "strace -f ninja |& grep ctest".


When launched via a real ctest flow:
Build project
MakeCommand:ninja -k0 -l34 all
Run command: "ninja" "-k0" "-l34" "all"
   Each symbol represents 1024 bytes of output.
    .ninja: error: '/invalid/path/to/libmissingLib.so', needed by 'executableFailed', missing and no known rule to make it
 Size of output: 0K
Command exited with the value: 1
MakeCommand:ninja -k0 -l34 all
Error(s) when building project
   0 Compiler errors
   1 Compiler warnings

But the Build.xml has no error nor warning: no issue is pushed to cdash.
There are probably many other cases of early generator failure (for example if a source file goes missing between cmake configuration and build), at least with Ninja.
No tags attached.
txt CMakeLists.txt (278) 2015-06-01 05:35
https://public.kitware.com/Bug/file/5466/CMakeLists.txt
c main.c (48) 2015-06-01 05:35
https://public.kitware.com/Bug/file/5467/main.c
Issue History
2015-06-01 05:35trsystranNew Issue
2015-06-01 05:35trsystranFile Added: CMakeLists.txt
2015-06-01 05:35trsystranFile Added: main.c
2015-06-01 09:07Brad KingAssigned To => Zack Galbreath
2015-06-01 09:07Brad KingStatusnew => assigned
2015-06-04 09:59Brad KingTarget Version => CMake 3.4
2015-07-30 11:28Brad KingAssigned ToZack Galbreath =>
2015-07-30 11:28Brad KingStatusassigned => backlog
2015-07-30 11:28Brad KingTarget VersionCMake 3.4 =>
2015-07-30 11:28Brad KingSummaryCTest with launchers drops warning generated by early build command failure => CTEST_USE_LAUNCHERS drops diagnostics generated by the build tool
2015-07-30 11:32Brad KingNote Added: 0039198
2016-06-10 14:29Kitware RobotNote Added: 0042788
2016-06-10 14:29Kitware RobotStatusbacklog => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039198)
Brad King   
2015-07-30 11:32   
This may be challenging to address because in order to report diagnostics from the build tool we need to scrape its output, but the output also contains the diagnostics that are captured by the launchers. In the case of ExternalProject the custom commands used to drive external build tools are scraped by the launchers too, so even trying to filter on tools-specific output like "ninja:" may not work reliably.
(0042788)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.