summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Barre <sebastien.barre@kitware.com>2002-02-21 21:06:54 (GMT)
committerSebastien Barre <sebastien.barre@kitware.com>2002-02-21 21:06:54 (GMT)
commit513d48c5ea81ffd7ad53965f745a74a7a50366c9 (patch)
tree3147e446fff7012c708557f348656319bd6cea1c
parent3c748ec5ad0898298b6f368b23a13b2eba0eb54e (diff)
downloadCMake-513d48c5ea81ffd7ad53965f745a74a7a50366c9.zip
CMake-513d48c5ea81ffd7ad53965f745a74a7a50366c9.tar.gz
CMake-513d48c5ea81ffd7ad53965f745a74a7a50366c9.tar.bz2
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.
-rw-r--r--Source/ctest.cxx23
-rw-r--r--Source/ctest.h2
2 files changed, 17 insertions, 8 deletions
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index aca32af..ad76486 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -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();
}
diff --git a/Source/ctest.h b/Source/ctest.h
index 14f5e9c..251977a 100644
--- a/Source/ctest.h
+++ b/Source/ctest.h
@@ -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