Merge topic 'ctest-no-config-report-notrun'
a4ec242
CTest: Report tests not run due to unknown configuration77ddb6a
Use cascading-if for per-config test and install code
This commit is contained in:
commit
f616f263cd
|
@ -413,6 +413,30 @@ bool cmCTestRunTest::StartTest(size_t total)
|
|||
this->TestResult.Name = this->TestProperties->Name;
|
||||
this->TestResult.Path = this->TestProperties->Directory.c_str();
|
||||
|
||||
if(args.size() >= 2 && args[1] == "NOT_AVAILABLE")
|
||||
{
|
||||
this->TestProcess = new cmProcess;
|
||||
std::string msg;
|
||||
if(this->CTest->GetConfigType().empty())
|
||||
{
|
||||
msg = "Test not available without configuration.";
|
||||
msg += " (Missing \"-C <config>\"?)";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Test not available in configuration \"";
|
||||
msg += this->CTest->GetConfigType();
|
||||
msg += "\".";
|
||||
}
|
||||
*this->TestHandler->LogFile << msg << std::endl;
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE, msg << std::endl);
|
||||
this->TestResult.Output = msg;
|
||||
this->TestResult.FullCommandLine = "";
|
||||
this->TestResult.CompletionStatus = "Not Run";
|
||||
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if all required files exist
|
||||
for(std::vector<std::string>::iterator i =
|
||||
this->TestProperties->RequiredFiles.begin();
|
||||
|
|
|
@ -1320,6 +1320,10 @@ std::string cmCTestTestHandler::FindTheExecutable(const char *exe)
|
|||
std::string resConfig;
|
||||
std::vector<std::string> extraPaths;
|
||||
std::vector<std::string> failedPaths;
|
||||
if(strcmp(exe, "NOT_AVAILABLE") == 0)
|
||||
{
|
||||
return exe;
|
||||
}
|
||||
return cmCTestTestHandler::FindExecutable(this->CTest,
|
||||
exe, resConfig,
|
||||
extraPaths,
|
||||
|
|
|
@ -209,6 +209,7 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
|
|||
// In a multi-configuration generator we produce a separate rule
|
||||
// in a block for each configuration that is built. We restrict
|
||||
// the list of configurations to those to which this rule applies.
|
||||
bool first = true;
|
||||
for(std::vector<std::string>::const_iterator i =
|
||||
this->ConfigurationTypes->begin();
|
||||
i != this->ConfigurationTypes->end(); ++i)
|
||||
|
@ -218,10 +219,19 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os,
|
|||
{
|
||||
// Generate a per-configuration block.
|
||||
std::string config_test = this->CreateConfigTest(config);
|
||||
os << indent << "IF(" << config_test << ")\n";
|
||||
os << indent << (first? "IF(" : "ELSEIF(") << config_test << ")\n";
|
||||
this->GenerateScriptForConfig(os, config, indent.Next());
|
||||
os << indent << "ENDIF(" << config_test << ")\n";
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
if(!first)
|
||||
{
|
||||
if(this->NeedsScriptNoConfig())
|
||||
{
|
||||
os << indent << "ELSE()\n";
|
||||
this->GenerateScriptNoConfig(os, indent.Next());
|
||||
}
|
||||
os << indent << "ENDIF()\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ protected:
|
|||
virtual void GenerateScriptForConfig(std::ostream& os,
|
||||
const char* config,
|
||||
Indent const& indent);
|
||||
virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {}
|
||||
virtual bool NeedsScriptNoConfig() const { return false; }
|
||||
|
||||
// Test if this generator does something for a given configuration.
|
||||
bool GeneratesForConfig(const char*);
|
||||
|
|
|
@ -129,6 +129,22 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||
os << ")\n";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os,
|
||||
Indent const& indent)
|
||||
{
|
||||
os << indent << "ADD_TEST(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmTestGenerator::NeedsScriptNoConfig() const
|
||||
{
|
||||
return (this->TestGenerated && // test generated for at least one config
|
||||
this->ActionsPerConfig && // test is config-aware
|
||||
this->Configurations.empty() && // test runs in all configs
|
||||
!this->ConfigurationTypes->empty()); // config-dependent command
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTestGenerator::GenerateOldStyle(std::ostream& fout,
|
||||
Indent const& indent)
|
||||
|
|
|
@ -34,6 +34,8 @@ protected:
|
|||
virtual void GenerateScriptForConfig(std::ostream& os,
|
||||
const char* config,
|
||||
Indent const& indent);
|
||||
virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent);
|
||||
virtual bool NeedsScriptNoConfig() const;
|
||||
void GenerateOldStyle(std::ostream& os, Indent const& indent);
|
||||
|
||||
cmTest* Test;
|
||||
|
|
|
@ -1310,7 +1310,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
|
|||
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
|
||||
--build-exe-dir "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory"
|
||||
--force-new-ctest-process
|
||||
--test-command ${CMAKE_CTEST_COMMAND} -V
|
||||
--test-command ${CMAKE_CTEST_COMMAND} -V -C \${CTEST_CONFIGURATION_TYPE}
|
||||
)
|
||||
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/TestsWorkingDirectory")
|
||||
|
||||
|
|
Loading…
Reference in New Issue