summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-28 12:25:41 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-07-28 12:25:47 (GMT)
commit79d341d4d45018641ede514fb8b41a18ab982bc5 (patch)
tree4ad3eb8ad08a44e98ae48ae893a267a3c65dc9c6 /Source/CTest
parent231d39da40fc21d2b2c90d776d4057cd1ddf883a (diff)
parent825b04c67ac7ff3f759fd474e9a16b3b6076d591 (diff)
downloadCMake-79d341d4d45018641ede514fb8b41a18ab982bc5.zip
CMake-79d341d4d45018641ede514fb8b41a18ab982bc5.tar.gz
CMake-79d341d4d45018641ede514fb8b41a18ab982bc5.tar.bz2
Merge topic 'cmctest-stdstring'
825b04c67a cmCTest: Members accept std::string parameters Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5064
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx10
-rw-r--r--Source/CTest/cmCTestBuildCommand.cxx21
-rw-r--r--Source/CTest/cmCTestConfigureCommand.cxx19
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx21
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx2
-rw-r--r--Source/CTest/cmCTestHandlerCommand.cxx21
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx2
-rw-r--r--Source/CTest/cmCTestReadCustomFilesCommand.cxx2
-rw-r--r--Source/CTest/cmCTestRunTest.cxx8
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx5
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx12
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx2
-rw-r--r--Source/CTest/cmCTestTestCommand.cxx7
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx12
-rw-r--r--Source/CTest/cmCTestTestHandler.h5
-rw-r--r--Source/CTest/cmCTestUpdateCommand.cxx5
16 files changed, 74 insertions, 80 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index db426b2..a18cbb4 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -182,10 +182,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::vector<std::string> extraPaths;
std::vector<std::string> failed;
fullPath = cmCTestTestHandler::FindExecutable(
- this->CTest, this->ConfigSample.c_str(), resultingConfig, extraPaths,
- failed);
+ this->CTest, this->ConfigSample, resultingConfig, extraPaths, failed);
if (!fullPath.empty() && !resultingConfig.empty()) {
- this->CTest->SetConfigType(resultingConfig.c_str());
+ this->CTest->SetConfigType(resultingConfig);
}
out << "Using config sample with results: " << fullPath << " and "
<< resultingConfig << std::endl;
@@ -296,9 +295,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
extraPaths.push_back(tempPath);
}
std::vector<std::string> failed;
- fullPath =
- cmCTestTestHandler::FindExecutable(this->CTest, this->TestCommand.c_str(),
- resultingConfig, extraPaths, failed);
+ fullPath = cmCTestTestHandler::FindExecutable(
+ this->CTest, this->TestCommand, resultingConfig, extraPaths, failed);
if (!cmSystemTools::FileExists(fullPath)) {
out << "Could not find path to executable, perhaps it was not built: "
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx
index 44fdc29..f33bdc4 100644
--- a/Source/CTest/cmCTestBuildCommand.cxx
+++ b/Source/CTest/cmCTestBuildCommand.cxx
@@ -12,6 +12,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -38,10 +39,9 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
this->Handler = handler;
- const char* ctestBuildCommand =
- this->Makefile->GetDefinition("CTEST_BUILD_COMMAND");
- if (ctestBuildCommand && *ctestBuildCommand) {
- this->CTest->SetCTestConfiguration("MakeCommand", ctestBuildCommand,
+ cmProp ctestBuildCommand = this->Makefile->GetDef("CTEST_BUILD_COMMAND");
+ if (cmNonempty(ctestBuildCommand)) {
+ this->CTest->SetCTestConfiguration("MakeCommand", *ctestBuildCommand,
this->Quiet);
} else {
const char* cmakeGeneratorName =
@@ -108,7 +108,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"SetMakeCommand:" << buildCommand << "\n",
this->Quiet);
- this->CTest->SetCTestConfiguration("MakeCommand", buildCommand.c_str(),
+ this->CTest->SetCTestConfiguration("MakeCommand", buildCommand,
this->Quiet);
} else {
std::ostringstream ostr;
@@ -123,16 +123,15 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
}
}
- if (const char* useLaunchers =
- this->Makefile->GetDefinition("CTEST_USE_LAUNCHERS")) {
- this->CTest->SetCTestConfiguration("UseLaunchers", useLaunchers,
+ if (cmProp useLaunchers = this->Makefile->GetDef("CTEST_USE_LAUNCHERS")) {
+ this->CTest->SetCTestConfiguration("UseLaunchers", *useLaunchers,
this->Quiet);
}
- if (const char* labelsForSubprojects =
- this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ if (cmProp labelsForSubprojects =
+ this->Makefile->GetDef("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
- labelsForSubprojects, this->Quiet);
+ *labelsForSubprojects, this->Quiet);
}
handler->SetQuiet(this->Quiet);
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index f42c3f1..8716b31 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -12,6 +12,7 @@
#include "cmCTestConfigureHandler.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
@@ -38,12 +39,12 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
return nullptr;
}
- const char* ctestConfigureCommand =
- this->Makefile->GetDefinition("CTEST_CONFIGURE_COMMAND");
+ cmProp ctestConfigureCommand =
+ this->Makefile->GetDef("CTEST_CONFIGURE_COMMAND");
- if (ctestConfigureCommand && *ctestConfigureCommand) {
+ if (cmNonempty(ctestConfigureCommand)) {
this->CTest->SetCTestConfiguration("ConfigureCommand",
- ctestConfigureCommand, this->Quiet);
+ *ctestConfigureCommand, this->Quiet);
} else {
const char* cmakeGeneratorName =
this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR");
@@ -125,8 +126,8 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
cmakeConfigureCommand += source_dir;
cmakeConfigureCommand += "\"";
- this->CTest->SetCTestConfiguration(
- "ConfigureCommand", cmakeConfigureCommand.c_str(), this->Quiet);
+ this->CTest->SetCTestConfiguration("ConfigureCommand",
+ cmakeConfigureCommand, this->Quiet);
} else {
this->SetError(
"Configure command is not specified. If this is a "
@@ -136,10 +137,10 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
}
}
- if (const char* labelsForSubprojects =
- this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ if (cmProp labelsForSubprojects =
+ this->Makefile->GetDef("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
- labelsForSubprojects, this->Quiet);
+ *labelsForSubprojects, this->Quiet);
}
cmCTestConfigureHandler* handler = this->CTest->GetConfigureHandler();
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index b839c10..093b2d1 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -469,8 +469,8 @@ int cmCTestCoverageHandler::ProcessHandler()
}
const std::string fileName = cmSystemTools::GetFilenameName(fullFileName);
- std::string shortFileName =
- this->CTest->GetShortPathToFile(fullFileName.c_str());
+ const std::string shortFileName =
+ this->CTest->GetShortPathToFile(fullFileName);
const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov =
file.second;
covLogXML.StartElement("File");
@@ -538,7 +538,7 @@ int cmCTestCoverageHandler::ProcessHandler()
covSumXML.StartElement("File");
covSumXML.Attribute("Name", fileName);
covSumXML.Attribute("FullPath",
- this->CTest->GetShortPathToFile(fullFileName.c_str()));
+ this->CTest->GetShortPathToFile(fullFileName));
covSumXML.Attribute("Covered", tested + untested > 0 ? "true" : "false");
covSumXML.Element("LOCTested", tested);
covSumXML.Element("LOCUnTested", untested);
@@ -1887,8 +1887,8 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
// start the file output
covLogXML.StartElement("File");
covLogXML.Attribute("Name", i->first);
- covLogXML.Attribute(
- "FullPath", this->CTest->GetShortPathToFile(i->second.c_str()));
+ covLogXML.Attribute("FullPath",
+ this->CTest->GetShortPathToFile(i->second));
covLogXML.StartElement("Report");
// write the bullseye header
line = 0;
@@ -2064,8 +2064,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
total_untested += (totalFunctions - functionsCalled);
std::string fileName = cmSystemTools::GetFilenameName(file);
- std::string shortFileName =
- this->CTest->GetShortPathToFile(file.c_str());
+ std::string shortFileName = this->CTest->GetShortPathToFile(file);
float cper = static_cast<float>(percentBranch + percentFunction);
if (totalBranches > 0) {
@@ -2266,7 +2265,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
// is the end of the target-wide labels.
inTarget = false;
- source = this->CTest->GetShortPathToFile(line.c_str());
+ source = this->CTest->GetShortPathToFile(line);
// Label the source with the target labels.
LabelSet& labelSet = this->SourceLabels[source];
@@ -2320,7 +2319,7 @@ bool cmCTestCoverageHandler::IsFilteredOut(std::string const& source)
// The source is filtered out if it does not have any labels in
// common with the filter set.
- std::string shortSrc = this->CTest->GetShortPathToFile(source.c_str());
+ std::string shortSrc = this->CTest->GetShortPathToFile(source);
auto li = this->SourceLabels.find(shortSrc);
if (li != this->SourceLabels.end()) {
return !this->IntersectsFilter(li->second);
@@ -2342,14 +2341,14 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles(
std::vector<std::string> files = gl.GetFiles();
for (std::string const& f : files) {
if (this->ShouldIDoCoverage(f, cont->SourceDir, cont->BinaryDir)) {
- extraMatches.insert(this->CTest->GetShortPathToFile(f.c_str()));
+ extraMatches.insert(this->CTest->GetShortPathToFile(f));
}
}
}
if (!extraMatches.empty()) {
for (auto const& i : cont->TotalCoverage) {
- std::string shortPath = this->CTest->GetShortPathToFile(i.first.c_str());
+ std::string shortPath = this->CTest->GetShortPathToFile(i.first);
extraMatches.erase(shortPath);
}
}
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index cc0b4ed..a71f550 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -100,7 +100,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part,
<< std::endl);
return false;
}
- this->CTest->AddSubmitFile(part, ostr.str().c_str());
+ this->CTest->AddSubmitFile(part, ostr.str());
return true;
}
diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx
index a755632..03b7173 100644
--- a/Source/CTest/cmCTestHandlerCommand.cxx
+++ b/Source/CTest/cmCTestHandlerCommand.cxx
@@ -14,6 +14,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
@@ -125,23 +126,21 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
// CTEST_CONFIGURATION_TYPE script variable if it is defined.
// The current script value trumps the -C argument on the command
// line.
- const char* ctestConfigType =
- this->Makefile->GetDefinition("CTEST_CONFIGURATION_TYPE");
+ cmProp ctestConfigType = this->Makefile->GetDef("CTEST_CONFIGURATION_TYPE");
if (ctestConfigType) {
- this->CTest->SetConfigType(ctestConfigType);
+ this->CTest->SetConfigType(*ctestConfigType);
}
if (!this->Build.empty()) {
this->CTest->SetCTestConfiguration(
- "BuildDirectory", cmSystemTools::CollapseFullPath(this->Build).c_str(),
+ "BuildDirectory", cmSystemTools::CollapseFullPath(this->Build),
this->Quiet);
} else {
std::string const& bdir =
this->Makefile->GetSafeDefinition("CTEST_BINARY_DIRECTORY");
if (!bdir.empty()) {
this->CTest->SetCTestConfiguration(
- "BuildDirectory", cmSystemTools::CollapseFullPath(bdir).c_str(),
- this->Quiet);
+ "BuildDirectory", cmSystemTools::CollapseFullPath(bdir), this->Quiet);
} else {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"CTEST_BINARY_DIRECTORY not set" << std::endl;);
@@ -151,20 +150,18 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
cmCTestLog(this->CTest, DEBUG,
"Set source directory to: " << this->Source << std::endl);
this->CTest->SetCTestConfiguration(
- "SourceDirectory", cmSystemTools::CollapseFullPath(this->Source).c_str(),
+ "SourceDirectory", cmSystemTools::CollapseFullPath(this->Source),
this->Quiet);
} else {
this->CTest->SetCTestConfiguration(
"SourceDirectory",
cmSystemTools::CollapseFullPath(
- this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY"))
- .c_str(),
+ this->Makefile->GetSafeDefinition("CTEST_SOURCE_DIRECTORY")),
this->Quiet);
}
- if (const char* changeId =
- this->Makefile->GetDefinition("CTEST_CHANGE_ID")) {
- this->CTest->SetCTestConfiguration("ChangeId", changeId, this->Quiet);
+ if (cmProp changeId = this->Makefile->GetDef("CTEST_CHANGE_ID")) {
+ this->CTest->SetCTestConfiguration("ChangeId", *changeId, this->Quiet);
}
cmCTestLog(this->CTest, DEBUG, "Initialize handler" << std::endl;);
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index d2772a7..822049e 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -354,7 +354,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml)
cmCTestMemCheckHandler::TestResultsVector::size_type cc;
for (cmCTestTestResult const& result : this->TestResults) {
std::string testPath = result.Path + "/" + result.Name;
- xml.Element("Test", this->CTest->GetShortPathToFile(testPath.c_str()));
+ xml.Element("Test", this->CTest->GetShortPathToFile(testPath));
}
xml.EndElement(); // TestList
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx
index ed14d06..a25cca4 100644
--- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx
+++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx
@@ -15,7 +15,7 @@ bool cmCTestReadCustomFilesCommand::InitialPass(
}
for (std::string const& arg : args) {
- this->CTest->ReadCustomConfigurationFileTree(arg.c_str(), this->Makefile);
+ this->CTest->ReadCustomConfigurationFileTree(arg, this->Makefile);
}
return true;
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 2c8e385..4d65c9b 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -619,11 +619,11 @@ void cmCTestRunTest::ComputeArguments()
cmCTestMemCheckHandler* handler =
static_cast<cmCTestMemCheckHandler*>(this->TestHandler);
this->ActualCommand = handler->MemoryTester;
- this->TestProperties->Args[1] = this->TestHandler->FindTheExecutable(
- this->TestProperties->Args[1].c_str());
+ this->TestProperties->Args[1] =
+ this->TestHandler->FindTheExecutable(this->TestProperties->Args[1]);
} else {
- this->ActualCommand = this->TestHandler->FindTheExecutable(
- this->TestProperties->Args[1].c_str());
+ this->ActualCommand =
+ this->TestHandler->FindTheExecutable(this->TestProperties->Args[1]);
++j; // skip the executable (it will be actualCommand)
}
std::string testCommand =
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index fe68406..6398d66 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -94,10 +94,9 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
std::string sourceDir = cmSystemTools::CollapseFullPath(src_dir);
std::string binaryDir = cmSystemTools::CollapseFullPath(bld_dir);
- this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str(),
- this->Quiet);
- this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str(),
+ this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir,
this->Quiet);
+ this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir, this->Quiet);
if (smodel) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index 279216e..026e98f 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -35,12 +35,12 @@ std::unique_ptr<cmCommand> cmCTestSubmitCommand::Clone()
cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
{
- const char* submitURL = !this->SubmitURL.empty()
- ? this->SubmitURL.c_str()
- : this->Makefile->GetDefinition("CTEST_SUBMIT_URL");
+ const std::string* submitURL = !this->SubmitURL.empty()
+ ? &this->SubmitURL
+ : this->Makefile->GetDef("CTEST_SUBMIT_URL");
if (submitURL) {
- this->CTest->SetCTestConfiguration("SubmitURL", submitURL, this->Quiet);
+ this->CTest->SetCTestConfiguration("SubmitURL", *submitURL, this->Quiet);
} else {
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "DropMethod", "CTEST_DROP_METHOD", this->Quiet);
@@ -108,7 +108,7 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
if (this->PartsMentioned) {
auto parts =
cmMakeRange(this->Parts).transform([this](std::string const& arg) {
- return this->CTest->GetPartFromName(arg.c_str());
+ return this->CTest->GetPartFromName(arg);
});
handler->SelectParts(std::set<cmCTest::Part>(parts.begin(), parts.end()));
}
@@ -177,7 +177,7 @@ void cmCTestSubmitCommand::CheckArguments(
!this->Files.empty() || cm::contains(keywords, "FILES");
cm::erase_if(this->Parts, [this](std::string const& arg) -> bool {
- cmCTest::Part p = this->CTest->GetPartFromName(arg.c_str());
+ cmCTest::Part p = this->CTest->GetPartFromName(arg);
if (p == cmCTest::PartCount) {
std::ostringstream e;
e << "Part name \"" << arg << "\" is invalid.";
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index ea36df5..5b54573 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -797,7 +797,7 @@ int cmCTestSubmitHandler::ProcessHandler()
gfile = gfile.substr(glen);
cmCTestOptionalLog(this->CTest, DEBUG,
"Glob file: " << gfile << std::endl, this->Quiet);
- this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfile.c_str());
+ this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfile);
}
} else {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem globbing" << std::endl);
diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx
index c71b409..07ea912 100644
--- a/Source/CTest/cmCTestTestCommand.cxx
+++ b/Source/CTest/cmCTestTestCommand.cxx
@@ -13,6 +13,7 @@
#include "cmCTestTestHandler.h"
#include "cmDuration.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStringAlgorithms.h"
void cmCTestTestCommand::BindArguments()
@@ -134,10 +135,10 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler()
}
handler->SetTestLoad(testLoad);
- if (const char* labelsForSubprojects =
- this->Makefile->GetDefinition("CTEST_LABELS_FOR_SUBPROJECTS")) {
+ if (cmProp labelsForSubprojects =
+ this->Makefile->GetDef("CTEST_LABELS_FOR_SUBPROJECTS")) {
this->CTest->SetCTestConfiguration("LabelsForSubprojects",
- labelsForSubprojects, this->Quiet);
+ *labelsForSubprojects, this->Quiet);
}
handler->SetQuiet(this->Quiet);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index d0dbaae..70e84ee 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1374,7 +1374,7 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
xml.StartElement("TestList");
for (cmCTestTestResult const& result : this->TestResults) {
std::string testPath = result.Path + "/" + result.Name;
- xml.Element("Test", this->CTest->GetShortPathToFile(testPath.c_str()));
+ xml.Element("Test", this->CTest->GetShortPathToFile(testPath));
}
xml.EndElement(); // TestList
for (cmCTestTestResult& result : this->TestResults) {
@@ -1483,8 +1483,8 @@ void cmCTestTestHandler::WriteTestResultHeader(cmXMLWriter& xml,
}
std::string testPath = result.Path + "/" + result.Name;
xml.Element("Name", result.Name);
- xml.Element("Path", this->CTest->GetShortPathToFile(result.Path.c_str()));
- xml.Element("FullName", this->CTest->GetShortPathToFile(testPath.c_str()));
+ xml.Element("Path", this->CTest->GetShortPathToFile(result.Path));
+ xml.Element("FullName", this->CTest->GetShortPathToFile(testPath));
xml.Element("FullCommandLine", result.FullCommandLine);
}
@@ -1546,12 +1546,12 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<std::string>& vec)
}
// Find the appropriate executable to run for a test
-std::string cmCTestTestHandler::FindTheExecutable(const char* exe)
+std::string cmCTestTestHandler::FindTheExecutable(const std::string& exe)
{
std::string resConfig;
std::vector<std::string> extraPaths;
std::vector<std::string> failedPaths;
- if (strcmp(exe, "NOT_AVAILABLE") == 0) {
+ if (exe == "NOT_AVAILABLE") {
return exe;
}
return cmCTestTestHandler::FindExecutable(this->CTest, exe, resConfig,
@@ -1607,7 +1607,7 @@ void cmCTestTestHandler::AddConfigurations(
// Find the appropriate executable to run for a test
std::string cmCTestTestHandler::FindExecutable(
- cmCTest* ctest, const char* testCommand, std::string& resultingConfig,
+ cmCTest* ctest, const std::string& testCommand, std::string& resultingConfig,
std::vector<std::string>& extraPaths, std::vector<std::string>& failed)
{
// now run the compiled test if we can find it
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 0d88c30..b26f8a6 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -198,7 +198,8 @@ public:
std::string filepath, std::string& filename);
// full signature static method to find an executable
- static std::string FindExecutable(cmCTest* ctest, const char* testCommand,
+ static std::string FindExecutable(cmCTest* ctest,
+ const std::string& testCommand,
std::string& resultingConfig,
std::vector<std::string>& extraPaths,
std::vector<std::string>& failed);
@@ -309,7 +310,7 @@ private:
/**
* Find the executable for a test
*/
- std::string FindTheExecutable(const char* exe);
+ std::string FindTheExecutable(const std::string& exe);
std::string GetTestStatus(cmCTestTestResult const&);
void ExpandTestsToRunInformation(size_t numPossibleTests);
diff --git a/Source/CTest/cmCTestUpdateCommand.cxx b/Source/CTest/cmCTestUpdateCommand.cxx
index 673eb9a..95cae13 100644
--- a/Source/CTest/cmCTestUpdateCommand.cxx
+++ b/Source/CTest/cmCTestUpdateCommand.cxx
@@ -11,14 +11,13 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
{
if (!this->Source.empty()) {
this->CTest->SetCTestConfiguration(
- "SourceDirectory", cmSystemTools::CollapseFullPath(this->Source).c_str(),
+ "SourceDirectory", cmSystemTools::CollapseFullPath(this->Source),
this->Quiet);
} else {
this->CTest->SetCTestConfiguration(
"SourceDirectory",
cmSystemTools::CollapseFullPath(
- this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY"))
- .c_str(),
+ this->Makefile->GetDefinition("CTEST_SOURCE_DIRECTORY")),
this->Quiet);
}
std::string source_dir =