From f999dc0bbf70dcf6167d77a1dedabefa12edaef2 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Tue, 17 Feb 2015 12:38:52 -0500 Subject: [PATCH] ctest_configure: Add QUIET option --- Help/command/ctest_configure.rst | 6 +++++- Source/CTest/cmCTestConfigureCommand.cxx | 5 +++-- Source/CTest/cmCTestConfigureHandler.cxx | 13 +++++++------ Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/ctest_configure/CMakeLists.txt.in | 4 ++++ .../RunCMake/ctest_configure/CTestConfig.cmake.in | 1 + .../ctest_configure/ConfigureQuiet-stdout.txt | 9 +++++++++ Tests/RunCMake/ctest_configure/RunCMakeTest.cmake | 10 ++++++++++ Tests/RunCMake/ctest_configure/test.cmake.in | 14 ++++++++++++++ 9 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 Tests/RunCMake/ctest_configure/CMakeLists.txt.in create mode 100644 Tests/RunCMake/ctest_configure/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/ctest_configure/ConfigureQuiet-stdout.txt create mode 100644 Tests/RunCMake/ctest_configure/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/ctest_configure/test.cmake.in diff --git a/Help/command/ctest_configure.rst b/Help/command/ctest_configure.rst index 2c4e305ff..61d93209c 100644 --- a/Help/command/ctest_configure.rst +++ b/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. diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 0f1326397..ba4dab235 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/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; } diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx index 506433fd8..3b444f21b 100644 --- a/Source/CTest/cmCTestConfigureHandler.cxx +++ b/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 << "" << cCommand << "" << std::endl; - cmCTestLog(this->CTest, DEBUG, "End" << std::endl); + cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet); os << "" << cmXMLSafe(output) << "" << std::endl; std::string end_time = this->CTest->CurrentTime(); os << "\t" << retVal << "\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 ) { diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index a9b8bf351..d39dbcf35 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/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) diff --git a/Tests/RunCMake/ctest_configure/CMakeLists.txt.in b/Tests/RunCMake/ctest_configure/CMakeLists.txt.in new file mode 100644 index 000000000..2fb21d45d --- /dev/null +++ b/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) diff --git a/Tests/RunCMake/ctest_configure/CTestConfig.cmake.in b/Tests/RunCMake/ctest_configure/CTestConfig.cmake.in new file mode 100644 index 000000000..7e30ab933 --- /dev/null +++ b/Tests/RunCMake/ctest_configure/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestConfigure@CASE_NAME@") diff --git a/Tests/RunCMake/ctest_configure/ConfigureQuiet-stdout.txt b/Tests/RunCMake/ctest_configure/ConfigureQuiet-stdout.txt new file mode 100644 index 000000000..015644d81 --- /dev/null +++ b/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 diff --git a/Tests/RunCMake/ctest_configure/RunCMakeTest.cmake b/Tests/RunCMake/ctest_configure/RunCMakeTest.cmake new file mode 100644 index 000000000..fc1b02cf0 --- /dev/null +++ b/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) diff --git a/Tests/RunCMake/ctest_configure/test.cmake.in b/Tests/RunCMake/ctest_configure/test.cmake.in new file mode 100644 index 000000000..72d199acb --- /dev/null +++ b/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})