[Cmake-commits] [cmake-commits] hoffman committed cmCTestRunScriptCommand.cxx 1.7 1.8 cmCTestRunScriptCommand.h 1.5 1.6 cmCTestScriptHandler.cxx 1.53 1.54 cmCTestScriptHandler.h 1.22 1.23
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Sep 4 13:24:28 EDT 2009
Update of /cvsroot/CMake/CMake/Source/CTest
In directory public:/mounts/ram/cvs-serv13847/Source/CTest
Modified Files:
cmCTestRunScriptCommand.cxx cmCTestRunScriptCommand.h
cmCTestScriptHandler.cxx cmCTestScriptHandler.h
Log Message:
Change run_ctest_script in ctest to not stop processing when there is an error in the script being run. Also, add a RETURN_VALUE option so that you can find out if the script failed
Index: cmCTestRunScriptCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunScriptCommand.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** cmCTestRunScriptCommand.cxx 23 Jan 2008 15:28:01 -0000 1.7
--- cmCTestRunScriptCommand.cxx 4 Sep 2009 17:24:25 -0000 1.8
***************
*** 35,42 ****
i++;
}
// run each script
! for (; i < args.size(); ++i)
{
! cmCTestScriptHandler::RunScript(this->CTest, args[i].c_str(), !np);
}
return true;
--- 35,67 ----
i++;
}
+ int start = i;
// run each script
! std::string returnVariable;
! for (i = start; i < args.size(); ++i)
{
! if(args[i] == "RETURN_VALUE")
! {
! ++i;
! if(i < args.size())
! {
! returnVariable = args[i];
! }
! }
! }
! for (i = start; i < args.size(); ++i)
! {
! if(args[i] == "RETURN_VALUE")
! {
! ++i;
! }
! else
! {
! int ret;
! cmCTestScriptHandler::RunScript(this->CTest, args[i].c_str(), !np,
! &ret);
! cmOStringStream str;
! str << ret;
! this->Makefile->AddDefinition(returnVariable.c_str(), str.str().c_str());
! }
}
return true;
Index: cmCTestRunScriptCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestRunScriptCommand.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C 2 -d -r1.5 -r1.6
*** cmCTestRunScriptCommand.h 12 May 2008 13:11:51 -0000 1.5
--- cmCTestRunScriptCommand.h 4 Sep 2009 17:24:25 -0000 1.6
***************
*** 70,82 ****
return
" ctest_run_script([NEW_PROCESS] script_file_name script_file_name1 \n"
! " script_file_name2 ...)\n"
"Runs a script or scripts much like if it was run from ctest -S. "
"If no argument is provided then the current script is run using "
"the current settings of the variables. If NEW_PROCESS is specified "
! "then each script will be run in a seperate process.";
}
cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand);
-
};
--- 70,83 ----
return
" ctest_run_script([NEW_PROCESS] script_file_name script_file_name1 \n"
! " script_file_name2 ... [RETURN_VALUE var])\n"
"Runs a script or scripts much like if it was run from ctest -S. "
"If no argument is provided then the current script is run using "
"the current settings of the variables. If NEW_PROCESS is specified "
! "then each script will be run in a seperate process."
! "If RETURN_VALUE is specified the return value of the last script "
! "run will be put into var.";
}
cmTypeMacro(cmCTestRunScriptCommand, cmCTestCommand);
};
Index: cmCTestScriptHandler.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestScriptHandler.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C 2 -d -r1.22 -r1.23
*** cmCTestScriptHandler.h 11 Jul 2009 20:30:18 -0000 1.22
--- cmCTestScriptHandler.h 4 Sep 2009 17:24:25 -0000 1.23
***************
*** 83,87 ****
* Run a script
*/
! static bool RunScript(cmCTest* ctest, const char *script, bool InProcess);
int RunCurrentScript();
--- 83,88 ----
* Run a script
*/
! static bool RunScript(cmCTest* ctest, const char *script, bool InProcess,
! int* returnValue);
int RunCurrentScript();
Index: cmCTestScriptHandler.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CTest/cmCTestScriptHandler.cxx,v
retrieving revision 1.53
retrieving revision 1.54
diff -C 2 -d -r1.53 -r1.54
*** cmCTestScriptHandler.cxx 31 Jul 2009 13:19:19 -0000 1.53
--- cmCTestScriptHandler.cxx 4 Sep 2009 17:24:25 -0000 1.54
***************
*** 446,449 ****
--- 446,453 ----
<< script.c_str()
<< std::endl);
+ // Reset the error flag so that it can run more than
+ // one script with an error when you
+ // use ctest_run_script
+ cmSystemTools::ResetErrorOccuredFlag();
return 2;
}
***************
*** 1031,1040 ****
bool cmCTestScriptHandler::RunScript(cmCTest* ctest, const char *sname,
! bool InProcess)
{
cmCTestScriptHandler* sh = new cmCTestScriptHandler();
sh->SetCTestInstance(ctest);
sh->AddConfigurationScript(sname,InProcess);
! sh->ProcessHandler();
delete sh;
return true;
--- 1035,1048 ----
bool cmCTestScriptHandler::RunScript(cmCTest* ctest, const char *sname,
! bool InProcess, int* returnValue)
{
cmCTestScriptHandler* sh = new cmCTestScriptHandler();
sh->SetCTestInstance(ctest);
sh->AddConfigurationScript(sname,InProcess);
! int res = sh->ProcessHandler();
! if(returnValue)
! {
! *returnValue = res;
! }
delete sh;
return true;
More information about the Cmake-commits
mailing list