From d041ed233d1b10604ef1b9f7f1e68f6f5cd96132 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 18 Apr 2011 13:44:36 +1000 Subject: selftest: put the target on the environment This will allow us to have a 'switch' target type that creates environments from Samba3 or Samba4 as required. Andrew Bartlett --- selftest/selftest.pl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 69c95e9152..c4afde75c0 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -865,12 +865,15 @@ sub setup_env($$) $testenv_vars = {}; } elsif (defined(get_running_env($envname))) { $testenv_vars = get_running_env($envname); - if (not $target->check_env($testenv_vars)) { - print $target->getlog_env($testenv_vars); + if (not $testenv_vars->{target}->check_env($testenv_vars)) { + print $testenv_vars->{target}->getlog_env($testenv_vars); $testenv_vars = undef; } } else { $testenv_vars = $target->setup_env($envname, $prefix); + if (defined($testenv_vars) && not defined($testenv_vars->{target})) { + $testenv_vars->{target} = $target; + } } return undef unless defined($testenv_vars); @@ -916,21 +919,24 @@ sub getlog_env($) { my ($envname) = @_; return "" if ($envname eq "none"); - return $target->getlog_env(get_running_env($envname)); + my $env = get_running_env($envname); + return $env->{target}->getlog_env($env); } sub check_env($) { my ($envname) = @_; return 1 if ($envname eq "none"); - return $target->check_env(get_running_env($envname)); + my $env = get_running_env($envname); + return $env->{target}->check_env($env); } sub teardown_env($) { my ($envname) = @_; return if ($envname eq "none"); - $target->teardown_env(get_running_env($envname)); + my $env = get_running_env($envname); + $env->{target}->teardown_env($env); delete $running_envs{$envname}; } -- cgit