diff options
author | Ken Martin <ken.martin@kitware.com> | 2001-08-29 20:42:03 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2001-08-29 20:42:03 (GMT) |
commit | 08a89bd8dc87fb904d10a0b1718e7c61da725c12 (patch) | |
tree | 971e8f298073ec4d06d7d9864493bb89cf5bb704 /Source/ctest.cxx | |
parent | 8d681d47935089a64e13c30a4b2714a938c1ac91 (diff) | |
download | CMake-08a89bd8dc87fb904d10a0b1718e7c61da725c12.zip CMake-08a89bd8dc87fb904d10a0b1718e7c61da725c12.tar.gz CMake-08a89bd8dc87fb904d10a0b1718e7c61da725c12.tar.bz2 |
added regexp option
Diffstat (limited to 'Source/ctest.cxx')
-rw-r--r-- | Source/ctest.cxx | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/Source/ctest.cxx b/Source/ctest.cxx index dad35d0..36009e5 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -1,5 +1,6 @@ #include <stdio.h> #include "ctest.h" +#include "cmRegularExpression.h" bool TryExecutable(const char *dir, const char *file, std::string *fullPath, const char *subdir) @@ -103,6 +104,8 @@ void ctest::ProcessDirectory(int &passed, int &failed) std::string name; std::vector<std::string> args; + cmRegularExpression var(this->m_RegExp.c_str()); + while ( fin ) { if(cmSystemTools::ParseFunction(fin, name, args)) @@ -125,9 +128,13 @@ void ctest::ProcessDirectory(int &passed, int &failed) // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); } - + if (name == "ADD_TEST") { + if (this->m_UseRegExp && !var.find(args[0].c_str())) + { + continue; + } fprintf(stderr,"Testing %-30s ",args[0].c_str()); //std::cerr << "Testing " << args[0] << " ... "; // find the test executable @@ -150,7 +157,7 @@ void ctest::ProcessDirectory(int &passed, int &failed) if (!cmSystemTools::RunCommand(testCommand.c_str(), output, retVal, false) || retVal != 0) { - std::cerr << " Failed\n"; + fprintf(stderr,"***Failed\n"); if (output != "") { std::cerr << output.c_str() << "\n"; @@ -159,7 +166,7 @@ void ctest::ProcessDirectory(int &passed, int &failed) } else { - std::cerr << " Passed\n"; + fprintf(stderr," Passed\n"); if (output != "") { std::cerr << output.c_str() << "\n"; @@ -182,6 +189,23 @@ int main (int argc, char *argv[]) ctest inst; + // look at the args + std::vector<std::string> args; + for(int i =0; i < argc; ++i) + { + args.push_back(argv[i]); + } + + for(unsigned int i=1; i < args.size(); ++i) + { + std::string arg = args[i]; + if(arg.find("-R",0) == 0 && i < args.size() - 1) + { + inst.m_UseRegExp = true; + inst.m_RegExp = args[i+1]; + } + } + // call process directory inst.ProcessDirectory(passed, failed); total = passed + failed; |