summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xselftest/selftest.pl10
-rw-r--r--selftest/wscript4
2 files changed, 13 insertions, 1 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index b50853e54d..ffb61495a9 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -42,6 +42,7 @@ my $opt_quick = 0;
my $opt_socket_wrapper = 0;
my $opt_socket_wrapper_pcap = undef;
my $opt_socket_wrapper_keep_pcap = undef;
+my $opt_random_order = 0;
my $opt_one = 0;
my @opt_exclude = ();
my @opt_include = ();
@@ -236,8 +237,9 @@ my $result = GetOptions (
'ldap:s' => \$ldap,
'resetup-environment' => \$opt_resetup_env,
'testlist=s' => \@testlists,
+ 'random-order' => \$opt_random_order,
'load-list=s' => \$opt_load_list,
- 'binary-mapping=s' => \$opt_binary_mapping
+ 'binary-mapping=s' => \$opt_binary_mapping
);
exit(1) if (not $result);
@@ -825,6 +827,12 @@ sub teardown_env($)
# This 'global' file needs to be empty when we start
unlink("$prefix_abs/dns_host_file");
+if ($opt_random_order) {
+ require List::Util;
+ my @newtodo = List::Util::shuffle(@todo);
+ @todo = @newtodo;
+}
+
if ($opt_testenv) {
my $testenv_name = $ENV{SELFTEST_TESTENV};
$testenv_name = $testenv_default unless defined($testenv_name);
diff --git a/selftest/wscript b/selftest/wscript
index 9ea2f6fdd4..a5b2e5358f 100644
--- a/selftest/wscript
+++ b/selftest/wscript
@@ -69,6 +69,8 @@ def set_options(opt):
gr.add_option('--socket-wrapper-keep-pcap',
help=("create a pcap file for all individual test"),
action="store_true", dest='SOCKET_WRAPPER_KEEP_PCAP', default=False)
+ gr.add_option('--random-order', dest='RANDOM_ORDER', default=False,
+ action="store_true", help="Run testsuites in random order")
def configure(conf):
conf.env.SELFTEST_PREFIX = Options.options.SELFTEST_PREFIX
@@ -134,6 +136,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.RANDOM_ORDER:
+ env.OPTIONS += ' --random-order'
if os.environ.get('RUN_FROM_BUILD_FARM') is not None:
env.FILTER_OPTIONS = '${FILTER_XFAIL} --strip-passed-output'
else: