ENH: add -E option (exclude tests matching a regexp)

This commit is contained in:
Sebastien Barre 2002-03-06 17:58:44 -05:00
parent 3ed2e6d02b
commit e64c63cc90
2 changed files with 36 additions and 7 deletions

View File

@ -134,7 +134,8 @@ void ctest::ProcessDirectory(int &passed, std::vector<std::string> &failed)
std::string name;
std::vector<std::string> args;
cmRegularExpression var(this->m_RegExp.c_str());
cmRegularExpression ireg(this->m_IncludeRegExp.c_str());
cmRegularExpression ereg(this->m_ExcludeRegExp.c_str());
cmRegularExpression dartStuff("([\t\n ]*<DartMeasurement.*/DartMeasurement[a-zA-Z]*>[\t ]*[\n]*)");
bool parseError;
@ -164,7 +165,19 @@ void ctest::ProcessDirectory(int &passed, std::vector<std::string> &failed)
if (name == "ADD_TEST")
{
if (this->m_UseRegExp && !var.find(args[0].c_str()))
if (this->m_UseExcludeRegExp &&
this->m_UseExcludeRegExpFirst &&
ereg.find(args[0].c_str()))
{
continue;
}
if (this->m_UseIncludeRegExp && !ireg.find(args[0].c_str()))
{
continue;
}
if (this->m_UseExcludeRegExp &&
!this->m_UseExcludeRegExpFirst &&
ereg.find(args[0].c_str()))
{
continue;
}
@ -265,8 +278,15 @@ int main (int argc, char *argv[])
if(arg.find("-R",0) == 0 && i < args.size() - 1)
{
inst.m_UseRegExp = true;
inst.m_RegExp = args[i+1];
inst.m_UseIncludeRegExp = true;
inst.m_IncludeRegExp = args[i+1];
}
if(arg.find("-E",0) == 0 && i < args.size() - 1)
{
inst.m_UseExcludeRegExp = true;
inst.m_ExcludeRegExp = args[i+1];
inst.m_UseExcludeRegExpFirst = inst.m_UseIncludeRegExp ? false : true;
}
}

View File

@ -36,10 +36,19 @@ public:
/**
* constructor
*/
ctest() {m_UseRegExp = false;}
ctest() {
m_UseIncludeRegExp = false;
m_UseExcludeRegExp = false;
m_UseExcludeRegExpFirst = false;
}
bool m_UseIncludeRegExp;
std::string m_IncludeRegExp;
bool m_UseExcludeRegExp;
bool m_UseExcludeRegExpFirst;
std::string m_ExcludeRegExp;
bool m_UseRegExp;
std::string m_RegExp;
std::string m_ConfigType;
private:
};