mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s4-test: allow make test to work from top level directory
this fixes the path assumptions in Samba4 make test to allow it to work from the top level directory. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
e7b2e06130
commit
6484da4859
@ -464,7 +464,7 @@ my $testenv_default = "none";
|
||||
if ($opt_target eq "samba4") {
|
||||
$testenv_default = "all";
|
||||
require target::Samba4;
|
||||
$target = new Samba4($bindir, $ldap, "$srcdir/setup", $exeext);
|
||||
$target = new Samba4($bindir, $ldap, $srcdir, $exeext);
|
||||
} elsif ($opt_target eq "samba3") {
|
||||
if ($opt_socket_wrapper and `$bindir/smbd -b | grep SOCKET_WRAPPER` eq "") {
|
||||
die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting....");
|
||||
@ -616,8 +616,6 @@ sub write_clientconf($$$)
|
||||
|
||||
my @todo = ();
|
||||
|
||||
my $testsdir = "$srcdir/selftest";
|
||||
|
||||
sub should_run_test($)
|
||||
{
|
||||
my $name = shift;
|
||||
|
@ -12,13 +12,13 @@ use POSIX;
|
||||
use SocketWrapper;
|
||||
|
||||
sub new($$$$$) {
|
||||
my ($classname, $bindir, $ldap, $setupdir, $exeext) = @_;
|
||||
my ($classname, $bindir, $ldap, $srcdir, $exeext) = @_;
|
||||
$exeext = "" unless defined($exeext);
|
||||
my $self = {
|
||||
vars => {},
|
||||
ldap => $ldap,
|
||||
bindir => $bindir,
|
||||
setupdir => $setupdir,
|
||||
srcdir => $srcdir,
|
||||
exeext => $exeext
|
||||
};
|
||||
bless $self;
|
||||
@ -34,6 +34,11 @@ sub bindir_path($$) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
sub scriptdir_path($$) {
|
||||
my ($self, $path) = @_;
|
||||
return "$self->{srcdir}/source4/scripting/$path";
|
||||
}
|
||||
|
||||
sub openldap_start($$$) {
|
||||
}
|
||||
|
||||
@ -548,7 +553,7 @@ sub provision_raw_prepare($$$$$$$$$$)
|
||||
if (defined($ENV{PYTHON})) {
|
||||
push (@provision_options, $ENV{PYTHON});
|
||||
}
|
||||
push (@provision_options, "$self->{setupdir}/provision");
|
||||
push (@provision_options, "$self->{srcdir}/source4/setup/provision");
|
||||
push (@provision_options, "--configfile=$ctx->{smb_conf}");
|
||||
push (@provision_options, "--host-name=$ctx->{netbiosname}");
|
||||
push (@provision_options, "--host-ip=$ctx->{ipv4}");
|
||||
@ -591,7 +596,7 @@ sub provision_raw_step1($$)
|
||||
pid directory = $ctx->{piddir}
|
||||
ncalrpc dir = $ctx->{ncalrpcdir}
|
||||
lock dir = $ctx->{lockdir}
|
||||
setup directory = $self->{setupdir}
|
||||
setup directory = $self->{srcdir}/source4/setup
|
||||
winbindd socket directory = $ctx->{winbindd_socket_dir}
|
||||
winbindd privileged socket directory = $ctx->{winbindd_privileged_socket_dir}
|
||||
ntp signd socket directory = $ctx->{ntp_signd_socket_dir}
|
||||
@ -610,8 +615,8 @@ sub provision_raw_step1($$)
|
||||
log level = $ctx->{server_loglevel}
|
||||
lanman auth = Yes
|
||||
rndc command = true
|
||||
dns update command = $ENV{SRCDIR_ABS}/scripting/bin/samba_dnsupdate --all-interfaces --use-file=$ctx->{dns_host_file}
|
||||
spn update command = $ENV{SRCDIR_ABS}/scripting/bin/samba_spnupdate
|
||||
dns update command = $ENV{SRCDIR_ABS}/source4/scripting/bin/samba_dnsupdate --all-interfaces --use-file=$ctx->{dns_host_file}
|
||||
spn update command = $ENV{SRCDIR_ABS}/source4/scripting/bin/samba_spnupdate
|
||||
resolv:host file = $ctx->{dns_host_file}
|
||||
dreplsrv:periodic_startup_interval = 0
|
||||
";
|
||||
@ -697,7 +702,7 @@ nogroup:x:65534:nobody
|
||||
my $configuration = "--configfile=$ctx->{smb_conf}";
|
||||
|
||||
#Ensure the config file is valid before we start
|
||||
my $testparm = $self->bindir_path("../scripting/bin/testparm");
|
||||
my $testparm = $self->scriptdir_path("bin/testparm");
|
||||
if (system("$testparm $configuration -v --suppress-prompt >/dev/null 2>&1") != 0) {
|
||||
system("$testparm -v --suppress-prompt $configuration >&2");
|
||||
warn("Failed to create a valid smb.conf configuration $testparm!");
|
||||
|
@ -65,7 +65,10 @@ def plantestsuite(name, env, cmdline, allow_empty_output=False):
|
||||
filter_subunit_args.append("--fail-on-empty")
|
||||
if "$LISTOPT" in cmdline:
|
||||
filter_subunit_args.append("$LISTOPT")
|
||||
print "%s 2>&1 | ../selftest/filter-subunit %s --prefix=\"%s.\"" % (cmdline, " ".join(filter_subunit_args), name)
|
||||
print "%s 2>&1 | %s/selftest/filter-subunit %s --prefix=\"%s.\"" % (cmdline,
|
||||
srcdir,
|
||||
" ".join(filter_subunit_args),
|
||||
name)
|
||||
if allow_empty_output:
|
||||
print "WARNING: allowing empty subunit output from %s" % name
|
||||
|
||||
@ -75,7 +78,7 @@ def add_prefix(prefix, support_list=False):
|
||||
listopt = "$LISTOPT "
|
||||
else:
|
||||
listopt = ""
|
||||
return "../selftest/filter-subunit %s--fail-on-empty --prefix=\"%s.\"" % (listopt, prefix)
|
||||
return "%s/selftest/filter-subunit %s--fail-on-empty --prefix=\"%s.\"" % (srcdir, listopt, prefix)
|
||||
|
||||
|
||||
def plantestsuite_loadlist(name, env, cmdline):
|
||||
@ -136,7 +139,8 @@ def plansmbtorturetestsuite(name, env, options):
|
||||
plantestsuite_loadlist(modname, env, cmdline)
|
||||
|
||||
|
||||
samba4srcdir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
|
||||
srcdir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../.."))
|
||||
samba4srcdir = os.path.join(srcdir, 'source4')
|
||||
builddir = os.getenv("BUILDDIR", samba4srcdir)
|
||||
samba4bindir = os.path.normpath(os.path.join(builddir, "bin"))
|
||||
smb4torture = binpath("smbtorture")
|
||||
@ -163,7 +167,7 @@ else:
|
||||
|
||||
subprocess.call([smb4torture, "-V"])
|
||||
|
||||
bbdir = "../testprogs/blackbox"
|
||||
bbdir = os.path.join(srcdir, "testprogs/blackbox")
|
||||
|
||||
configuration = "--configfile=$SMB_CONF_PATH"
|
||||
|
||||
|
@ -85,8 +85,8 @@ def cmd_testonly(opt):
|
||||
|
||||
env.TESTS = Options.options.TESTS
|
||||
|
||||
env.SUBUNIT_FORMATTER = '${PYTHON} -u ../selftest/format-subunit --prefix=${SELFTEST_PREFIX} --immediate'
|
||||
env.FILTER_XFAIL = '${PYTHON} -u ../selftest/filter-subunit --expected-failures=./selftest/knownfail'
|
||||
env.SUBUNIT_FORMATTER = '${PYTHON} -u ${srcdir}/selftest/format-subunit --prefix=${SELFTEST_PREFIX} --immediate'
|
||||
env.FILTER_XFAIL = '${PYTHON} -u ${srcdir}/selftest/filter-subunit --expected-failures=${srcdir}/source4/selftest/knownfail'
|
||||
|
||||
if Options.options.FAIL_IMMEDIATELY:
|
||||
env.FILTER_XFAIL += ' --fail-immediately'
|
||||
@ -103,9 +103,9 @@ def cmd_testonly(opt):
|
||||
|
||||
env.OPTIONS = ''
|
||||
if not Options.options.SLOWTEST:
|
||||
env.OPTIONS += ' --exclude=./selftest/slow'
|
||||
env.OPTIONS += ' --exclude=${srcdir}/source4/selftest/slow'
|
||||
if Options.options.QUICKTEST:
|
||||
env.OPTIONS += ' --quick --include=./selftest/quick'
|
||||
env.OPTIONS += ' --quick --include=${srcdir}/source4/selftest/quick'
|
||||
if Options.options.LOAD_LIST:
|
||||
env.OPTIONS += ' --load-list=%s' % Options.options.LOAD_LIST
|
||||
if Options.options.TESTENV:
|
||||
@ -129,13 +129,13 @@ def cmd_testonly(opt):
|
||||
server_wrapper=''
|
||||
|
||||
if Options.options.VALGRIND_SERVER:
|
||||
server_wrapper = '../selftest/valgrind_run _DUMMY=X'
|
||||
server_wrapper = '${srcdir}/selftest/valgrind_run _DUMMY=X'
|
||||
elif Options.options.GDBTEST:
|
||||
server_wrapper = '../selftest/gdb_run _DUMMY=X'
|
||||
server_wrapper = '${srcdir}/selftest/gdb_run _DUMMY=X'
|
||||
|
||||
if Options.options.SCREEN:
|
||||
server_wrapper = '%s/../selftest/in_screen %s' % (os.getcwd(), server_wrapper)
|
||||
os.environ['TERMINAL'] = '%s/../selftest/in_screen' % os.getcwd()
|
||||
server_wrapper = '${srcdir}selftest/in_screen %s' % server_wrapper
|
||||
os.environ['TERMINAL'] = '${srcdir}/selftest/in_screen'
|
||||
elif server_wrapper != '':
|
||||
server_wrapper = 'xterm -n server -l -e %s' % server_wrapper
|
||||
|
||||
@ -152,7 +152,12 @@ def cmd_testonly(opt):
|
||||
os.environ['LDB_MODULES_PATH'] = 'bin/modules/ldb'
|
||||
|
||||
# tell build system where to find config.h
|
||||
os.environ['CONFIG_H'] = 'bin/default/source4/include/config.h'
|
||||
config_paths = [ 'bin/default/source4/include/config.h',
|
||||
'bin/default/include/config.h' ]
|
||||
for p in config_paths:
|
||||
if os.path.exists(p):
|
||||
os.environ['CONFIG_H'] = p
|
||||
break
|
||||
|
||||
st_done = os.path.join(env.SELFTEST_PREFIX, 'st_done')
|
||||
if os.path.exists(st_done):
|
||||
@ -162,11 +167,11 @@ def cmd_testonly(opt):
|
||||
os.makedirs(env.SELFTEST_PREFIX, int('755', 8))
|
||||
|
||||
# We use the full path rather than relative path because it cause problems on some plateforms (ie. solaris 8).
|
||||
cmd = '(${PERL} %s/../selftest/selftest.pl --prefix=${SELFTEST_PREFIX} --builddir=. --srcdir=. --exclude=./selftest/skip --testlist="${PYTHON} ./selftest/tests.py|" ${OPTIONS} --socket-wrapper ${TESTS} && touch ${SELFTEST_PREFIX}/st_done) | ${FILTER_OPTIONS} | tee ${SELFTEST_PREFIX}/subunit' % (os.getcwd())
|
||||
cmd = '(${PERL} ${srcdir}/selftest/selftest.pl --prefix=${SELFTEST_PREFIX} --builddir=. --srcdir=${srcdir} --exclude=${srcdir}/source4/selftest/skip --testlist="${PYTHON} ${srcdir}/source4/selftest/tests.py|" ${OPTIONS} --socket-wrapper ${TESTS} && touch ${SELFTEST_PREFIX}/st_done) | ${FILTER_OPTIONS} | tee ${SELFTEST_PREFIX}/subunit'
|
||||
if os.environ.get('RUN_FROM_BUILD_FARM') is None and not Options.options.FILTERED_SUBUNIT:
|
||||
cmd += ' | ${FORMAT_TEST_OUTPUT}'
|
||||
else:
|
||||
cmd += ' | ${PYTHON} -u ../selftest/filter-subunit'
|
||||
cmd += ' | ${PYTHON} -u ${srcdir}/selftest/filter-subunit'
|
||||
cmd = EXPAND_VARIABLES(opt, cmd)
|
||||
|
||||
print("test: running %s" % cmd)
|
||||
|
Loading…
Reference in New Issue
Block a user