1
0
Эх сурвалжийг харах

ctest_configure: Add QUIET option

Zack Galbreath 10 жил өмнө
parent
commit
f999dc0bbf

+ 5 - 1
Help/command/ctest_configure.rst

@@ -6,7 +6,7 @@ Configure the project build tree.
 ::
 
   ctest_configure([BUILD build_dir] [SOURCE source_dir] [APPEND]
-                  [OPTIONS options] [RETURN_VALUE res])
+                  [OPTIONS options] [RETURN_VALUE res] [QUIET])
 
 Configures the given build directory and stores results in
 Configure.xml.  If no BUILD is given, the CTEST_BINARY_DIRECTORY
@@ -19,3 +19,7 @@ build tool.
 The APPEND option marks results for append to those previously
 submitted to a dashboard server since the last ctest_start.  Append
 semantics are defined by the dashboard server in use.
+
+The QUIET option suppresses any CTest-specific non-error messages
+that would have otherwise been printed to the console.  Output from
+the underlying configure command is not affected.

+ 3 - 2
Source/CTest/cmCTestConfigureCommand.cxx

@@ -45,7 +45,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
   if ( ctestConfigureCommand && *ctestConfigureCommand )
     {
     this->CTest->SetCTestConfiguration("ConfigureCommand",
-      ctestConfigureCommand);
+      ctestConfigureCommand, this->Quiet);
     }
   else
     {
@@ -141,7 +141,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
       cmakeConfigureCommand += "\"";
 
       this->CTest->SetCTestConfiguration("ConfigureCommand",
-        cmakeConfigureCommand.c_str());
+        cmakeConfigureCommand.c_str(), this->Quiet);
       }
     else
       {
@@ -160,5 +160,6 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler()
       "internal CTest error. Cannot instantiate configure handler");
     return 0;
     }
+  handler->SetQuiet(this->Quiet);
   return handler;
 }

+ 7 - 6
Source/CTest/cmCTestConfigureHandler.cxx

@@ -35,7 +35,8 @@ void cmCTestConfigureHandler::Initialize()
 //functions and commented...
 int cmCTestConfigureHandler::ProcessHandler()
 {
-  cmCTestLog(this->CTest, HANDLER_OUTPUT, "Configure project" << std::endl);
+  cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
+    "Configure project" << std::endl, this->Quiet);
   std::string cCommand
     = this->CTest->GetCTestConfiguration("ConfigureCommand");
   if (cCommand.empty())
@@ -75,8 +76,8 @@ int cmCTestConfigureHandler::ProcessHandler()
 
     cmGeneratedFileStream ofs;
     this->StartLogFile("Configure", ofs);
-    cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: "
-      << cCommand << std::endl);
+    cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+      "Configure with command: " << cCommand << std::endl, this->Quiet);
     res = this->CTest->RunMakeCommand(cCommand.c_str(), output,
       &retVal, buildDirectory.c_str(),
       0, ofs);
@@ -101,7 +102,7 @@ int cmCTestConfigureHandler::ProcessHandler()
         }
       os << "<ConfigureCommand>" << cCommand << "</ConfigureCommand>"
         << std::endl;
-      cmCTestLog(this->CTest, DEBUG, "End" << std::endl);
+      cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet);
       os << "<Log>" << cmXMLSafe(output) << "</Log>" << std::endl;
       std::string end_time = this->CTest->CurrentTime();
       os << "\t<ConfigureStatus>" << retVal << "</ConfigureStatus>\n"
@@ -119,8 +120,8 @@ int cmCTestConfigureHandler::ProcessHandler()
     }
   else
     {
-    cmCTestLog(this->CTest, DEBUG, "Configure with command: " << cCommand
-      << std::endl);
+    cmCTestOptionalLog(this->CTest, DEBUG,
+      "Configure with command: " << cCommand << std::endl, this->Quiet);
     }
   if (! res || retVal )
     {

+ 1 - 0
Tests/RunCMake/CMakeLists.txt

@@ -129,6 +129,7 @@ add_RunCMake_test(build_command)
 add_RunCMake_test(export)
 add_RunCMake_test(cmake_minimum_required)
 add_RunCMake_test(continue)
+add_RunCMake_test(ctest_configure)
 add_RunCMake_test(ctest_start)
 add_RunCMake_test(ctest_submit)
 add_RunCMake_test(file)

+ 4 - 0
Tests/RunCMake/ctest_configure/CMakeLists.txt.in

@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.1)
+project(CTestConfigure@CASE_NAME@ NONE)
+include(CTest)
+add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)

+ 1 - 0
Tests/RunCMake/ctest_configure/CTestConfig.cmake.in

@@ -0,0 +1 @@
+set(CTEST_PROJECT_NAME "CTestConfigure@CASE_NAME@")

+ 9 - 0
Tests/RunCMake/ctest_configure/ConfigureQuiet-stdout.txt

@@ -0,0 +1,9 @@
+Run dashboard with model Experimental
+   Source directory: .*/Tests/RunCMake/ctest_configure/ConfigureQuiet
+   Build directory: .*/Tests/RunCMake/ctest_configure/ConfigureQuiet-build
+   Reading ctest configuration file: .*/Tests/RunCMake/ctest_configure/ConfigureQuiet/CTestConfig.cmake
+   Site: test-site
+   Build name: test-build-name
+   Use Experimental tag: [0-9-]+
+   Each . represents 1024 bytes of output
+    . Size of output: 0K

+ 10 - 0
Tests/RunCMake/ctest_configure/RunCMakeTest.cmake

@@ -0,0 +1,10 @@
+include(RunCTest)
+
+set(CASE_CTEST_CONFIGURE_ARGS "")
+
+function(run_ctest_configure CASE_NAME)
+  set(CASE_CTEST_CONFIGURE_ARGS "${ARGN}")
+  run_ctest(${CASE_NAME})
+endfunction()
+
+run_ctest_configure(ConfigureQuiet QUIET)

+ 14 - 0
Tests/RunCMake/ctest_configure/test.cmake.in

@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.1)
+
+set(CTEST_SITE                          "test-site")
+set(CTEST_BUILD_NAME                    "test-build-name")
+set(CTEST_SOURCE_DIRECTORY              "@RunCMake_BINARY_DIR@/@CASE_NAME@")
+set(CTEST_BINARY_DIRECTORY              "@RunCMake_BINARY_DIR@/@CASE_NAME@-build")
+set(CTEST_CMAKE_GENERATOR               "@RunCMake_GENERATOR@")
+set(CTEST_CMAKE_GENERATOR_PLATFORM      "@RunCMake_GENERATOR_PLATFORM@")
+set(CTEST_CMAKE_GENERATOR_TOOLSET       "@RunCMake_GENERATOR_TOOLSET@")
+set(CTEST_BUILD_CONFIGURATION           "$ENV{CMAKE_CONFIG_TYPE}")
+
+set(ctest_configure_args "@CASE_CTEST_CONFIGURE_ARGS@")
+ctest_start(Experimental)
+ctest_configure(${ctest_configure_args})