diff options
author | Brad King <brad.king@kitware.com> | 2018-01-10 15:34:09 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-01-10 15:34:24 (GMT) |
commit | 1be22978e0ec3766c457216af348c8dca4d7cca2 (patch) | |
tree | 425dc5bb41d71d485175d18caa029740d7d9a8e4 /Source | |
parent | e9237334a6beab7090cc702ca8d4e0914f5bfe07 (diff) | |
parent | 2c1ecab64da6a8c7738770316ddf8a72bbf8eb1f (diff) | |
download | CMake-1be22978e0ec3766c457216af348c8dca4d7cca2.zip CMake-1be22978e0ec3766c457216af348c8dca4d7cca2.tar.gz CMake-1be22978e0ec3766c457216af348c8dca4d7cca2.tar.bz2 |
Merge topic 'serverTestInfoExpandVariables'
2c1ecab6 server: Expand generator expressions for test info
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1633
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmServerProtocol.cxx | 25 |
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; |