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

View File

@ -9,8 +9,8 @@
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information. PURPOSE. See the above copyright notices for more information.
=========================================================================*/ =========================================================================*/
@ -30,9 +30,10 @@ bool cmCTestReadCustomFilesCommand::InitialPass(
std::vector<std::string>::const_iterator dit; std::vector<std::string>::const_iterator dit;
for ( dit = args.begin(); dit != args.end(); ++ 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; 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" cmCTestLog(this, DEBUG, "Cannot find custom configuration file tree"
<< std::endl); << 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 dirs;
VectorOfStrings ndirs; VectorOfStrings ndirs;
cmake cm; cmCTestLog(this, DEBUG, "* Read custom CTest configuration directory: "
cmGlobalGenerator gg; << dir << std::endl);
gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg);
cmMakefile *mf = lg->GetMakefile();
bool found = false; if ( !fast )
std::string fname = dir;
fname += "/CTestCustom.cmake";
if ( cmSystemTools::FileExists(fname.c_str()) )
{ {
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); << fname.c_str() << std::endl);
if ( !lg->GetMakefile()->ReadListFile(0, fname.c_str()) || if ( cmSystemTools::FileExists(fname.c_str()) )
cmSystemTools::GetErrorOccuredFlag() )
{ {
cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: " cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
<< fname.c_str() << std::endl); << 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; std::string rexpr = dir;
rexpr += "/CTestCustom.ctest"; rexpr += "/CTestCustom.ctest";
cmCTestLog(this, DEBUG, "* Check for file: "
<< rexpr.c_str() << std::endl);
if ( !found && cmSystemTools::FileExists(rexpr.c_str()) ) if ( !found && cmSystemTools::FileExists(rexpr.c_str()) )
{ {
cmsys::Glob gl; cmsys::Glob gl;
@ -1948,10 +1959,11 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
{ {
cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: "
<< fileIt->c_str() << std::endl); << fileIt->c_str() << std::endl);
if ( !lg->GetMakefile()->ReadListFile(0, fileIt->c_str()) || if ( !mf->ReadListFile(0, fileIt->c_str()) ||
cmSystemTools::GetErrorOccuredFlag() ) cmSystemTools::GetErrorOccuredFlag() )
{ {
cmCTestLog(this, ERROR_MESSAGE, "Problem reading custom configuration: " cmCTestLog(this, ERROR_MESSAGE,
"Problem reading custom configuration: "
<< fileIt->c_str() << std::endl); << fileIt->c_str() << std::endl);
} }
} }
@ -1961,8 +1973,12 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir)
if ( found ) if ( found )
{ {
cmCTest::t_TestingHandlers::iterator it; 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); it->second->PopulateCustomVectors(mf);
} }
} }

View File

@ -291,9 +291,10 @@ public:
SetOfStrings* GetSubmitFiles() { return &this->SubmitFiles; } SetOfStrings* GetSubmitFiles() { return &this->SubmitFiles; }
//! Read the custom configuration files and apply them to the current ctest //! 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; }; { return this->InitialCommandLineArguments; };
private: private:
@ -387,7 +388,7 @@ private:
std::set<cmStdString> SubmitFiles; std::set<cmStdString> SubmitFiles;
std::vector<cmStdString> InitialCommandLineArguments; std::vector<cmStdString> InitialCommandLineArguments;
int SubmitIndex; int SubmitIndex;
cmGeneratedFileStream* OutputLogFile; cmGeneratedFileStream* OutputLogFile;