From 0b63f26bf72e5f5ce5ab6d052bc899375818a235 Mon Sep 17 00:00:00 2001 From: Jamie McClymont Date: Thu, 1 Feb 2018 17:46:37 +1300 Subject: [PATCH] selftest: change technique for running specific envs Currently testsuites excluded with --exclude/--include-env are skipped when encountered in the middle of a run, so they are included in progress reporting, and the @todo list does not accurately show what will be done. This change skips them earlier, preventing them from being added to @todo, as is done with pattern-based including/excluding. As well as making the progress indicator more accurate, this means that selftest.pl can use @todo to determine when we are finished with an environment. Signed-off-by: Jamie McClymont Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Wed Feb 21 07:47:58 CET 2018 on sn-devel-144 --- selftest/selftest.pl | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/selftest/selftest.pl b/selftest/selftest.pl index c48e1926520..fad0191e89e 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -92,6 +92,12 @@ sub skip return "environment $envname is disabled as this build does not include an AD DC"; } + if (@opt_include_env && !(grep {$_ eq $env_basename} @opt_include_env)) { + return "environment $envname is disabled (via --include-env command line option) in this test run - skipping"; + } elsif (@opt_exclude_env && grep {$_ eq $env_basename} @opt_exclude_env) { + return "environment $envname is disabled (via --exclude-env command line option) in this test run - skipping"; + } + return find_in_list(\@excludes, $name); } @@ -1102,39 +1108,13 @@ $envvarstr my $cmd = $$_[2]; my $name = $$_[0]; my $envname = $$_[1]; - my ($env_basename, $env_localpart) = split(/:/, $envname); - my $envvars = "SKIP"; + my $envvars = setup_env($envname, $prefix); - if (@opt_include_env) { - foreach my $env (@opt_include_env) { - if ($env_basename eq $env) { - $envvars = setup_env($envname, $prefix); - } - } - } elsif (@opt_exclude_env) { - my $excluded = 0; - foreach my $env (@opt_exclude_env) { - if ($env_basename eq $env) { - $excluded = 1; - } - } - if ($excluded == 0) { - $envvars = setup_env($envname, $prefix); - } - } else { - $envvars = setup_env($envname, $prefix); - } - if (not defined($envvars)) { Subunit::start_testsuite($name); Subunit::end_testsuite($name, "error", "unable to set up environment $envname - exiting"); next; - } elsif ($envvars eq "SKIP") { - Subunit::start_testsuite($name); - Subunit::end_testsuite($name, "skip", - "environment $envname is disabled (via --exclude-env / --include-env command line options) in this test run - skipping"); - next; } elsif ($envvars eq "UNKNOWN") { Subunit::start_testsuite($name); Subunit::end_testsuite($name, "skip",