From ba4886b717d4c72f4b7c8960862ff44af187d114 Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 3 Aug 2011 10:24:59 -0400 Subject: CTest: print failed tests in index order (#11746) This deterministic ordering makes it easier for a developer comparing the ctest output of two test runs to see what changed from run to run. Thanks to Fraser Hutchison for the patch. --- Source/CTest/cmCTestTestHandler.cxx | 10 +++++++--- Source/CTest/cmCTestTestHandler.h | 13 +++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index b824e47..078e430 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -33,6 +33,7 @@ #include #include // auto_ptr +#include //---------------------------------------------------------------------- class cmCTestSubdirCommand : public cmCommand @@ -617,9 +618,12 @@ int cmCTestTestHandler::ProcessHandler() << "The following tests FAILED:" << std::endl); this->StartLogFile("TestsFailed", ofs); - std::vector::iterator ftit; - for(ftit = this->TestResults.begin(); - ftit != this->TestResults.end(); ++ftit) + typedef std::set SetOfTests; + SetOfTests resultsSet(this->TestResults.begin(), this->TestResults.end()); + + for(SetOfTests::iterator ftit = resultsSet.begin(); + ftit != resultsSet.end(); ++ftit) { if ( ftit->Status != cmCTestTestHandler::COMPLETED ) { diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 3089d35..8e59e59 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -125,7 +125,16 @@ public: cmCTestTestProperties* Properties; }; - // add configuraitons to a search path for an executable + struct cmCTestTestResultLess + { + bool operator() (const cmCTestTestResult &lhs, + const cmCTestTestResult &rhs) const + { + return lhs.TestCount < rhs.TestCount; + } + }; + + // add configurations to a search path for an executable static void AddConfigurations(cmCTest *ctest, std::vector &attempted, std::vector &attemptedConfigs, @@ -141,7 +150,7 @@ public: typedef std::vector ListOfTests; protected: - // comput a final test list + // compute a final test list virtual int PreProcessHandler(); virtual int PostProcessHandler(); virtual void GenerateTestCommand(std::vector& args); -- cgit v0.12