From e6974b0ff0100bb292d57e58ae11bc2e6b0d4053 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 9 Dec 2010 14:46:09 +0100 Subject: selftest: add --list option. --- selftest/selftest.pl | 20 ++++++++++++++++++++ source4/selftest/wscript | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 568850189d..2ba68d284b 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -153,6 +153,7 @@ my @opt_include = (); my $opt_verbose = 0; my $opt_image = undef; my $opt_testenv = 0; +my $opt_list = 0; my $ldap = undef; my $opt_resetup_env = undef; my $opt_bindir = undef; @@ -326,6 +327,7 @@ Behaviour: --one abort when the first test fails --verbose be verbose --testenv run a shell in the requested test environment + --list list available tests "; exit(0); } @@ -346,6 +348,7 @@ my $result = GetOptions ( 'exeext=s' => \$exeext, 'verbose' => \$opt_verbose, 'testenv' => \$opt_testenv, + 'list' => \$opt_list, 'ldap:s' => \$ldap, 'resetup-environment' => \$opt_resetup_env, 'bindir:s' => \$opt_bindir, @@ -358,6 +361,8 @@ exit(1) if (not $result); ShowHelp() if ($opt_help); +die("--list and --testenv are mutually exclusive") if ($opt_list and $opt_testenv); + # we want unbuffered output $| = 1; @@ -940,6 +945,21 @@ SMB_CONF_PATH=\$SMB_CONF_PATH $envvarstr \" && LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} bash'"); teardown_env($testenv_name); +} elsif ($opt_list) { + foreach (@todo) { + my $cmd = $$_[2]; + my $name = $$_[0]; + my $envname = $$_[1]; + + unless($cmd =~ /\$LIST/) { + warn("Unable to list tests in $name"); + next; + } + + $cmd =~ s/\$LIST/--list/; + + system($cmd); + } } else { foreach (@todo) { $i++; diff --git a/source4/selftest/wscript b/source4/selftest/wscript index e6b75d10f4..7020779baf 100644 --- a/source4/selftest/wscript +++ b/source4/selftest/wscript @@ -24,6 +24,9 @@ def set_options(opt): gr.add_option('--load-list', help=("Load a test id list from a text file"), action="store", dest='LOAD_LIST', default=None) + gr.add_option('--list', + help=("List available tests"), + action="store_true", dest='LIST', default=False) gr.add_option('--tests', help=("wildcard pattern of tests to run"), action="store", dest='TESTS', default='') @@ -111,7 +114,8 @@ def cmd_testonly(opt): env.OPTIONS += ' --socket-wrapper-pcap' if Options.options.SOCKET_WRAPPER_KEEP_PCAP: env.OPTIONS += ' --socket-wrapper-keep-pcap' - + if Options.options.LIST: + env.OPTIONS += ' --list' if os.environ.get('RUN_FROM_BUILD_FARM') is not None: env.FILTER_OPTIONS = '${FILTER_XFAIL} --strip-passed-output' else: -- cgit