#!/usr/bin/perl
# Bootstrap Samba and run a number of tests against it.
# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer@samba.org>
-# Published under the GNU GPL, v3 or later.
+# Copyright (C) 2007-2009 Stefan Metzmacher <metze@samba.org>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
=pod
{
print "Samba test runner
Copyright (C) Jelmer Vernooij <jelmer\@samba.org>
+Copyright (C) Stefan Metzmacher <metze\@samba.org>
Usage: $Script [OPTIONS] TESTNAME-REGEX
$ENV{MALLOC_CHECK_} = 2;
}
-my $old_pwd = "$RealBin/..";
+my $bindir = ($opt_bindir or "$builddir/bin");
+my $bindir_abs = abs_path($bindir);
# Backwards compatibility:
if (defined($ENV{TEST_LDAP}) and $ENV{TEST_LDAP} eq "yes") {
my $prefix_abs = abs_path($prefix);
my $srcdir_abs = abs_path($srcdir);
+my $builddir_abs = abs_path($builddir);
die("using an empty absolute prefix isn't allowed") unless $prefix_abs ne "";
die("using '/' as absolute prefix isn't allowed") unless $prefix_abs ne "/";
$ENV{PREFIX_ABS} = $prefix_abs;
$ENV{SRCDIR} = $srcdir;
$ENV{SRCDIR_ABS} = $srcdir_abs;
+$ENV{BUILDDIR} = $builddir;
+$ENV{BUILDDIR_ABS} = $builddir_abs;
+$ENV{EXEEXT} = $exeext;
if (defined($ENV{RUN_FROM_BUILD_FARM}) and
($ENV{RUN_FROM_BUILD_FARM} eq "yes")) {
my $tls_enabled = not $opt_quick;
$ENV{TLS_ENABLED} = ($tls_enabled?"yes":"no");
-$ENV{LDB_MODULES_PATH} = "$old_pwd/source4/bin/modules/ldb";
-$ENV{LD_SAMBA_MODULE_PATH} = "$old_pwd/source4/bin/modules";
+$ENV{LDB_MODULES_PATH} = "$bindir_abs/modules/ldb";
+$ENV{LD_SAMBA_MODULE_PATH} = "$bindir_abs/modules";
sub prefix_pathvar($$)
{
my ($name, $newpath) = @_;
$ENV{$name} = $newpath;
}
}
-prefix_pathvar("PKG_CONFIG_PATH", "$old_pwd/source4/bin/pkgconfig");
-prefix_pathvar("PYTHONPATH", "$old_pwd/source4/bin/python");
+prefix_pathvar("PKG_CONFIG_PATH", "$bindir_abs/pkgconfig");
+prefix_pathvar("PYTHONPATH", "$bindir_abs/python");
if ($opt_socket_wrapper_keep_pcap) {
# Socket wrapper keep pcap implies socket wrapper pcap
if ($opt_target eq "samba4") {
$testenv_default = "member";
require target::Samba4;
- $target = new Samba4($opt_bindir or "$builddir/bin",
- $ldap, "$srcdir/setup", $exeext);
+ $target = new Samba4($bindir, $ldap, "$srcdir/setup", $exeext);
} elsif ($opt_target eq "samba3") {
- my $bindir = ($opt_bindir or "$builddir/bin");
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....");
}
}
$ENV{SELFTEST_TARGET} = $opt_target;
$ENV{SELFTEST_MAXTIME} = $torture_maxtime;
-$ENV{SELFTEST_CONFFILE} = $conffile;
my @available = ();
foreach my $fn (@testlists) {
my $option = $name;
$envname =~ s/:.*//;
- $option =~ s/^[^:]*://;
+ $option =~ s/^[^:]*//;
+ $option =~ s/^://;
$option = "client" if $option eq "";
if ($envname eq "none") {
- $testenv_vars = \{};
+ $testenv_vars = {};
} elsif (defined(get_running_env($envname))) {
$testenv_vars = get_running_env($envname);
if (not $target->check_env($testenv_vars)) {
Some useful environment variables:
TORTURE_OPTIONS=\$TORTURE_OPTIONS
-CONFIGURATION=\$CONFIGURATION
+SMB_CONF_PATH=\$SMB_CONF_PATH
$envvarstr
\" && LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} bash'");