[Cmake-commits] CMake branch, master, updated. v3.10.0-rc4-236-gb5d8610
Kitware Robot
kwrobot at kitware.com
Tue Nov 7 08:25:06 EST 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, master has been updated
via b5d8610430b844231278db9ca3f807e2c433a608 (commit)
via 1348f97784e0aaa1c4254011bfc9b6990993ee53 (commit)
via d70bdc72ce5f480947077e435433fc6cf524be4d (commit)
via 35a52bd1b4d0350d3c7e94611dd90ddb4b123352 (commit)
via 335816efad6904fb5c6059a791d7b0eea4882bc0 (commit)
from c37c4771cb876146ae0d23a2008482d6fcd53e35 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b5d8610430b844231278db9ca3f807e2c433a608
commit b5d8610430b844231278db9ca3f807e2c433a608
Merge: 1348f97 d70bdc7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Nov 7 13:21:13 2017 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Nov 7 08:21:23 2017 -0500
Merge topic 'findboost-compiler-version'
d70bdc72 FindBoost: support more than one number in version components
335816ef FindBoost: use CMake's compiler version rather than querying again
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1441
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1348f97784e0aaa1c4254011bfc9b6990993ee53
commit 1348f97784e0aaa1c4254011bfc9b6990993ee53
Merge: c37c477 35a52bd
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Nov 7 13:18:35 2017 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Nov 7 08:18:59 2017 -0500
Merge topic 'server-test-info'
35a52bd1 server: add "ctestInfo" request to get test info
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !1414
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d70bdc72ce5f480947077e435433fc6cf524be4d
commit d70bdc72ce5f480947077e435433fc6cf524be4d
Author: Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Mon Nov 6 13:26:23 2017 -0500
Commit: Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Mon Nov 6 13:26:23 2017 -0500
FindBoost: support more than one number in version components
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index bf52d29..6f60eeb 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -391,7 +391,7 @@ endmacro()
# version with a regex.
#
function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
- string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
+ string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1\\2"
_boost_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=35a52bd1b4d0350d3c7e94611dd90ddb4b123352
commit 35a52bd1b4d0350d3c7e94611dd90ddb4b123352
Author: Justin Goshi <jgoshi at microsoft.com>
AuthorDate: Wed Oct 25 15:00:15 2017 -0700
Commit: Justin Goshi <jgoshi at microsoft.com>
CommitDate: Fri Nov 3 09:39:01 2017 -0700
server: add "ctestInfo" request to get test info
diff --git a/Help/manual/cmake-server.7.rst b/Help/manual/cmake-server.7.rst
index 389a6d5..a2fd961 100644
--- a/Help/manual/cmake-server.7.rst
+++ b/Help/manual/cmake-server.7.rst
@@ -628,6 +628,79 @@ CMake will reply::
]== "CMake Server" ==]
+Type "ctestInfo"
+^^^^^^^^^^^^^^^^
+
+The "ctestInfo" request can be used after a project was "compute"d successfully.
+
+It will list the complete project test structure as it is known to cmake.
+
+The reply will contain a key "configurations", which will contain a list of
+configuration objects. Configuration objects are used to destinquish between
+different configurations the build directory might have enabled. While most
+generators only support one configuration, others might support several.
+
+Each configuration object can have the following keys:
+
+"name"
+ contains the name of the configuration. The name may be empty.
+"projects"
+ contains a list of project objects, one for each build project.
+
+Project objects define one (sub-)project defined in the cmake build system.
+
+Each project object can have the following keys:
+
+"name"
+ contains the (sub-)projects name.
+"targets"
+ contains a list of build system target objects.
+
+Target objects define individual build targets for a certain configuration.
+
+Each target object can have the following keys:
+
+"name"
+ contains the name of the target.
+"type"
+ defines the type of build of the target. Possible values are
+ "STATIC_LIBRARY", "MODULE_LIBRARY", "SHARED_LIBRARY", "OBJECT_LIBRARY",
+ "EXECUTABLE", "UTILITY" and "INTERFACE_LIBRARY".
+"fullName"
+ contains the full name of the build result (incl. extensions, etc.).
+"hasEnabledTests"
+ true if testing is enabled for this target.
+"ctestInfo"
+ contains a list of test objects for this target.
+
+Each test object can have the following keys:
+
+"ctestName"
+ contains the name of the test.
+"ctestCommand"
+ contains the test command.
+"properties"
+ contains a list of test property objects.
+"backtrace"
+ contains a list of backtrace objects that specify where the test was defined.
+
+Each backtrace object can have the following keys:
+
+"path"
+ contains the full path to the file containing the statement.
+"line"
+ contains the line number in the file where the statement was defined.
+"name"
+ contains the name of the statement that added the test.
+
+Each test property object can have the following keys:
+
+"key"
+ contains the test property key.
+"value"
+ contains the test property value.
+
+
Type "cmakeInputs"
^^^^^^^^^^^^^^^^^^
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1a088ea..f47c2d4 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -222,7 +222,14 @@ void cmLocalGenerator::TraceDependencies()
void cmLocalGenerator::GenerateTestFiles()
{
+ std::string file = this->StateSnapshot.GetDirectory().GetCurrentBinary();
+ file += "/";
+ file += "CTestTestfile.cmake";
+
if (!this->Makefile->IsOn("CMAKE_TESTING_ENABLED")) {
+ if (cmSystemTools::FileExists(file)) {
+ cmSystemTools::RemoveFile(file);
+ }
return;
}
@@ -231,10 +238,6 @@ void cmLocalGenerator::GenerateTestFiles()
const std::string& config =
this->Makefile->GetConfigurations(configurationTypes, false);
- std::string file = this->StateSnapshot.GetDirectory().GetCurrentBinary();
- file += "/";
- file += "CTestTestfile.cmake";
-
cmGeneratedFileStream fout(file.c_str());
fout.SetCopyIfDifferent(true);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b2641d2..90e0a0d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3282,6 +3282,13 @@ cmGlobalGenerator* cmMakefile::GetGlobalGenerator() const
return this->GlobalGenerator;
}
+void cmMakefile::GetTestNames(std::vector<std::string>& testNames)
+{
+ for (const auto& iter : Tests) {
+ testNames.push_back(iter.first);
+ }
+}
+
#ifdef CMAKE_BUILD_WITH_CMAKE
cmVariableWatch* cmMakefile::GetVariableWatch() const
{
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 7c6cca5..01a9fb7 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -617,6 +617,11 @@ public:
cmGlobalGenerator* GetGlobalGenerator() const;
/**
+ * Get all the test names this makefile knows about
+ */
+ void GetTestNames(std::vector<std::string>& testNames);
+
+ /**
* Get all the source files this makefile knows about
*/
const std::vector<cmSourceFile*>& GetSourceFiles() const
diff --git a/Source/cmServerDictionary.h b/Source/cmServerDictionary.h
index 03f1cc1..040c1fd 100644
--- a/Source/cmServerDictionary.h
+++ b/Source/cmServerDictionary.h
@@ -23,6 +23,7 @@ static const std::string kPROGRESS_TYPE = "progress";
static const std::string kREPLY_TYPE = "reply";
static const std::string kSET_GLOBAL_SETTINGS_TYPE = "setGlobalSettings";
static const std::string kSIGNAL_TYPE = "signal";
+static const std::string kCTEST_INFO_TYPE = "ctestInfo";
static const std::string kARTIFACTS_KEY = "artifacts";
static const std::string kBUILD_DIRECTORY_KEY = "buildDirectory";
@@ -90,6 +91,10 @@ static const std::string kWATCHED_DIRECTORIES_KEY = "watchedDirectories";
static const std::string kWATCHED_FILES_KEY = "watchedFiles";
static const std::string kHAS_INSTALL_RULE = "hasInstallRule";
static const std::string kINSTALL_PATHS = "installPaths";
+static const std::string kHAS_ENABLED_TESTS = "hasEnabledTests";
+static const std::string kCTEST_NAME = "ctestName";
+static const std::string kCTEST_COMMAND = "ctestCommand";
+static const std::string kCTEST_INFO = "ctestInfo";
static const std::string kTARGET_CROSS_REFERENCES_KEY = "crossReferences";
static const std::string kLINE_NUMBER_KEY = "line";
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index fc06fed..0cb906b 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -14,6 +14,7 @@
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmServer.h"
#include "cmServerDictionary.h"
#include "cmSourceFile.h"
@@ -23,6 +24,7 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmTest.h"
#include "cm_uv.h"
#include "cmake.h"
@@ -479,6 +481,9 @@ const cmServerResponse cmServerProtocol1::Process(
if (request.Type == kSET_GLOBAL_SETTINGS_TYPE) {
return this->ProcessSetGlobalSettings(request);
}
+ if (request.Type == kCTEST_INFO_TYPE) {
+ return this->ProcessCTests(request);
+ }
return request.ReportError("Unknown command!");
}
@@ -766,6 +771,153 @@ static void DumpBacktraceRange(Json::Value& result, const std::string& type,
}
}
+static Json::Value DumpCTestInfo(const std::string& name, cmTest* testInfo)
+{
+ Json::Value result = Json::objectValue;
+ result[kCTEST_NAME] = name;
+
+ // Concat command entries together. After the first should be the arguments
+ // for the command
+ std::string command;
+ for (auto const& cmd : testInfo->GetCommand()) {
+ command.append(cmd);
+ command.append(" ");
+ }
+ result[kCTEST_COMMAND] = command;
+
+ // 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();
+ properties.append(entry);
+ }
+ result[kPROPERTIES_KEY] = properties;
+
+ // Need backtrace to figure out where this test was originally added
+ result[kBACKTRACE_KEY] = DumpBacktrace(testInfo->GetBacktrace());
+
+ return result;
+}
+
+static Json::Value DumpCTestTarget(cmGeneratorTarget* target,
+ const std::string& config)
+{
+ cmLocalGenerator* lg = target->GetLocalGenerator();
+ const cmState* state = lg->GetState();
+
+ const cmStateEnums::TargetType type = target->GetType();
+ const std::string typeName = state->GetTargetTypeName(type);
+
+ Json::Value ttl = Json::arrayValue;
+ ttl.append("EXECUTABLE");
+ ttl.append("STATIC_LIBRARY");
+ ttl.append("SHARED_LIBRARY");
+ ttl.append("MODULE_LIBRARY");
+ ttl.append("OBJECT_LIBRARY");
+ ttl.append("UTILITY");
+ ttl.append("INTERFACE_LIBRARY");
+
+ if (!hasString(ttl, typeName) || target->IsImported()) {
+ return Json::Value();
+ }
+
+ Json::Value result = Json::objectValue;
+ result[kNAME_KEY] = target->GetName();
+ result[kTYPE_KEY] = typeName;
+
+ if (type == cmStateEnums::INTERFACE_LIBRARY) {
+ return result;
+ }
+ result[kFULL_NAME_KEY] = target->GetFullName(config);
+
+ if (target->Makefile->IsOn("CMAKE_TESTING_ENABLED")) {
+ result[kHAS_ENABLED_TESTS] = true;
+ std::vector<std::string> CTestNames;
+
+ Json::Value testInfo = Json::arrayValue;
+ std::vector<std::string> testNames;
+ target->Makefile->GetTestNames(testNames);
+ for (auto& name : testNames) {
+ auto test = target->Makefile->GetTest(name);
+ if (test != nullptr) {
+ testInfo.append(DumpCTestInfo(name, test));
+ }
+ }
+ result[kCTEST_INFO] = testInfo;
+ }
+
+ return result;
+}
+
+static Json::Value DumpCTestTargetsList(
+ const std::vector<cmLocalGenerator*>& generators, const std::string& config)
+{
+ Json::Value result = Json::arrayValue;
+
+ std::vector<cmGeneratorTarget*> targetList;
+ for (const auto& lgIt : generators) {
+ auto list = lgIt->GetGeneratorTargets();
+ targetList.insert(targetList.end(), list.begin(), list.end());
+ }
+ std::sort(targetList.begin(), targetList.end());
+
+ for (cmGeneratorTarget* target : targetList) {
+ Json::Value tmp = DumpCTestTarget(target, config);
+ if (!tmp.isNull()) {
+ result.append(tmp);
+ }
+ }
+
+ return result;
+}
+
+static Json::Value DumpCTestProjectList(const cmake* cm,
+ std::string const& config)
+{
+ Json::Value result = Json::arrayValue;
+
+ auto globalGen = cm->GetGlobalGenerator();
+
+ for (const auto& projectIt : globalGen->GetProjectMap()) {
+ Json::Value pObj = Json::objectValue;
+ pObj[kNAME_KEY] = projectIt.first;
+
+ // All Projects must have at least one local generator
+ assert(!projectIt.second.empty());
+
+ // Project structure information:
+ pObj[kTARGETS_KEY] = DumpCTestTargetsList(projectIt.second, config);
+
+ result.append(pObj);
+ }
+
+ return result;
+}
+
+static Json::Value DumpCTestConfiguration(const cmake* cm,
+ const std::string& config)
+{
+ Json::Value result = Json::objectValue;
+ result[kNAME_KEY] = config;
+
+ result[kPROJECTS_KEY] = DumpCTestProjectList(cm, config);
+
+ return result;
+}
+
+static Json::Value DumpCTestConfigurationsList(const cmake* cm)
+{
+ Json::Value result = Json::arrayValue;
+
+ for (const std::string& c : getConfigurations(cm)) {
+ result.append(DumpCTestConfiguration(cm, c));
+ }
+
+ return result;
+}
+
static Json::Value DumpTarget(cmGeneratorTarget* target,
const std::string& config)
{
@@ -1222,6 +1374,19 @@ cmServerResponse cmServerProtocol1::ProcessFileSystemWatchers(
return request.Reply(result);
}
+cmServerResponse cmServerProtocol1::ProcessCTests(
+ const cmServerRequest& request)
+{
+ if (this->m_State < STATE_COMPUTED) {
+ return request.ReportError("This instance was not yet computed.");
+ }
+
+ Json::Value result = Json::objectValue;
+ result[kCONFIGURATIONS_KEY] =
+ DumpCTestConfigurationsList(this->CMakeInstance());
+ return request.Reply(result);
+}
+
cmServerProtocol1::GeneratorInformation::GeneratorInformation(
const std::string& generatorName, const std::string& extraGeneratorName,
const std::string& toolset, const std::string& platform,
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index 124ac7f..df71cff 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -123,6 +123,7 @@ private:
cmServerResponse ProcessGlobalSettings(const cmServerRequest& request);
cmServerResponse ProcessSetGlobalSettings(const cmServerRequest& request);
cmServerResponse ProcessFileSystemWatchers(const cmServerRequest& request);
+ cmServerResponse ProcessCTests(const cmServerRequest& request);
enum State
{
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=335816efad6904fb5c6059a791d7b0eea4882bc0
commit 335816efad6904fb5c6059a791d7b0eea4882bc0
Author: Ben Boeckel <ben.boeckel at kitware.com>
AuthorDate: Thu Nov 2 15:13:47 2017 -0400
Commit: Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Fri Nov 3 11:43:22 2017 -0400
FindBoost: use CMake's compiler version rather than querying again
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 88d14ab..bf52d29 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -391,13 +391,8 @@ endmacro()
# version with a regex.
#
function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
-
- exec_program(${CMAKE_CXX_COMPILER}
- ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
- OUTPUT_VARIABLE _boost_COMPILER_VERSION
- )
string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
- _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
+ _boost_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
endfunction()
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-server.7.rst | 73 ++++++++++++++++++
Modules/FindBoost.cmake | 9 +--
Source/cmLocalGenerator.cxx | 11 ++-
Source/cmMakefile.cxx | 7 ++
Source/cmMakefile.h | 5 ++
Source/cmServerDictionary.h | 5 ++
Source/cmServerProtocol.cxx | 165 ++++++++++++++++++++++++++++++++++++++++
Source/cmServerProtocol.h | 1 +
8 files changed, 265 insertions(+), 11 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list