my $opt_verbose = 0;
my $opt_image = undef;
my $opt_testenv = 0;
+my $opt_list = 0;
my $ldap = undef;
my $opt_resetup_env = undef;
my $opt_bindir = undef;
if ($? == -1) {
Subunit::progress_pop();
Subunit::end_testsuite($name, "error", "Unable to run $cmd: $!");
- return 0;
+ exit(1);
} elsif ($? & 127) {
Subunit::end_testsuite($name, "error",
sprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127), ($? & 128) ? 'with' : 'without'));
--quick run quick overall test
--one abort when the first test fails
--verbose be verbose
- --analyse-cmd CMD command to run after each test
+ --testenv run a shell in the requested test environment
+ --list list available tests
";
exit(0);
}
'exeext=s' => \$exeext,
'verbose' => \$opt_verbose,
'testenv' => \$opt_testenv,
+ 'list' => \$opt_list,
'ldap:s' => \$ldap,
'resetup-environment' => \$opt_resetup_env,
'bindir:s' => \$opt_bindir,
ShowHelp() if ($opt_help);
+die("--list and --testenv are mutually exclusive") if ($opt_list and $opt_testenv);
+
# we want unbuffered output
$| = 1;
$ENV{SRCDIR_ABS} = $srcdir_abs;
$ENV{BUILDDIR} = $builddir;
$ENV{BUILDDIR_ABS} = $builddir_abs;
+$ENV{BINDIR} = $bindir_abs;
$ENV{EXEEXT} = $exeext;
my $tls_enabled = not $opt_quick;
$ENV{TLS_ENABLED} = ($tls_enabled?"yes":"no");
-$ENV{LDB_MODULES_PATH} = "$bindir_abs/modules/ldb";
-$ENV{LD_SAMBA_MODULE_PATH} = "$bindir_abs/modules";
+
sub prefix_pathvar($$)
{
my ($name, $newpath) = @_;
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....");
}
$testenv_default = "member";
require target::Samba3;
- $target = new Samba3($bindir);
+ $target = new Samba3($bindir, $srcdir_abs);
} elsif ($opt_target eq "win") {
die("Windows tests will not run with socket wrapper enabled.")
if ($opt_socket_wrapper);
private dir = $clientdir/private
lock dir = $clientdir/lockdir
ncalrpc dir = $clientdir/ncalrpcdir
- name resolve order = bcast file
+ name resolve order = file bcast
panic action = $RealBin/gdb_backtrace \%PID\% \%PROG\%
max xmit = 32K
notify:inotify = false
torture:basedir = $clientdir
#We don't want to pass our self-tests if the PAC code is wrong
gensec:require_pac = true
- modules dir = $ENV{LD_SAMBA_MODULE_PATH}
- setup directory = ./setup
resolv:host file = $prefix_abs/dns_host_file
#We don't want to run 'speed' tests for very long
torture:timelimit = 1
my @todo = ();
-my $testsdir = "$srcdir/selftest";
-
sub should_run_test($)
{
my $name = shift;
$ENV{SELFTEST_PREFIX} = "$prefix_abs";
$ENV{SELFTEST_TMPDIR} = "$tmpdir_abs";
+$ENV{TEST_DATA_PREFIX} = "$tmpdir_abs";
if ($opt_socket_wrapper) {
$ENV{SELFTEST_INTERFACES} = $interfaces;
} else {
"KRB5_CONFIG",
"WINBINDD_SOCKET_DIR",
"WINBINDD_PRIV_PIPE_DIR",
+ "NMBD_SOCKET_DIR",
"LOCAL_PATH"
);
$envvarstr
\" && LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} bash'");
teardown_env($testenv_name);
+} elsif ($opt_list) {
+ foreach (@todo) {
+ my $cmd = $$_[2];
+ my $name = $$_[0];
+ my $envname = $$_[1];
+
+ unless($cmd =~ /\$LISTOPT/) {
+ warn("Unable to list tests in $name");
+ next;
+ }
+
+ $cmd =~ s/\$LISTOPT/--list/g;
+
+ system($cmd);
+
+ if ($? == -1) {
+ die("Unable to run $cmd: $!");
+ } elsif ($? & 127) {
+ die(snprintf("%s died with signal %d, %s coredump\n", $cmd, ($? & 127), ($? & 128) ? 'with' : 'without'));
+ }
+
+ my $exitcode = $? >> 8;
+ if ($exitcode != 0) {
+ die("$cmd exited with exit code $exitcode");
+ }
+ }
} else {
foreach (@todo) {
$i++;
if (not defined($envvars)) {
Subunit::start_testsuite($name);
Subunit::end_testsuite($name, "error",
- "unable to set up environment $envname");
+ "unable to set up environment $envname - exiting");
next;
}