Commit 513d48c5 authored by Sebastien Barre's avatar Sebastien Barre
Browse files

ENH: Since each test can send a lot of text to stderr/stdout, ctest now...

ENH: Since each test can send a lot of text to stderr/stdout, ctest now displays the list of tests that failed at the end of the process.
parent 3c748ec5
......@@ -103,7 +103,7 @@ std::string ctest::FindExecutable(const char *exe)
}
void ctest::ProcessDirectory(int &passed, int &failed)
void ctest::ProcessDirectory(int &passed, std::vector<std::string> &failed)
{
// does the DartTestfile.txt exist ?
if(!cmSystemTools::FileExists("DartTestfile.txt"))
......@@ -141,7 +141,7 @@ void ctest::ProcessDirectory(int &passed, int &failed)
{
std::cerr << "Changing directory into " << nwd.c_str() << "\n";
cmSystemTools::ChangeDirectory(nwd.c_str());
this->ProcessDirectory(passed,failed);
this->ProcessDirectory(passed, failed);
}
}
// return to the original directory
......@@ -200,7 +200,7 @@ void ctest::ProcessDirectory(int &passed, int &failed)
std::cerr << output.c_str() << "\n";
}
}
failed++;
failed.push_back(args[0]);
}
else
{
......@@ -230,7 +230,7 @@ void ctest::ProcessDirectory(int &passed, int &failed)
int main (int argc, char *argv[])
{
int passed = 0;
int failed = 0;
std::vector<std::string> failed;
int total;
ctest inst;
......@@ -254,7 +254,7 @@ int main (int argc, char *argv[])
// call process directory
inst.ProcessDirectory(passed, failed);
total = passed + failed;
total = passed + failed.size();
if (total == 0)
{
......@@ -264,8 +264,17 @@ int main (int argc, char *argv[])
{
float percent = passed * 100.0 / total;
fprintf(stderr,"%.0f%% tests passed, %i tests failed out of %i\n",
percent,failed, total);
percent, failed.size(), total);
if (failed.size())
{
std::cerr << "The following tests failed:\n";
for(std::vector<std::string>::iterator j = failed.begin();
j != failed.end(); ++j)
{
std::cerr << "\t" << *j << "\n";
}
}
}
return failed;
return failed.size();
}
......@@ -26,7 +26,7 @@ public:
/**
* Run the test for a directory and any subdirectories
*/
void ProcessDirectory(int &passed, int &failed);
void ProcessDirectory(int &passed, std::vector<std::string> &failed);
/**
* Find the executable for a test
......
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