summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestTestHandler.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2004-11-13 14:55:31 (GMT)
committerKen Martin <ken.martin@kitware.com>2004-11-13 14:55:31 (GMT)
commit5a0366c6e0415294dde67b4bd2167d1cbf5d9ff1 (patch)
tree24585d0edb451644a77305b5362037bdcad75827 /Source/CTest/cmCTestTestHandler.cxx
parent247c367a59552be299583cf77705709ae972a295 (diff)
downloadCMake-5a0366c6e0415294dde67b4bd2167d1cbf5d9ff1.zip
CMake-5a0366c6e0415294dde67b4bd2167d1cbf5d9ff1.tar.gz
CMake-5a0366c6e0415294dde67b4bd2167d1cbf5d9ff1.tar.bz2
ENH: added -U option to take union of -R and -I
Diffstat (limited to 'Source/CTest/cmCTestTestHandler.cxx')
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx100
1 files changed, 63 insertions, 37 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index e6c8aef..5839ac7 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -193,7 +193,8 @@ cmCTestTestHandler::cmCTestTestHandler()
{
m_Verbose = false;
m_CTest = 0;
-
+ m_UseUnion = false;
+
m_UseIncludeRegExp = false;
m_UseExcludeRegExp = false;
m_UseExcludeRegExpFirst = false;
@@ -381,15 +382,36 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
<< std::endl;
}
- // expand the test list
- this->ExpandTestsToRunInformation((int)tmsize);
+ // how many tests are in based on RegExp?
+ int inREcnt = 0;
+ tm_ListOfTests::iterator it;
+ for ( it = testlist.begin(); it != testlist.end(); it ++ )
+ {
+ if (it->m_IsInBasedOnREOptions)
+ {
+ inREcnt ++;
+ }
+ }
+ // expand the test list based on the union flag
+ if (m_UseUnion)
+ {
+ this->ExpandTestsToRunInformation((int)tmsize);
+ }
+ else
+ {
+ this->ExpandTestsToRunInformation(inREcnt);
+ }
int cnt = 0;
- tm_ListOfTests::iterator it;
+ inREcnt = 0;
std::string last_directory = "";
for ( it = testlist.begin(); it != testlist.end(); it ++ )
{
cnt ++;
+ if (it->m_IsInBasedOnREOptions)
+ {
+ inREcnt++;
+ }
const std::string& testname = it->m_Name;
tm_VectorOfListFileArgs& args = it->m_Args;
cmCTestTestResult cres;
@@ -408,30 +430,41 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
}
cres.m_Name = testname;
cres.m_Path = it->m_Directory.c_str();
- if(m_TestsToRun.size() &&
- std::find(m_TestsToRun.begin(), m_TestsToRun.end(), cnt) == m_TestsToRun.end())
+
+ if (m_UseUnion)
{
- continue;
+ // if it is not in the list and not in the regexp then skip
+ if ((m_TestsToRun.size() &&
+ std::find(m_TestsToRun.begin(), m_TestsToRun.end(), cnt)
+ == m_TestsToRun.end()) && !it->m_IsInBasedOnREOptions)
+ {
+ continue;
+ }
}
+ else
+ {
+ // is this test in the list of tests to run? If not then skip it
+ if ((m_TestsToRun.size() &&
+ std::find(m_TestsToRun.begin(), m_TestsToRun.end(), inREcnt)
+ == m_TestsToRun.end()) || !it->m_IsInBasedOnREOptions)
+ {
+ continue;
+ }
+ }
+
+ std::cerr.width(3);
+ std::cerr << cnt << "/";
+ std::cerr.width(3);
+ std::cerr << tmsize << " Testing ";
+ std::string outname = testname;
+ outname.resize(30, ' ');
if ( m_CTest->GetShowOnly() )
{
- std::cerr.width(3);
- std::cerr << cnt << "/";
- std::cerr.width(3);
- std::cerr << tmsize << " Testing ";
- std::string outname = testname;
- outname.resize(30, ' ');
std::cerr << outname.c_str() << "\n";
- }
+ }
else
{
- std::cerr.width(3);
- std::cerr << cnt << "/";
- std::cerr.width(3);
- std::cerr << tmsize << " Testing ";
- std::string outname = testname;
- outname.resize(30, ' ');
std::cerr << outname.c_str();
std::cerr.flush();
}
@@ -1121,22 +1154,21 @@ void cmCTestTestHandler::GetListOfTests(tm_ListOfTests* testlist,
}
}
-
+ cmCTestTestProperties test;
+ test.m_Name = testname;
+ test.m_Args = args;
+ test.m_Directory = cmSystemTools::GetCurrentWorkingDirectory();
+ test.m_IsInBasedOnREOptions = true;
if (this->m_UseIncludeRegExp && !ireg.find(testname.c_str()))
{
- continue;
+ test.m_IsInBasedOnREOptions = false;
}
- if (this->m_UseExcludeRegExp &&
- !this->m_UseExcludeRegExpFirst &&
- ereg.find(testname.c_str()))
+ else if (this->m_UseExcludeRegExp &&
+ !this->m_UseExcludeRegExpFirst &&
+ ereg.find(testname.c_str()))
{
- continue;
+ test.m_IsInBasedOnREOptions = false;
}
-
- cmCTestTestProperties test;
- test.m_Name = testname;
- test.m_Args = args;
- test.m_Directory = cmSystemTools::GetCurrentWorkingDirectory();
testlist->push_back(test);
}
}
@@ -1244,12 +1276,6 @@ void cmCTestTestHandler::ExpandTestsToRunInformation(int numTests)
std::vector<int>::iterator new_end =
std::unique(m_TestsToRun.begin(), m_TestsToRun.end());
m_TestsToRun.erase(new_end, m_TestsToRun.end());
- std::cout << "Running tests: ";
- for(unsigned int i =0; i < m_TestsToRun.size(); ++i)
- {
- std::cout << m_TestsToRun[i] << " ";
- }
- std::cout << "\n";
}
#define SPACE_REGEX "[ \t\r\n]"