diff options
author | Ken Martin <ken.martin@kitware.com> | 2004-04-16 18:52:13 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2004-04-16 18:52:13 (GMT) |
commit | 5c618442d39c424f6cdeea3ed6b76b80e9a2e4b1 (patch) | |
tree | eb224e16aa5d1d1de1ee9fa0d6dbe959dcf71ff8 /Source | |
parent | 4c9c3ac84fb5a72d7f7c7882358abf0ad9c95dd9 (diff) | |
download | CMake-5c618442d39c424f6cdeea3ed6b76b80e9a2e4b1.zip CMake-5c618442d39c424f6cdeea3ed6b76b80e9a2e4b1.tar.gz CMake-5c618442d39c424f6cdeea3ed6b76b80e9a2e4b1.tar.bz2 |
better args handling for -I option
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCTest.cxx | 49 | ||||
-rw-r--r-- | Source/cmCTest.h | 2 |
2 files changed, 36 insertions, 15 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1ccf48f..b2fa28f 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2005,6 +2005,9 @@ void cmCTest::ProcessDirectory(cmCTest::tm_VectorOfStrings &passed, << std::endl; } + // expand the test list + this->ExpandTestsToRunInformation((int)tmsize); + int cnt = 0; tm_ListOfTests::iterator it; std::string last_directory = ""; @@ -4839,7 +4842,7 @@ inline int GetNextNumber(std::string const& in, void cmCTest::SetTestsToRunInformation(const char* in) { - std::string testArgs = in; + this->TestsToRunString = in; // if the argument is a file, then read it and use the contents as the string if(cmSystemTools::FileExists(in)) { @@ -4848,25 +4851,29 @@ void cmCTest::SetTestsToRunInformation(const char* in) char* buff = new char[filelen+1]; fin.getline(buff, filelen); buff[fin.gcount()] = 0; - testArgs = buff; + this->TestsToRunString = buff; } +} + +void cmCTest::ExpandTestsToRunInformation(int numTests) +{ int start = -1; int end = -1; int stride = -1; std::string::size_type pos = 0; std::string::size_type pos2; // read start - if(GetNextNumber(testArgs, start, pos, pos2)) + if(GetNextNumber(this->TestsToRunString, start, pos, pos2)) { // read end - if(GetNextNumber(testArgs, end, pos, pos2)) + if(GetNextNumber(this->TestsToRunString, end, pos, pos2)) { // read stride - if(GetNextNumber(testArgs, stride, pos, pos2)) + if(GetNextNumber(this->TestsToRunString, stride, pos, pos2)) { int val =0; // now read specific numbers - while(GetNextNumber(testArgs, val, pos, pos2)) + while(GetNextNumber(this->TestsToRunString, val, pos, pos2)) { m_TestsToRun.push_back(val); } @@ -4874,25 +4881,37 @@ void cmCTest::SetTestsToRunInformation(const char* in) } } } + + // if start and specific tests are not specified then we assume we start at + // 1 + if(start == -1 && !m_TestsToRun.size()) + { + start = 1; + } + + // if end and specific tests are not specified then we assume we end with + // the last test + if(end == -1 && !m_TestsToRun.size()) + { + end = numTests; + } + + // if the stride wasn't specified then it defaults to 1 if(stride == -1) { stride = 1; } - if(end != -1 && start != -1 && stride != 0 && stride != -1) + + // if we have a range then add it + if(end != -1 && start != -1) { for(int i =start; i <= end; i+= stride) { m_TestsToRun.push_back(i); } } - else - { - if(start != -1) - { - m_TestsToRun.push_back(start); - } - } - // sort the array + + // sort the array std::sort(m_TestsToRun.begin(), m_TestsToRun.end(), std::less<int>()); // remove duplicates std::vector<int>::iterator new_end = diff --git a/Source/cmCTest.h b/Source/cmCTest.h index e2fa0fa..b0d06c4 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -158,6 +158,8 @@ public: private: void SetTestsToRunInformation(const char*); + void ExpandTestsToRunInformation(int numPossibleTests); + std::string TestsToRunString; enum { FIRST_TEST = 0, |