summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Goshi <jgoshi@microsoft.com>2018-01-04 00:49:00 (GMT)
committerJustin Goshi <jgoshi@microsoft.com>2018-01-04 00:49:00 (GMT)
commit2c1ecab64da6a8c7738770316ddf8a72bbf8eb1f (patch)
treea8c536f5de0e29e205f4e965acfec9ff40edeaa5
parent64b624f118ac4f86e4a1b799b3d2130b5065847b (diff)
downloadCMake-2c1ecab64da6a8c7738770316ddf8a72bbf8eb1f.zip
CMake-2c1ecab64da6a8c7738770316ddf8a72bbf8eb1f.tar.gz
CMake-2c1ecab64da6a8c7738770316ddf8a72bbf8eb1f.tar.bz2
server: Expand generator expressions for test info
-rw-r--r--Source/cmServerProtocol.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index d745c49..6b7143b 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -748,7 +748,8 @@ static Json::Value DumpSourceFilesList(
return result;
}
-static Json::Value DumpCTestInfo(cmTest* testInfo)
+static Json::Value DumpCTestInfo(cmLocalGenerator* lg, cmTest* testInfo,
+ const std::string& config)
{
Json::Value result = Json::objectValue;
result[kCTEST_NAME] = testInfo->GetName();
@@ -760,14 +761,24 @@ static Json::Value DumpCTestInfo(cmTest* testInfo)
command.append(cmd);
command.append(" ");
}
- result[kCTEST_COMMAND] = command;
+
+ // Remove any config specific variables from the output.
+ cmGeneratorExpression ge;
+ auto cge = ge.Parse(command.c_str());
+ const char* processed = cge->Evaluate(lg, config);
+
+ result[kCTEST_COMMAND] = processed;
// Build up the list of properties that may have been specified
Json::Value properties = Json::arrayValue;
for (auto& prop : testInfo->GetProperties()) {
Json::Value entry = Json::objectValue;
entry[kKEY_KEY] = prop.first;
- entry[kVALUE_KEY] = prop.second.GetValue();
+
+ // Remove config variables from the value too.
+ auto cge_value = ge.Parse(prop.second.GetValue());
+ const char* processed_value = cge_value->Evaluate(lg, config);
+ entry[kVALUE_KEY] = processed_value;
properties.append(entry);
}
result[kPROPERTIES_KEY] = properties;
@@ -775,13 +786,14 @@ static Json::Value DumpCTestInfo(cmTest* testInfo)
return result;
}
-static void DumpMakefileTests(cmMakefile* mf, const std::string& config,
+static void DumpMakefileTests(cmLocalGenerator* lg, const std::string& config,
Json::Value* result)
{
+ auto mf = lg->GetMakefile();
std::vector<cmTest*> tests;
mf->GetTests(config, tests);
for (auto test : tests) {
- Json::Value tmp = DumpCTestInfo(test);
+ Json::Value tmp = DumpCTestInfo(lg, test, config);
if (!tmp.isNull()) {
result->append(tmp);
}
@@ -805,8 +817,7 @@ static Json::Value DumpCTestProjectList(const cmake* cm,
for (const auto& lg : projectIt.second) {
// Make sure they're generated.
lg->GenerateTestFiles();
- cmMakefile* mf = lg->GetMakefile();
- DumpMakefileTests(mf, config, &tests);
+ DumpMakefileTests(lg, config, &tests);
}
pObj[kCTEST_INFO] = tests;