MantisBT - CMake
View Issue Details
0015610CMakeCTestpublic2015-06-11 06:102016-01-04 11:51
trsystran 
Brad King 
normalminorhave not tried
closedfixed 
CMake 3.2.3 
CMake 3.4CMake 3.4 
0015610: ctest_update can fail without returning -1 as RETURN_VALUE
A ctest_update running git fetch failed:
Update command failed: "git" "fetch"

From the LastUpdate*.log:
fetch-err> fatal: Unable to create 'E:/repo/.git/refs/remotes/origin/master.lock': File exists.

But in the CTest script we check for error:

ctest_update(RETURN_VALUE res)
if(res LESS 0) # stop if update error
  ctest_submit(PARTS Notes Update)
  return()
endif()


According to the documentation (http://www.cmake.org/cmake/help/v3.2/command/ctest_update.html [^]) ctest_update must return -1 in such case. It didn't.


The issue is in Sources/CTest/cmCTestUpdateHandler.cxx:292: "return numUpdated;"
numUpdated is always returned, even in case of update error: the bool "update" should be used to return -1
No tags attached.
related to 0013583closed Kitware Robot would like more info in cdash if the svn update command failed 
related to 0008262closed Bill Hoffman ctest_update() not catching all errors 
Issue History
2015-06-11 06:10trsystranNew Issue
2015-06-11 09:11Clinton StimpsonNote Added: 0038908
2015-06-11 09:12Clinton StimpsonRelationship addedrelated to 0013583
2015-06-11 09:12Clinton StimpsonRelationship addedrelated to 0008262
2015-06-11 10:21trsystranNote Added: 0038909
2015-06-11 11:17Brad KingNote Added: 0038910
2015-06-11 11:17Brad KingAssigned To => Brad King
2015-06-11 11:17Brad KingStatusnew => resolved
2015-06-11 11:17Brad KingResolutionopen => fixed
2015-06-11 11:17Brad KingFixed in Version => CMake 3.4
2015-06-11 11:17Brad KingTarget Version => CMake 3.4
2015-06-11 11:23trsystranNote Added: 0038911
2015-06-11 11:39Brad KingNote Added: 0038912
2016-01-04 11:51Robert MaynardNote Added: 0040065
2016-01-04 11:51Robert MaynardStatusresolved => closed

Notes
(0038908)
Clinton Stimpson   
2015-06-11 09:11   
Personally, I'd like to see these kinds of errors show up on cdash if doing this:

ctest_update(RETURN_VALUE res)
ctest_submit(PARTS Notes Update)
if(res LESS 0) # stop if update error
  return()
endif()
(0038909)
trsystran   
2015-06-11 10:21   
The error is stored in the Update.xml, it's just not returned from the c++ method, and thus not returned as RETURN_VALUE in the CTest script.

I'm not sure if it shows up as an error in cdash though.
(0038910)
Brad King   
2015-06-11 11:17   
Here is a fix and a test case for the issue reported here:

 ctest_update: Fix RETURN_VALUE on VCS tool failure
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=493388ce [^]
(0038911)
trsystran   
2015-06-11 11:23   
Thanks!

Does it also cover the error cases where there are locally modified files?

Maybe it's not an error, I don't know the ctest_update choice for locally modified, and locally modified conflicts.

Could it be also added to 3.3? It's a useful and trivial bug fix.
(0038912)
Brad King   
2015-06-11 11:39   
Re 0015610:0038911: Sorry, we do not typically make non-regression fixes in a released version after rc1 has been announced. One never knows when a change, no matter how trivial, may break someone's workflow in an unexpected way.

The change makes no difference with respect to locally modified files. That is not a failure to update.
(0040065)
Robert Maynard   
2016-01-04 11:51   
Closing resolved issues that have not been updated in more than 4 months.