| 117 | } |
| 118 | |
| 119 | bool cmCTestHandlerCommand::ExecuteHandlerCommand( |
| 120 | HandlerArguments& args, cmExecutionStatus& status) const |
| 121 | { |
| 122 | cmMakefile& mf = status.GetMakefile(); |
| 123 | |
| 124 | // Process input arguments. |
| 125 | this->CheckArguments(args, status); |
| 126 | |
| 127 | // Set the config type of this ctest to the current value of the |
| 128 | // CTEST_CONFIGURATION_TYPE script variable if it is defined. |
| 129 | // The current script value trumps the -C argument on the command |
| 130 | // line. |
| 131 | cmValue ctestConfigType = mf.GetDefinition("CTEST_CONFIGURATION_TYPE"); |
| 132 | if (ctestConfigType) { |
| 133 | this->CTest->SetConfigType(*ctestConfigType); |
| 134 | } |
| 135 | |
| 136 | if (!args.Build.empty()) { |
| 137 | this->CTest->SetCTestConfiguration( |
| 138 | "BuildDirectory", cmSystemTools::CollapseFullPath(args.Build), |
| 139 | args.Quiet); |
| 140 | } else { |
| 141 | std::string const& bdir = mf.GetSafeDefinition("CTEST_BINARY_DIRECTORY"); |
| 142 | if (!bdir.empty()) { |
| 143 | this->CTest->SetCTestConfiguration( |
| 144 | "BuildDirectory", cmSystemTools::CollapseFullPath(bdir), args.Quiet); |
| 145 | } else { |
| 146 | cmCTestLog(this->CTest, ERROR_MESSAGE, |
| 147 | "CTEST_BINARY_DIRECTORY not set" << std::endl); |
| 148 | } |
| 149 | } |
| 150 | if (!args.Source.empty()) { |
| 151 | cmCTestLog(this->CTest, DEBUG, |
| 152 | "Set source directory to: " << args.Source << std::endl); |
| 153 | this->CTest->SetCTestConfiguration( |
| 154 | "SourceDirectory", cmSystemTools::CollapseFullPath(args.Source), |
| 155 | args.Quiet); |
| 156 | } else { |
| 157 | this->CTest->SetCTestConfiguration( |
| 158 | "SourceDirectory", |
| 159 | cmSystemTools::CollapseFullPath( |
| 160 | mf.GetSafeDefinition("CTEST_SOURCE_DIRECTORY")), |
| 161 | args.Quiet); |
| 162 | } |
| 163 | |
| 164 | if (cmValue changeId = mf.GetDefinition("CTEST_CHANGE_ID")) { |
| 165 | this->CTest->SetCTestConfiguration("ChangeId", *changeId, args.Quiet); |
| 166 | } |
| 167 | |
| 168 | cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl); |
| 169 | auto handler = this->InitializeHandler(args, status); |
| 170 | if (!handler) { |
| 171 | cmCTestLog(this->CTest, ERROR_MESSAGE, |
| 172 | "Cannot instantiate test handler " << this->GetName() |
| 173 | << std::endl); |
| 174 | return false; |
| 175 | } |
| 176 |
no test coverage detected