| 10 | #include "cmSystemTools.h" |
| 11 | |
| 12 | bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args, |
| 13 | cmExecutionStatus& status) const |
| 14 | { |
| 15 | if (args.empty()) { |
| 16 | status.SetError("called with incorrect number of arguments"); |
| 17 | return false; |
| 18 | } |
| 19 | |
| 20 | cmMakefile& mf = status.GetMakefile(); |
| 21 | bool np = false; |
| 22 | unsigned int i = 0; |
| 23 | if (args[i] == "NEW_PROCESS") { |
| 24 | np = true; |
| 25 | i++; |
| 26 | } |
| 27 | int start = i; |
| 28 | // run each script |
| 29 | std::string returnVariable; |
| 30 | for (i = start; i < args.size(); ++i) { |
| 31 | if (args[i] == "RETURN_VALUE") { |
| 32 | ++i; |
| 33 | if (i < args.size()) { |
| 34 | returnVariable = args[i]; |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | for (i = start; i < args.size(); ++i) { |
| 39 | if (args[i] == "RETURN_VALUE") { |
| 40 | ++i; |
| 41 | } else { |
| 42 | int ret; |
| 43 | cmCTestScriptHandler::RunScript( |
| 44 | this->CTest, &mf, cmSystemTools::CollapseFullPath(args[i]), !np, &ret); |
| 45 | mf.AddDefinition(returnVariable, std::to_string(ret)); |
| 46 | } |
| 47 | } |
| 48 | return true; |
| 49 | } |
nothing calls this directly
no test coverage detected