0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00

./test takes a --filter option to filter out certain tests

This commit is contained in:
Eliot Horowitz 2010-06-09 12:07:32 -04:00
parent 04e67973ee
commit 3d046e9a94
2 changed files with 19 additions and 8 deletions

View File

@ -77,7 +77,7 @@ namespace mongo {
Result * Result::cur = 0;
Result * Suite::run(){
Result * Suite::run( const string& filter ){
tlogLevel = -1;
log(1) << "\t about to setupTests" << endl;
@ -92,6 +92,10 @@ namespace mongo {
for ( list<TestCase*>::iterator i=_tests.begin(); i!=_tests.end(); i++ ){
TestCase * tc = *i;
if ( filter.size() && tc->getName().find( filter ) == string::npos ){
log(1) << "\t skipping test: " << tc->getName() << " because doesn't match filter" << endl;
continue;
}
r->_tests++;
@ -157,6 +161,7 @@ namespace mongo {
"directory will be overwritten if it already exists")
("debug", "run tests with verbose output")
("list,l", "list available test suites")
("filter,f" , po::value<string>() , "string substring filter on test name" )
("verbose,v", "verbose")
("seed", po::value<unsigned long long>(&seed), "random number seed")
;
@ -239,7 +244,13 @@ namespace mongo {
if (params.count("suites")) {
suites = params["suites"].as< vector<string> >();
}
int ret = run(suites);
string filter = "";
if ( params.count( "filter" ) ){
filter = params["filter"].as<string>();
}
int ret = run(suites,filter);
#if !defined(_WIN32) && !defined(__sunos__)
flock( lockFile, LOCK_UN );
@ -250,7 +261,7 @@ namespace mongo {
return ret;
}
int Suite::run( vector<string> suites ){
int Suite::run( vector<string> suites , const string& filter ){
for ( unsigned int i = 0; i < suites.size(); i++ ) {
if ( _suites->find( suites[i] ) == _suites->end() ) {
cout << "invalid test [" << suites[i] << "], use --list to see valid names" << endl;
@ -272,7 +283,7 @@ namespace mongo {
assert( s );
log() << "going to run suite: " << name << endl;
results.push_back( s->run() );
results.push_back( s->run( filter ) );
}
Logstream::get().flush();

View File

@ -112,9 +112,9 @@ namespace mongo {
_tests.push_back( new TestHolder1<T,A>(a) );
}
Result * run();
Result * run( const string& filter );
static int run( vector<string> suites );
static int run( vector<string> suites , const string& filter );
static int run( int argc , char ** argv , string default_dbpath );