BUG: Removed legacy SetupTests method that was causing RUN_TESTS to test twice.
This commit is contained in:
parent
420095c013
commit
73a5c33f9b
|
@ -1279,83 +1279,6 @@ void cmGlobalGenerator::SetCMakeInstance(cmake* cm)
|
|||
this->CMakeInstance = cm;
|
||||
}
|
||||
|
||||
void cmGlobalGenerator::SetupTests()
|
||||
{
|
||||
std::string ctest = this->LocalGenerators[0]->GetMakefile()->
|
||||
GetRequiredDefinition("CMAKE_COMMAND");
|
||||
ctest = removeQuotes(ctest);
|
||||
ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
|
||||
ctest += "/";
|
||||
ctest += "ctest";
|
||||
ctest += cmSystemTools::GetExecutableExtension();
|
||||
if(!cmSystemTools::FileExists(ctest.c_str()))
|
||||
{
|
||||
ctest = this->LocalGenerators[0]->GetMakefile()->
|
||||
GetRequiredDefinition("CMAKE_COMMAND");
|
||||
ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
|
||||
ctest += "/Debug/";
|
||||
ctest += "ctest";
|
||||
ctest += cmSystemTools::GetExecutableExtension();
|
||||
}
|
||||
if(!cmSystemTools::FileExists(ctest.c_str()))
|
||||
{
|
||||
ctest = this->LocalGenerators[0]->GetMakefile()->
|
||||
GetRequiredDefinition("CMAKE_COMMAND");
|
||||
ctest = cmSystemTools::GetFilenamePath(ctest.c_str());
|
||||
ctest += "/Release/";
|
||||
ctest += "ctest";
|
||||
ctest += cmSystemTools::GetExecutableExtension();
|
||||
}
|
||||
// if we found ctest
|
||||
if (cmSystemTools::FileExists(ctest.c_str()))
|
||||
{
|
||||
// Create a full path filename for output Testfile
|
||||
std::string fname;
|
||||
fname = this->CMakeInstance->GetStartOutputDirectory();
|
||||
fname += "/";
|
||||
if ( this->LocalGenerators[0]->GetMakefile()->IsSet("CTEST_NEW_FORMAT") )
|
||||
{
|
||||
fname += "CTestTestfile.txt";
|
||||
}
|
||||
else
|
||||
{
|
||||
fname += "DartTestfile.txt";
|
||||
}
|
||||
|
||||
// Add run_test only if any tests are foun
|
||||
size_t total_tests = 0;
|
||||
size_t i;
|
||||
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
||||
{
|
||||
total_tests +=
|
||||
this->LocalGenerators[i]->GetMakefile()->GetTests()->size();
|
||||
}
|
||||
|
||||
// If the file doesn't exist, then ENABLE_TESTING hasn't been run
|
||||
if (total_tests > 0)
|
||||
{
|
||||
const char* no_working_dir = 0;
|
||||
std::vector<std::string> no_depends;
|
||||
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
|
||||
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
|
||||
{
|
||||
std::vector<cmLocalGenerator*>& gen = it->second;
|
||||
// add the RUN_TESTS to the first local generator of each project
|
||||
if(gen.size())
|
||||
{
|
||||
cmMakefile* mf = gen[0]->GetMakefile();
|
||||
if(const char* outDir = mf->GetDefinition("CMAKE_CFG_INTDIR"))
|
||||
{
|
||||
mf->AddUtilityCommand("RUN_TESTS", false, no_depends,
|
||||
no_working_dir,
|
||||
ctest.c_str(), "-C", outDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
|
||||
{
|
||||
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
|
||||
|
|
|
@ -211,7 +211,6 @@ protected:
|
|||
|
||||
void ConfigureRelativePaths();
|
||||
bool RelativePathsConfigured;
|
||||
void SetupTests();
|
||||
|
||||
void CreateDefaultGlobalTargets(cmTargets* targets);
|
||||
cmTarget CreateGlobalTarget(const char* name, const char* message,
|
||||
|
|
|
@ -178,9 +178,6 @@ void cmGlobalVisualStudio6Generator::Generate()
|
|||
}
|
||||
}
|
||||
|
||||
// add the Run Tests command
|
||||
this->SetupTests();
|
||||
|
||||
// first do the superclass method
|
||||
this->cmGlobalGenerator::Generate();
|
||||
|
||||
|
|
|
@ -235,9 +235,6 @@ void cmGlobalVisualStudio7Generator::Generate()
|
|||
}
|
||||
}
|
||||
|
||||
// add the Run Tests command
|
||||
this->SetupTests();
|
||||
|
||||
// first do the superclass method
|
||||
this->cmGlobalGenerator::Generate();
|
||||
|
||||
|
|
Loading…
Reference in New Issue