1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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
This commit is contained in:
Andrew Bartlett 2011-04-18 17:38:35 +10:00
parent aed450df0b
commit 9000188fb4
4 changed files with 53 additions and 3 deletions

View File

@ -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);

45
selftest/target/Samba.pm Normal file
View File

@ -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;

View File

@ -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;

View File

@ -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).