diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-04-18 17:38:35 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-04-19 14:26:59 +1000 |
commit | 9000188fb4226b4c70ae6b50292a0fe2a55e653c (patch) | |
tree | 666fada1d1712c226d8f6c5ccf9ac894bc9b42d4 | |
parent | aed450df0b38d6648cbfd3229722db82a85ad746 (diff) | |
download | samba-9000188fb4226b4c70ae6b50292a0fe2a55e653c.tar.gz samba-9000188fb4226b4c70ae6b50292a0fe2a55e653c.tar.bz2 samba-9000188fb4226b4c70ae6b50292a0fe2a55e653c.zip |
selftest Add combined 'Samba' target module
To work around environment variable handling, the initialisation of
NSS_WRAPPER_WINBIND_SO_PATH is pushed in to Samba3.pm (the s3 autoconf
build still overrides this)
Andrew Bartlett
-rwxr-xr-x | selftest/selftest.pl | 6 | ||||
-rw-r--r-- | selftest/target/Samba.pm | 45 | ||||
-rw-r--r-- | selftest/target/Samba3.pm | 3 | ||||
-rw-r--r-- | selftest/wscript | 2 |
4 files changed, 53 insertions, 3 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl index c4afde75c0..fe786f841b 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -481,7 +481,11 @@ sub bindir_path($$) { return $path; } -if ($opt_target eq "samba4") { +if ($opt_target eq "samba") { + $testenv_default = "all"; + require target::Samba; + $target = new Samba($bindir, \%binary_mapping, \&bindir_path, $ldap, $srcdir, $exeext); +} elsif ($opt_target eq "samba4") { $testenv_default = "all"; require target::Samba4; $target = new Samba4($bindir, \%binary_mapping, \&bindir_path, $ldap, $srcdir, $exeext); diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm new file mode 100644 index 0000000000..703d0b5e62 --- /dev/null +++ b/selftest/target/Samba.pm @@ -0,0 +1,45 @@ +#!/usr/bin/perl +# Bootstrap Samba and run a number of tests against it. +# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org> +# Published under the GNU GPL, v3 or later. + +package Samba; + +use strict; +use target::Samba3; +use target::Samba4; + +sub new($$$$$) { + my ($classname, $bindir, $binary_mapping, $bindir_path, $ldap, $srcdir, $exeext) = @_; + + my $self = { + samba3 => new Samba3($bindir,$binary_mapping, $bindir_path, $srcdir, $exeext), + samba4 => new Samba4($bindir,$binary_mapping, $bindir_path, $ldap, $srcdir, $exeext), + }; + bless $self; + return $self; +} + +sub setup_env($$$) +{ + my ($self, $envname, $path) = @_; + + $ENV{ENVNAME} = $envname; + + my $env = $self->{samba4}->setup_env($envname, $path); + if (defined($env)) { + $env->{target} = $self->{samba4}; + } else { + $env = $self->{samba3}->setup_env($envname, $path); + if (defined($env)) { + $env->{target} = $self->{samba3}; + } + } + if (not defined $env) { + warn("Samba can't provide environment '$envname'"); + return undef; + } + return $env; +} + +1; diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 06a0dc3199..13023791da 100644 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -850,6 +850,9 @@ domusers:X:$gid_domusers: $ret{NSS_WRAPPER_PASSWD} = $nss_wrapper_passwd; $ret{NSS_WRAPPER_GROUP} = $nss_wrapper_group; $ret{NSS_WRAPPER_WINBIND_SO_PATH} = $ENV{NSS_WRAPPER_WINBIND_SO_PATH}; + if (not defined($ret{NSS_WRAPPER_WINBIND_SO_PATH})) { + $ret{NSS_WRAPPER_WINBIND_SO_PATH} = $self->{bindir_path}->($self, "default/nsswitch/libnss-winbind.so"); + } $ret{LOCAL_PATH} = "$shrdir"; return \%ret; diff --git a/selftest/wscript b/selftest/wscript index afd9b9d4eb..ecf650274a 100644 --- a/selftest/wscript +++ b/selftest/wscript @@ -180,8 +180,6 @@ def cmd_testonly(opt): if env.SELFTEST_TARGET == "samba4": env.SELFTEST_DIR = "${srcdir}/source4/selftest" elif env.SELFTEST_TARGET == "samba3": - #This must *only* be set for a Samba3 test, as it will cause timeouts otherwise (as it tries to talk to winbindd) - os.environ['NSS_WRAPPER_WINBIND_SO_PATH'] = os.path.abspath('bin/default/nsswitch/libnss-winbind.so') env.SELFTEST_DIR = "${srcdir}/source3/selftest" # We use the full path rather than relative path because it cause problems on some plateforms (ie. solaris 8). |