From 962e8a0ea7db79b96dddec06a4bde211eea0d1d6 Mon Sep 17 00:00:00 2001 From: Jamie McClymont Date: Wed, 21 Feb 2018 13:33:49 +1300 Subject: selftest: move to declaratively specifying environments and their dependencies This removes the tangle of code for starting up dependencies, and allows selftest.pl to query dependencies (hence it can know when things can be shut down early and how to order environments for optimal memory usage - that patch not yet submitted). It also removes the slightly hacky special-casing of the ad_members, and sets $target->{vars} centrally (so each setup_ function does not need to). Signed-off-by: Jamie McClymont Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- selftest/selftest.pl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'selftest/selftest.pl') diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 64fb9f85d3a..c48e1926520 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -85,7 +85,12 @@ sub find_in_list($$) sub skip { - my ($name) = @_; + my ($name, $envname) = @_; + my ($env_basename, $env_localpart) = split(/:/, $envname); + + if ($opt_target eq "samba3" && $Samba::ENV_NEEDS_AD_DC{$env_basename}) { + return "environment $envname is disabled as this build does not include an AD DC"; + } return find_in_list(\@excludes, $name); } @@ -449,15 +454,12 @@ if (defined($ENV{SMBD_MAXTIME}) and $ENV{SMBD_MAXTIME} ne "") { $server_maxtime = $ENV{SMBD_MAXTIME}; } +$target = new Samba($bindir, $ldap, $srcdir, $server_maxtime); unless ($opt_list) { if ($opt_target eq "samba") { $testenv_default = "ad_dc"; - require target::Samba; - $target = new Samba($bindir, $ldap, $srcdir, $server_maxtime); } elsif ($opt_target eq "samba3") { $testenv_default = "nt4_member"; - require target::Samba3; - $target = new Samba3($bindir, $srcdir_abs, $server_maxtime); } } @@ -725,7 +727,7 @@ $individual_tests = {}; foreach my $testsuite (@available) { my $name = $$testsuite[0]; - my $skipreason = skip($name); + my $skipreason = skip(@$testsuite); if (defined($restricted)) { # Find the testsuite for this test my $match = undef; -- cgit v1.2.1