diff options
author | Marian Csontos <mcsontos@redhat.com> | 2015-11-19 10:48:17 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2015-11-19 12:00:59 +0100 |
commit | 2a23550cf3f3ecf6f3daec211e2304444170daf3 (patch) | |
tree | 20490eb830aa2d2b8cd0c9ee4dc9ecef7c430b19 | |
parent | 0614c63579b9ab6ebf68b957b4de3806f231a14c (diff) | |
download | lvm2-2a23550cf3f3ecf6f3daec211e2304444170daf3.tar.gz |
tests: add missing --skip option and S env.variable
-rw-r--r-- | test/lib/brick-shelltest.h | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/test/lib/brick-shelltest.h b/test/lib/brick-shelltest.h index cc7135f5d..be7c3feba 100644 --- a/test/lib/brick-shelltest.h +++ b/test/lib/brick-shelltest.h @@ -675,7 +675,7 @@ bool interrupt = false; struct Options { bool verbose, batch, interactive, cont, fatal_timeouts, kmsg; std::string testdir, outdir, workdir, heartbeat; - std::vector< std::string > flavours, filter, watch; + std::vector< std::string > flavours, filter, skip, watch; std::string flavour_envvar; int timeout; Options() : verbose( false ), batch( false ), interactive( false ), @@ -986,6 +986,7 @@ struct Main { Cases cases; void setup() { + bool filter; Listing l = listdir( options.testdir, true ); std::sort( l.begin(), l.end() ); @@ -997,15 +998,33 @@ struct Main { continue; if ( i->substr( 0, 4 ) == "lib/" ) continue; - bool filter = !options.filter.empty(); - for ( std::vector< std::string >::iterator filt = options.filter.begin(); - filt != options.filter.end(); ++filt ) { - if ( i->find( *filt ) != std::string::npos ) - filter = false; + if (!options.filter.empty()) { + filter = true; + for ( std::vector< std::string >::iterator filt = options.filter.begin(); + filt != options.filter.end(); ++filt ) { + if ( i->find( *filt ) != std::string::npos ) { + filter = false; + break; + } + } + if ( filter ) + continue; } - if ( filter ) - continue; + + if (!options.skip.empty()) { + filter = false; + for ( std::vector< std::string >::iterator filt = options.skip.begin(); + filt != options.skip.end(); ++filt ) { + if ( i->find( *filt ) != std::string::npos ) { + filter = true; + break; + } + } + if ( filter ) + continue; + } + cases.push_back( TestCase( journal, options, options.testdir + *i, *i, *flav ) ); cases.back().options = options; } @@ -1215,6 +1234,11 @@ static int run( int argc, const char **argv, std::string fl_envvar = "TEST_FLAVO else if ( hasenv( "T" ) ) split( getenv( "T" ), opt.filter ); + if ( args.has( "--skip" ) ) + split( args.opt( "--skip" ), opt.skip ); + else if ( hasenv( "S" ) ) + split( getenv( "S" ), opt.skip ); + if ( args.has( "--fatal-timeouts" ) ) opt.fatal_timeouts = true; |