BUG: Improve the behavior of the ReadCustomFilesCommand

This commit is contained in:
Andy Cedilnik 2006-04-09 07:45:18 -04:00
parent 2238e22699
commit 55c0ff5f64
4 changed files with 50 additions and 27 deletions

View File

@ -311,6 +311,7 @@ int cmCTestBuildHandler::ProcessHandler()
{
this->CustomWarningMatches.push_back(cmCTestWarningMatches[cc]);
}
for ( cc = 0; cmCTestWarningExceptions[cc]; cc ++ )
{
this->CustomWarningExceptions.push_back(cmCTestWarningExceptions[cc]);
@ -321,8 +322,12 @@ int cmCTestBuildHandler::ProcessHandler()
#define cmCTestBuildHandlerPopulateRegexVector(strings, regexes) \
regexes.clear(); \
cmCTestLog(this->CTest, DEBUG, this << "Add " #regexes \
<< std::endl); \
for ( it = strings.begin(); it != strings.end(); ++it ) \
{ \
cmCTestLog(this->CTest, DEBUG, "Add " #strings ": " \
<< it->c_str() << std::endl); \
regexes.push_back(it->c_str()); \
}
cmCTestBuildHandlerPopulateRegexVector(

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
@ -30,9 +30,10 @@ bool cmCTestReadCustomFilesCommand::InitialPass(
std::vector<std::string>::const_iterator dit;
for ( dit = args.begin(); dit != args.end(); ++ dit )
{
this->CTest->ReadCustomConfigurationFileTree(dit->c_str());
this->CTest->ReadCustomConfigurationFileTree(dit->c_str(),
this->Makefile);
}
return true;
}

View File

@ -312,7 +312,13 @@ int cmCTest::Initialize(const char* binary_dir, bool new_tag,
}
}
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str()) )
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg);
cmMakefile *mf = lg->GetMakefile();
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), mf) )
{
cmCTestLog(this, DEBUG, "Cannot find custom configuration file tree"
<< std::endl);
@ -1907,35 +1913,40 @@ void cmCTest::SetNotesFiles(const char* notes)
}
//----------------------------------------------------------------------
int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf,
bool fast /* = false */)
{
bool found = false;
VectorOfStrings dirs;
VectorOfStrings ndirs;
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg);
cmMakefile *mf = lg->GetMakefile();
cmCTestLog(this, DEBUG, "* Read custom CTest configuration directory: "
<< dir << std::endl);
bool found = false;
std::string fname = dir;
fname += "/CTestCustom.cmake";
if ( cmSystemTools::FileExists(fname.c_str()) )
if ( !fast )
{
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
std::string fname = dir;
fname += "/CTestCustom.cmake";
cmCTestLog(this, DEBUG, "* Check for file: "
<< fname.c_str() << std::endl);
if ( !lg->GetMakefile()->ReadListFile(0, fname.c_str()) ||
cmSystemTools::GetErrorOccuredFlag() )
if ( cmSystemTools::FileExists(fname.c_str()) )
{
cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: "
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
<< fname.c_str() << std::endl);
if ( !mf->ReadListFile(0, fname.c_str()) ||
cmSystemTools::GetErrorOccuredFlag() )
{
cmCTestLog(this, ERROR_MESSAGE,
"Problem reading custom configuration: "
<< fname.c_str() << std::endl);
}
found = true;
}
found = true;
}
std::string rexpr = dir;
rexpr += "/CTestCustom.ctest";
cmCTestLog(this, DEBUG, "* Check for file: "
<< rexpr.c_str() << std::endl);
if ( !found && cmSystemTools::FileExists(rexpr.c_str()) )
{
cmsys::Glob gl;
@ -1948,10 +1959,11 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
{
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
<< fileIt->c_str() << std::endl);
if ( !lg->GetMakefile()->ReadListFile(0, fileIt->c_str()) ||
if ( !mf->ReadListFile(0, fileIt->c_str()) ||
cmSystemTools::GetErrorOccuredFlag() )
{
cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: "
cmCTestLog(this, ERROR_MESSAGE,
"Problem reading custom configuration: "
<< fileIt->c_str() << std::endl);
}
}
@ -1961,8 +1973,12 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
if ( found )
{
cmCTest::t_TestingHandlers::iterator it;
for ( it = this->TestingHandlers.begin(); it != this->TestingHandlers.end(); ++ it )
for ( it = this->TestingHandlers.begin();
it != this->TestingHandlers.end(); ++ it )
{
cmCTestLog(this, DEBUG,
"* Read custom CTest configuration vectors for handler: "
<< it->first.c_str() << " (" << it->second << ")" << std::endl);
it->second->PopulateCustomVectors(mf);
}
}

View File

@ -291,9 +291,10 @@ public:
SetOfStrings* GetSubmitFiles() { return &this->SubmitFiles; }
//! Read the custom configuration files and apply them to the current ctest
int ReadCustomConfigurationFileTree(const char* dir);
int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf,
bool fast = false);
std::vector<cmStdString> &GetInitialCommandLineArguments()
std::vector<cmStdString> &GetInitialCommandLineArguments()
{ return this->InitialCommandLineArguments; };
private:
@ -387,7 +388,7 @@ private:
std::set<cmStdString> SubmitFiles;
std::vector<cmStdString> InitialCommandLineArguments;
int SubmitIndex;
cmGeneratedFileStream* OutputLogFile;