ctest_start: Add QUIET option
This suppresses all non-error messages that would have otherwise been printed by this function.
This commit is contained in:
parent
1643b905e0
commit
19d1a5599a
|
@ -5,7 +5,7 @@ Starts the testing for a given model
|
|||
|
||||
::
|
||||
|
||||
ctest_start(Model [TRACK <track>] [APPEND] [source [binary]])
|
||||
ctest_start(Model [TRACK <track>] [APPEND] [source [binary]] [QUIET])
|
||||
|
||||
Starts the testing for a given model. The command should be called
|
||||
after the binary directory is initialized. If the 'source' and
|
||||
|
@ -14,7 +14,8 @@ after the binary directory is initialized. If the 'source' and
|
|||
If the track is
|
||||
specified, the submissions will go to the specified track. If APPEND
|
||||
is used, the existing TAG is used rather than creating a new one based
|
||||
on the current time stamp.
|
||||
on the current time stamp. If QUIET is used, CTest will suppress any
|
||||
non-error messages that it otherwise would have printed to the console.
|
||||
|
||||
If the :variable:`CTEST_CHECKOUT_COMMAND` variable
|
||||
(or the :variable:`CTEST_CVS_CHECKOUT` variable)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
cmCTestStartCommand::cmCTestStartCommand()
|
||||
{
|
||||
this->CreateNewTag = true;
|
||||
this->Quiet = false;
|
||||
}
|
||||
|
||||
bool cmCTestStartCommand
|
||||
|
@ -57,6 +58,14 @@ bool cmCTestStartCommand
|
|||
this->CreateNewTag = false;
|
||||
}
|
||||
}
|
||||
if (cnt < args.size())
|
||||
{
|
||||
if (args[cnt] == "QUIET")
|
||||
{
|
||||
cnt ++;
|
||||
this->Quiet = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cnt < args.size() )
|
||||
{
|
||||
|
@ -95,18 +104,20 @@ bool cmCTestStartCommand
|
|||
|
||||
std::string sourceDir = cmSystemTools::CollapseFullPath(src_dir);
|
||||
std::string binaryDir = cmSystemTools::CollapseFullPath(bld_dir);
|
||||
this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str());
|
||||
this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str());
|
||||
this->CTest->SetCTestConfiguration("SourceDirectory", sourceDir.c_str(),
|
||||
this->Quiet);
|
||||
this->CTest->SetCTestConfiguration("BuildDirectory", binaryDir.c_str(),
|
||||
this->Quiet);
|
||||
|
||||
cmCTestLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model "
|
||||
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, "Run dashboard with model "
|
||||
<< smodel << std::endl
|
||||
<< " Source directory: " << src_dir << std::endl
|
||||
<< " Build directory: " << bld_dir << std::endl);
|
||||
<< " Build directory: " << bld_dir << std::endl, this->Quiet);
|
||||
const char* track = this->CTest->GetSpecificTrack();
|
||||
if ( track )
|
||||
{
|
||||
cmCTestLog(this->CTest, HANDLER_OUTPUT,
|
||||
" Track: " << track << std::endl);
|
||||
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
|
||||
" Track: " << track << std::endl, this->Quiet);
|
||||
}
|
||||
|
||||
// Log startup actions.
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
ni->CTest = this->CTest;
|
||||
ni->CTestScriptHandler = this->CTestScriptHandler;
|
||||
ni->CreateNewTag = this->CreateNewTag;
|
||||
ni->Quiet = this->Quiet;
|
||||
return ni;
|
||||
}
|
||||
|
||||
|
@ -52,6 +53,14 @@ public:
|
|||
return this->CreateNewTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should this invocation of ctest_start output non-error messages?
|
||||
*/
|
||||
bool ShouldBeQuiet()
|
||||
{
|
||||
return this->Quiet;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the command as specified in CMakeList.txt.
|
||||
*/
|
||||
|
@ -62,6 +71,7 @@ public:
|
|||
private:
|
||||
bool InitialCheckout(std::ostream& ofs, std::string const& sourceDir);
|
||||
bool CreateNewTag;
|
||||
bool Quiet;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -463,7 +463,13 @@ cmCTest::Part cmCTest::GetPartFromName(const char* name)
|
|||
//----------------------------------------------------------------------
|
||||
int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
|
||||
{
|
||||
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
|
||||
bool quiet = false;
|
||||
if (command && command->ShouldBeQuiet())
|
||||
{
|
||||
quiet = true;
|
||||
}
|
||||
|
||||
cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet);
|
||||
if(!this->InteractiveDebugMode)
|
||||
{
|
||||
this->BlockTestErrorDiagnostics();
|
||||
|
@ -478,24 +484,23 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
|
|||
|
||||
this->UpdateCTestConfiguration();
|
||||
|
||||
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
|
||||
cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet);
|
||||
if ( this->ProduceXML )
|
||||
{
|
||||
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
|
||||
cmCTestLog(this, OUTPUT,
|
||||
" Site: " << this->GetCTestConfiguration("Site") << std::endl
|
||||
<< " Build name: "
|
||||
<< cmCTest::SafeBuildIdField(
|
||||
this->GetCTestConfiguration("BuildName"))
|
||||
<< std::endl);
|
||||
cmCTestLog(this, DEBUG, "Produce XML is on" << std::endl);
|
||||
cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl, quiet);
|
||||
cmCTestOptionalLog(this, OUTPUT,
|
||||
" Site: " << this->GetCTestConfiguration("Site") << std::endl <<
|
||||
" Build name: " << cmCTest::SafeBuildIdField(
|
||||
this->GetCTestConfiguration("BuildName")) << std::endl, quiet);
|
||||
cmCTestOptionalLog(this, DEBUG, "Produce XML is on" << std::endl, quiet);
|
||||
if ( this->TestModel == cmCTest::NIGHTLY &&
|
||||
this->GetCTestConfiguration("NightlyStartTime").empty() )
|
||||
{
|
||||
cmCTestLog(this, WARNING,
|
||||
"WARNING: No nightly start time found please set in"
|
||||
" CTestConfig.cmake or DartConfig.cmake" << std::endl);
|
||||
cmCTestLog(this, DEBUG, "Here: " << __LINE__ << std::endl);
|
||||
cmCTestOptionalLog(this, WARNING,
|
||||
"WARNING: No nightly start time found please set in CTestConfig.cmake"
|
||||
" or DartConfig.cmake" << std::endl, quiet);
|
||||
cmCTestOptionalLog(this, DEBUG, "Here: " << __LINE__ << std::endl,
|
||||
quiet);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -507,8 +512,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
|
|||
cmMakefile *mf = lg->GetMakefile();
|
||||
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
|
||||
{
|
||||
cmCTestLog(this, DEBUG, "Cannot find custom configuration file tree"
|
||||
<< std::endl);
|
||||
cmCTestOptionalLog(this, DEBUG,
|
||||
"Cannot find custom configuration file tree" << std::endl, quiet);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -583,9 +588,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
|
|||
}
|
||||
if (tag.empty() || (0 != command) || this->Parts[PartStart])
|
||||
{
|
||||
cmCTestLog(this, DEBUG, "TestModel: " << this->GetTestModelString()
|
||||
<< std::endl);
|
||||
cmCTestLog(this, DEBUG, "TestModel: " << this->TestModel << std::endl);
|
||||
cmCTestOptionalLog(this, DEBUG, "TestModel: " <<
|
||||
this->GetTestModelString() << std::endl, quiet);
|
||||
cmCTestOptionalLog(this, DEBUG, "TestModel: " <<
|
||||
this->TestModel << std::endl, quiet);
|
||||
if ( this->TestModel == cmCTest::NIGHTLY )
|
||||
{
|
||||
lctime = this->GetNightlyTime(
|
||||
|
@ -609,8 +615,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
|
|||
ofs.close();
|
||||
if ( 0 == command )
|
||||
{
|
||||
cmCTestLog(this, OUTPUT, "Create new tag: " << tag << " - "
|
||||
<< this->GetTestModelString() << std::endl);
|
||||
cmCTestOptionalLog(this, OUTPUT, "Create new tag: " << tag << " - "
|
||||
<< this->GetTestModelString() << std::endl, quiet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -630,8 +636,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
|
|||
return 0;
|
||||
}
|
||||
|
||||
cmCTestLog(this, OUTPUT, " Use existing tag: " << tag << " - "
|
||||
<< this->GetTestModelString() << std::endl);
|
||||
cmCTestOptionalLog(this, OUTPUT, " Use existing tag: " << tag << " - "
|
||||
<< this->GetTestModelString() << std::endl, quiet);
|
||||
}
|
||||
|
||||
this->CurrentTag = tag;
|
||||
|
@ -675,8 +681,8 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
|
|||
|
||||
if ( !fname.empty() )
|
||||
{
|
||||
cmCTestLog(this, OUTPUT, " Reading ctest configuration file: "
|
||||
<< fname << std::endl);
|
||||
cmCTestOptionalLog(this, OUTPUT, " Reading ctest configuration file: "
|
||||
<< fname << std::endl, command->ShouldBeQuiet());
|
||||
bool readit = mf->ReadListFile(mf->GetCurrentListFile(),
|
||||
fname.c_str() );
|
||||
if(!readit)
|
||||
|
@ -689,19 +695,20 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
|
|||
}
|
||||
else
|
||||
{
|
||||
cmCTestLog(this, WARNING,
|
||||
cmCTestOptionalLog(this, WARNING,
|
||||
"Cannot locate CTest configuration: in BuildDirectory: "
|
||||
<< bld_dir_fname << std::endl);
|
||||
cmCTestLog(this, WARNING,
|
||||
<< bld_dir_fname << std::endl, command->ShouldBeQuiet());
|
||||
cmCTestOptionalLog(this, WARNING,
|
||||
"Cannot locate CTest configuration: in SourceDirectory: "
|
||||
<< src_dir_fname << std::endl);
|
||||
<< src_dir_fname << std::endl, command->ShouldBeQuiet());
|
||||
}
|
||||
|
||||
this->SetCTestConfigurationFromCMakeVariable(mf, "NightlyStartTime",
|
||||
"CTEST_NIGHTLY_START_TIME");
|
||||
this->SetCTestConfigurationFromCMakeVariable(mf, "Site", "CTEST_SITE");
|
||||
"CTEST_NIGHTLY_START_TIME", command->ShouldBeQuiet());
|
||||
this->SetCTestConfigurationFromCMakeVariable(mf, "Site", "CTEST_SITE",
|
||||
command->ShouldBeQuiet());
|
||||
this->SetCTestConfigurationFromCMakeVariable(mf, "BuildName",
|
||||
"CTEST_BUILD_NAME");
|
||||
"CTEST_BUILD_NAME", command->ShouldBeQuiet());
|
||||
const char* dartVersion = mf->GetDefinition("CTEST_DART_SERVER_VERSION");
|
||||
if ( dartVersion )
|
||||
{
|
||||
|
@ -720,8 +727,9 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
cmCTestLog(this, OUTPUT, " Use " << this->GetTestModelString()
|
||||
<< " tag: " << this->GetCurrentTag() << std::endl);
|
||||
cmCTestOptionalLog(this, OUTPUT, " Use " << this->GetTestModelString()
|
||||
<< " tag: " << this->GetCurrentTag() << std::endl,
|
||||
command->ShouldBeQuiet());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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_start)
|
||||
add_RunCMake_test(ctest_submit)
|
||||
add_RunCMake_test(file)
|
||||
add_RunCMake_test(find_library)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.1)
|
||||
project(CTestStart@CASE_NAME@ NONE)
|
||||
include(CTest)
|
||||
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
|
|
@ -0,0 +1 @@
|
|||
set(CTEST_PROJECT_NAME "CTestStart@CASE_NAME@")
|
|
@ -0,0 +1,10 @@
|
|||
include(RunCTest)
|
||||
|
||||
set(CASE_CTEST_START_ARGS "")
|
||||
|
||||
function(run_ctest_start CASE_NAME)
|
||||
set(CASE_CTEST_START_ARGS "${ARGN}")
|
||||
run_ctest(${CASE_NAME})
|
||||
endfunction()
|
||||
|
||||
run_ctest_start(StartQuiet Experimental QUIET)
|
|
@ -0,0 +1 @@
|
|||
^$
|
|
@ -0,0 +1,13 @@
|
|||
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_start_args "@CASE_CTEST_START_ARGS@")
|
||||
ctest_start(${ctest_start_args})
|
Loading…
Reference in New Issue