selftest: Allow setup_env() to signal that an environment name is unknown
authorAndrew Bartlett <abartlet@samba.org>
Mon, 13 Feb 2012 01:14:57 +0000 (12:14 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 13 Feb 2012 03:41:05 +0000 (04:41 +0100)
This will allow us to skip samba4 environments that may be mentioned in
the source3/selftest/tests.py file.

Andrew Bartlett

selftest/selftest.pl
selftest/target/Samba.pm
selftest/target/Samba3.pm
selftest/target/Samba4.pm

index e5ccbd8..4625172 100755 (executable)
@@ -882,7 +882,9 @@ sub setup_env($$)
                }
        } else {
                $testenv_vars = $target->setup_env($envname, $prefix);
-               if (defined($testenv_vars) && not defined($testenv_vars->{target})) {
+               if (defined($testenv_vars) and $testenv_vars eq "UNKNOWN") {
+                   return $testenv_vars;
+               } elsif (defined($testenv_vars) && not defined($testenv_vars->{target})) {
                        $testenv_vars->{target} = $target;
                }
                if (not defined($testenv_vars)) {
@@ -1024,6 +1026,11 @@ $envvarstr
                        Subunit::end_testsuite($name, "error",
                                "unable to set up environment $envname - exiting");
                        next;
+               } elsif ($envvars eq "UNKNOWN") {
+                       Subunit::start_testsuite($name);
+                       Subunit::end_testsuite($name, "skip",
+                               "environment $envname is unknown in this test backend - skipping");
+                       next;
                }
 
                # Generate a file with the individual tests to run, if the 
index 64bc405..eea1987 100644 (file)
@@ -27,13 +27,13 @@ sub setup_env($$$)
        $ENV{ENVNAME} = $envname;
 
        my $env = $self->{samba4}->setup_env($envname, $path);
-       if (defined($env)) {
+       if (defined($env) and $env ne "UNKNOWN") {
            if (not defined($env->{target})) {
                $env->{target} = $self->{samba4};
            }
        } else {
                $env = $self->{samba3}->setup_env($envname, $path);
-               if (defined($env)) {
+               if (defined($env) and $env ne "UNKNOWN") {
                    if (not defined($env->{target})) {
                        $env->{target} = $self->{samba3};
                    }
index b710d54..7ecb481 100755 (executable)
@@ -112,7 +112,7 @@ sub setup_env($$$)
                }
                return $self->setup_member("$path/member", $self->{vars}->{s3dc});
        } else {
-               return undef;
+               return "UNKNOWN";
        }
 }
 
index 52c6d68..8ac3ee7 100644 (file)
@@ -1429,7 +1429,7 @@ sub setup_env($$$)
        } elsif ($envname eq "plugin_s4_dc") {
                return $self->setup_plugin_s4_dc("$path/plugin_s4_dc");
        } else {
-               return undef;
+               return "UNKNOWN";
        }
 }