[Cmake-commits] [cmake-commits] hoffman committed cmCTestBuildCommand.cxx 1.18 1.19 cmCTestBuildCommand.h 1.6 1.7 cmCTestBuildHandler.cxx 1.65 1.66 cmCTestBuildHandler.h 1.13 1.14 cmProcess.cxx 1.4 1.5
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Jan 14 13:01:41 EST 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv27191
Modified Files:
cmCTestBuildCommand.cxx cmCTestBuildCommand.h
cmCTestBuildHandler.cxx cmCTestBuildHandler.h cmProcess.cxx
Log Message:
ENH: allow ctest_build to return error and warning counts
Index: cmProcess.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmProcess.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -C 2 -d -r1.4 -r1.5
*** cmProcess.cxx 29 Dec 2008 22:49:17 -0000 1.4
--- cmProcess.cxx 14 Jan 2009 18:01:38 -0000 1.5
***************
*** 214,218 ****
this->ExitValue = cmsysProcess_GetExitValue(this->Process);
this->TotalTime = cmSystemTools::GetTime() - this->StartTime;
! // std::cerr << "Time to run: " << this->TotalTime << "\n";
return false;
}
--- 214,218 ----
this->ExitValue = cmsysProcess_GetExitValue(this->Process);
this->TotalTime = cmSystemTools::GetTime() - this->StartTime;
! std::cerr << "Time to run: " << this->TotalTime << "\n";
return false;
}
Index: cmCTestBuildHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildHandler.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C 2 -d -r1.13 -r1.14
*** cmCTestBuildHandler.h 30 Jan 2008 16:17:36 -0000 1.13
--- cmCTestBuildHandler.h 14 Jan 2009 18:01:38 -0000 1.14
***************
*** 50,53 ****
--- 50,55 ----
virtual void Initialize();
+ int GetTotalErrors() { return this->TotalErrors;}
+ int GetTotalWarnings() { return this->TotalWarnings;}
private:
//! Run command specialized for make and configure. Returns process status
Index: cmCTestBuildHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildHandler.cxx,v
retrieving revision 1.65
retrieving revision 1.66
diff -C 2 -d -r1.65 -r1.66
*** cmCTestBuildHandler.cxx 12 Jan 2009 15:37:55 -0000 1.65
--- cmCTestBuildHandler.cxx 14 Jan 2009 18:01:38 -0000 1.66
***************
*** 476,480 ****
this->GenerateDartBuildOutput(
xofs, this->ErrorsAndWarnings, elapsed_build_time);
! return 0;
}
--- 476,480 ----
this->GenerateDartBuildOutput(
xofs, this->ErrorsAndWarnings, elapsed_build_time);
! return res;
}
***************
*** 725,728 ****
--- 725,729 ----
this->ErrorsAndWarnings.push_back(errorwarning);
this->TotalWarnings ++;
+ return *retVal; // return the program return value
}
}
***************
*** 735,738 ****
--- 736,740 ----
cmCTestLog(this->CTest, WARNING, "There was an exception: " << *retVal
<< std::endl);
+ return *retVal;
}
}
***************
*** 740,743 ****
--- 742,746 ----
{
cmCTestLog(this->CTest, WARNING, "There was a timeout" << std::endl);
+ return -1;
}
else if(result == cmsysProcess_State_Error)
***************
*** 755,763 ****
cmCTestLog(this->CTest, ERROR_MESSAGE, "There was an error: "
<< cmsysProcess_GetErrorString(cp) << std::endl);
}
cmsysProcess_Delete(cp);
! return result;
}
--- 758,767 ----
cmCTestLog(this->CTest, ERROR_MESSAGE, "There was an error: "
<< cmsysProcess_GetErrorString(cp) << std::endl);
+ return -1;
}
cmsysProcess_Delete(cp);
! return 0;
}
Index: cmCTestBuildCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildCommand.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -C 2 -d -r1.18 -r1.19
*** cmCTestBuildCommand.cxx 17 Sep 2007 14:40:57 -0000 1.18
--- cmCTestBuildCommand.cxx 14 Jan 2009 18:01:38 -0000 1.19
***************
*** 19,22 ****
--- 19,23 ----
#include "cmCTest.h"
#include "cmCTestGenericHandler.h"
+ #include "cmCTestBuildHandler.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
***************
*** 27,30 ****
--- 28,35 ----
{
this->GlobalGenerator = 0;
+ this->Arguments[ctb_NUMBER_ERRORS] = "NUMBER_ERRORS";
+ this->Arguments[ctb_NUMBER_WARNINGS] = "NUMBER_WARNINGS";
+ this->Arguments[ctb_LAST] = 0;
+ this->Last = ctb_LAST;
}
***************
*** 49,53 ****
return 0;
}
!
const char* ctestBuildCommand
= this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
--- 54,58 ----
return 0;
}
! this->Handler = (cmCTestBuildHandler*)handler;
const char* ctestBuildCommand
= this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
***************
*** 133,134 ****
--- 138,160 ----
+ bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
+ cmExecutionStatus &status)
+ {
+ bool ret = cmCTestHandlerCommand::InitialPass(args, status);
+ if ( this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS])
+ {
+ cmOStringStream str;
+ str << this->Handler->GetTotalErrors();
+ this->Makefile->AddDefinition(
+ this->Values[ctb_NUMBER_ERRORS], str.str().c_str());
+ }
+ if ( this->Values[ctb_NUMBER_WARNINGS]
+ && *this->Values[ctb_NUMBER_WARNINGS])
+ {
+ cmOStringStream str;
+ str << this->Handler->GetTotalWarnings();
+ this->Makefile->AddDefinition(
+ this->Values[ctb_NUMBER_WARNINGS], str.str().c_str());
+ }
+ return ret;
+ }
Index: cmCTestBuildCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestBuildCommand.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C 2 -d -r1.6 -r1.7
*** cmCTestBuildCommand.h 12 May 2008 13:11:51 -0000 1.6
--- cmCTestBuildCommand.h 14 Jan 2009 18:01:38 -0000 1.7
***************
*** 21,24 ****
--- 21,25 ----
class cmGlobalGenerator;
+ class cmCTestBuildHandler;
/** \class cmCTestBuild
***************
*** 57,61 ****
return "Builds the repository.";
}
!
/**
* More documentation.
--- 58,63 ----
return "Builds the repository.";
}
! virtual bool InitialPass(std::vector<std::string> const& args,
! cmExecutionStatus &status);
/**
* More documentation.
***************
*** 64,68 ****
{
return
! " ctest_build([BUILD build_dir] [RETURN_VALUE res])\n"
"Builds the given build directory and stores results in Build.xml.";
}
--- 66,71 ----
{
return
! " ctest_build([BUILD build_dir] [RETURN_VALUE res] "
! " [NUMBER_ERRORS val] [NUMBER_WARNINGS val])\n"
"Builds the given build directory and stores results in Build.xml.";
}
***************
*** 73,76 ****
--- 76,87 ----
protected:
+ cmCTestBuildHandler* Handler;
+ enum {
+ ctb_BUILD = ct_LAST,
+ ctb_NUMBER_ERRORS,
+ ctb_NUMBER_WARNINGS,
+ ctb_LAST
+ };
+
cmCTestGenericHandler* InitializeHandler();
};
More information about the Cmake-commits
mailing list