From 55c0ff5f649e4cafdae1d50472ab1d976cc80120 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Sun, 9 Apr 2006 07:45:18 -0400 Subject: BUG: Improve the behavior of the ReadCustomFilesCommand --- Source/CTest/cmCTestBuildHandler.cxx | 5 +++ Source/CTest/cmCTestReadCustomFilesCommand.cxx | 9 +++-- Source/cmCTest.cxx | 56 +++++++++++++++++--------- Source/cmCTest.h | 7 ++-- 4 files changed, 50 insertions(+), 27 deletions(-) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index e1011da..abd8ddd 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -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( diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index a381095..88d9b87 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -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::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; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index c5ad1f4..018b678 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -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 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 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); } } diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 37e05e9..b73f8ce 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -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 &GetInitialCommandLineArguments() + std::vector &GetInitialCommandLineArguments() { return this->InitialCommandLineArguments; }; private: @@ -387,7 +388,7 @@ private: std::set SubmitFiles; std::vector InitialCommandLineArguments; - + int SubmitIndex; cmGeneratedFileStream* OutputLogFile; -- cgit v0.12