Commit ba4886b7 authored by David Cole's avatar David Cole
Browse files

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.
parent 14e54c4c
......@@ -33,6 +33,7 @@
#include <float.h>
#include <memory> // auto_ptr
#include <set>
//----------------------------------------------------------------------
class cmCTestSubdirCommand : public cmCommand
......@@ -617,9 +618,12 @@ int cmCTestTestHandler::ProcessHandler()
<< "The following tests FAILED:" << std::endl);
this->StartLogFile("TestsFailed", ofs);
std::vector<cmCTestTestHandler::cmCTestTestResult>::iterator ftit;
for(ftit = this->TestResults.begin();
ftit != this->TestResults.end(); ++ftit)
typedef std::set<cmCTestTestHandler::cmCTestTestResult,
cmCTestTestResultLess> SetOfTests;
SetOfTests resultsSet(this->TestResults.begin(), this->TestResults.end());
for(SetOfTests::iterator ftit = resultsSet.begin();
ftit != resultsSet.end(); ++ftit)
{
if ( ftit->Status != cmCTestTestHandler::COMPLETED )
{
......
......@@ -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<std::string> &attempted,
std::vector<std::string> &attemptedConfigs,
......@@ -141,7 +150,7 @@ public:
typedef std::vector<cmCTestTestProperties> ListOfTests;
protected:
// comput a final test list
// compute a final test list
virtual int PreProcessHandler();
virtual int PostProcessHandler();
virtual void GenerateTestCommand(std::vector<std::string>& args);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment