diff options
Diffstat (limited to 'source4/selftest')
32 files changed, 603 insertions, 335 deletions
diff --git a/source4/selftest/README b/source4/selftest/README index 1d67a6d85d..a0afda3d19 100644 --- a/source4/selftest/README +++ b/source4/selftest/README @@ -3,18 +3,22 @@ bunch of tests all at once. The following environments are currently available: - - none: No server set up + - none: No server set up, no variables set. - dc: Domain controller set up. The following environment variables will be set: - * USERNAME - * PASSWORD - * DOMAIN - * REALM - * SERVER + * USERNAME: Administrator user name + * PASSWORD: Administrator password + * DOMAIN: Domain name + * REALM: Realm name + * SERVER: DC host name + * SERVER_IP: DC IPv4 address + * NETBIOSNAME: DC NetBIOS name + * NETIOSALIAS: DC NetBIOS alias + - member: Domain controller and member server that is joined to it set up. The following environment variables will be set: - * USERNAME - * PASSWORD - * DOMAIN - * REALM - * SERVER (contains the name of the member server) + * USERNAME: Domain administrator user name + * PASSWORD: Domain administrator password + * DOMAIN: Domain name + * REALM: Realm name + * SERVER: Name of the member server diff --git a/source4/selftest/Subunit.pm b/source4/selftest/Subunit.pm index 1be412c356..2ecafb42d0 100644 --- a/source4/selftest/Subunit.pm +++ b/source4/selftest/Subunit.pm @@ -9,7 +9,10 @@ use strict; sub parse_results($$$$$) { my ($msg_ops, $msg_state, $statistics, $fh, $expecting_failure) = @_; - my $expected_ret = 1; + my $unexpected_ok = 0; + my $expected_fail = 0; + my $unexpected_fail = 0; + my $unexpected_err = 0; my $open_tests = {}; while(<$fh>) { @@ -34,6 +37,7 @@ sub parse_results($$$$$) if ($expecting_failure->("$msg_state->{NAME}/$2")) { $statistics->{TESTS_UNEXPECTED_OK}++; $msg_ops->end_test($msg_state, $2, $1, 1, $reason); + $unexpected_ok++; } else { $statistics->{TESTS_EXPECTED_OK}++; $msg_ops->end_test($msg_state, $2, $1, 0, $reason); @@ -43,10 +47,11 @@ sub parse_results($$$$$) if ($expecting_failure->("$msg_state->{NAME}/$2")) { $statistics->{TESTS_EXPECTED_FAIL}++; $msg_ops->end_test($msg_state, $2, $1, 0, $reason); - $expected_ret = 0; + $expected_fail++; } else { $statistics->{TESTS_UNEXPECTED_FAIL}++; $msg_ops->end_test($msg_state, $2, $1, 1, $reason); + $unexpected_fail++; } } elsif ($1 eq "skip") { $statistics->{TESTS_SKIP}++; @@ -56,6 +61,7 @@ sub parse_results($$$$$) $statistics->{TESTS_ERROR}++; delete $open_tests->{$2}; $msg_ops->end_test($msg_state, $2, $1, 1, $reason); + $unexpected_err++; } } else { $msg_ops->output_msg($msg_state, $_); @@ -63,12 +69,18 @@ sub parse_results($$$$$) } foreach (keys %$open_tests) { - $msg_ops->end_test($msg_state, $_, "error", 1, - "was started but never finished!"); + $msg_ops->end_test($msg_state, $_, "error", 1, + "was started but never finished!"); $statistics->{TESTS_ERROR}++; + $unexpected_err++; } - return $expected_ret; + return 1 if $unexpected_err > 0; + return 1 if $unexpected_fail > 0; + return 1 if $unexpected_ok > 0 and $expected_fail > 0; + return 0 if $unexpected_ok > 0 and $expected_fail == 0; + return 0 if $expected_fail > 0; + return 1; } 1; diff --git a/source4/selftest/TODO b/source4/selftest/TODO index 42f90188ed..67776ffc76 100644 --- a/source4/selftest/TODO +++ b/source4/selftest/TODO @@ -1,3 +1,2 @@ - warn about unexpected successes - better way to detect that smbd has finished initialization -- move ldap-specific code into mktestdc.sh diff --git a/source4/selftest/env/Samba3.pm b/source4/selftest/env/Samba3.pm index b12208bd9f..951fbee4ec 100644 --- a/source4/selftest/env/Samba3.pm +++ b/source4/selftest/env/Samba3.pm @@ -8,6 +8,7 @@ package Samba3; use strict; use Cwd qw(abs_path); use FindBin qw($RealBin); +use POSIX; sub binpath($$) { @@ -33,18 +34,51 @@ sub teardown_env($$) { my ($self, $envvars) = @_; - $self->samba3_stop_sig_term($envvars->{PIDDIR}); - $self->samba3_stop_sig_kill($envvars->{PIDDIR}); + my $smbdpid = read_pid($envvars, "smbd"); + my $nmbdpid = read_pid($envvars, "nmbd"); +# my $winbinddpid = read_pid($envvars, "winbindd"); + + $self->stop_sig_term($smbdpid); + $self->stop_sig_term($nmbdpid); +# $self->stop_sig_term($winbinddpid); + $self->stop_sig_kill($smbdpid); + $self->stop_sig_kill($nmbdpid); +# $self->stop_sig_kill($winbinddpid); return 0; } +sub getlog_env_app($$$) +{ + my ($self, $envvars, $name) = @_; + + my $title = "$name LOG of: $envvars->{NETBIOSNAME}\n"; + my $out = $title; + + open(LOG, "<".$envvars->{$name."_TEST_LOG"}); + + seek(LOG, $envvars->{$name."_TEST_LOG_POS"}, SEEK_SET); + while (<LOG>) { + $out .= $_; + } + $envvars->{$name."_TEST_LOG_POS"} = tell(LOG); + close(LOG); + + return "" if $out eq $title; + + return $out; +} + sub getlog_env($$) { my ($self, $envvars) = @_; + my $ret = ""; - # TODO... - return ""; + $ret .= $self->getlog_env_app($envvars, "SMBD"); + $ret .= $self->getlog_env_app($envvars, "NMBD"); +# $ret .= $self->getlog_env_app($envvars, "WINBINDD"); + + return $ret; } sub check_env($$) @@ -62,7 +96,7 @@ sub setup_env($$$) if ($envname eq "dc") { return $self->setup_dc("$path/dc"); } else { - die("Samba4 can't provide environment '$envname'"); + return undef; } } @@ -70,9 +104,12 @@ sub setup_dc($$) { my ($self, $path) = @_; - my $vars = $self->provision($path); + my $vars = $self->provision($path, "dc"); - $self->check_or_start($vars, ($ENV{NMBD_MAXTIME} or 2700), ($ENV{SMBD_MAXTIME} or 2700)); + $self->check_or_start($vars, + ($ENV{NMBD_MAXTIME} or 2700), + ($ENV{WINBINDD_MAXTIME} or 2700), + ($ENV{SMBD_MAXTIME} or 2700)); $self->wait_for_start($vars); @@ -84,27 +121,37 @@ sub stop($) my ($self) = @_; } -sub samba3_stop_sig_term($$) { - my ($self, $piddir) = @_; - my $ret = 0; - kill("USR1", `cat $piddir/timelimit.nmbd.pid`) or \ - kill("ALRM", `cat $piddir/timelimit.nmbd.pid`) or $ret++; +sub stop_sig_term($$) { + my ($self, $pid) = @_; + kill("USR1", $pid) or kill("ALRM", $pid) or warn("Unable to kill $pid: $!"); +} - kill("USR1", `cat $piddir/timelimit.smbd.pid`) or \ - kill("ALRM", `cat $piddir/timelimit.smbd.pid`) or $ret++; +sub stop_sig_kill($$) { + my ($self, $pid) = @_; + kill("ALRM", $pid) or warn("Unable to kill $pid: $!"); +} - return $ret; +sub write_pid($$$) +{ + my ($env_vars, $app, $pid) = @_; + + open(PID, ">$env_vars->{PIDDIR}/timelimit.$app.pid"); + print PID $pid; + close(PID); } -sub samba3_stop_sig_kill($$) { - my ($self, $piddir) = @_; - kill("ALRM", `cat $piddir/timelimit.nmbd.pid`); - kill("ALRM", `cat $piddir/timelimit.smbd.pid`); - return 0; +sub read_pid($$) +{ + my ($env_vars, $app) = @_; + + open(PID, "<$env_vars->{PIDDIR}/timelimit.$app.pid"); + my $pid = <PID>; + close(PID); + return $pid; } sub check_or_start($$$$) { - my ($self, $env_vars, $nmbd_maxtime, $smbd_maxtime) = @_; + my ($self, $env_vars, $nmbd_maxtime, $winbindd_maxtime, $smbd_maxtime) = @_; unlink($env_vars->{NMBD_TEST_LOG}); print "STARTING NMBD..."; @@ -112,28 +159,58 @@ sub check_or_start($$$$) { if ($pid == 0) { open STDOUT, ">$env_vars->{NMBD_TEST_LOG}"; open STDERR, '>&STDOUT'; - + + $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; + + my @optargs = ("-d0"); + if (defined($ENV{NMBD_OPTIONS})) { + @optargs = split(/ /, $ENV{NMBD_OPTIONS}); + } + $ENV{MAKE_TEST_BINARY} = $self->binpath("nmbd"); - exec($self->binpath("timelimit"), $nmbd_maxtime, $self->binpath("nmbd"), "-F", "-S", "--no-process-group", "-d0" ,"-s", $env_vars->{SERVERCONFFILE}) or die("Unable to start nmbd: $!"); + exec($self->binpath("timelimit"), $nmbd_maxtime, $self->binpath("nmbd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start nmbd: $!"); } - open(PID, ">$env_vars->{PIDDIR}/timelimit.nmbd.pid"); - print PID $pid; - close(PID); + write_pid($env_vars, "nmbd", $pid); print "DONE\n"; +# disable winbindd until the build-farm faked_users work with it +# unlink($env_vars->{WINBINDD_TEST_LOG}); +# print "STARTING WINBINDD..."; +# $pid = fork(); +# if ($pid == 0) { +# open STDOUT, ">$env_vars->{WINBINDD_TEST_LOG}"; +# open STDERR, '>&STDOUT'; +# +# $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; +# +# my @optargs = ("-d0"); +# if (defined($ENV{WINBINDD_OPTIONS})) { +# @optargs = split(/ /, $ENV{WINBINDD_OPTIONS}); +# } +# +# $ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd"); +# exec($self->binpath("timelimit"), $winbindd_maxtime, $self->binpath("winbindd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!"); +# } +# write_pid($env_vars, "winbindd", $pid); +# print "DONE\n"; + unlink($env_vars->{SMBD_TEST_LOG}); print "STARTING SMBD..."; $pid = fork(); if ($pid == 0) { open STDOUT, ">$env_vars->{SMBD_TEST_LOG}"; open STDERR, '>&STDOUT'; - + + $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; + $ENV{MAKE_TEST_BINARY} = $self->binpath("smbd"); - exec($self->binpath("timelimit"), $nmbd_maxtime, $self->binpath("smbd"), "-F", "-S", "--no-process-group", "-d0" ,"-s", $env_vars->{SERVERCONFFILE}) or die("Unable to start smbd: $!"); + my @optargs = ("-d0"); + if (defined($ENV{SMBD_OPTIONS})) { + @optargs = split(/ /, $ENV{SMBD_OPTIONS}); + } + exec($self->binpath("timelimit"), $smbd_maxtime, $self->binpath("smbd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start smbd: $!"); } - open(PID, ">$env_vars->{PIDDIR}/timelimit.smbd.pid"); - print PID $pid; - close(PID); + write_pid($env_vars, "smbd", $pid); print "DONE\n"; return 0; @@ -173,31 +250,50 @@ sub create_clientconf($$$) close(CONF); } -sub provision($$) +sub provision($$$) { - my ($self, $prefix) = @_; + my ($self, $prefix, $role) = @_; ## ## setup the various environment variables we need ## my %ret = (); - my $server = "localhost2"; + my $server = "LOCALHOST2"; my $server_ip = "127.0.0.2"; + my $domain = "SAMBA-TEST"; + my $username = `PATH=/usr/ucb:$ENV{PATH} whoami`; + chomp $username; my $password = "test"; my $srcdir="$RealBin/.."; my $scriptdir="$srcdir/selftest"; my $prefix_abs = abs_path($prefix); - my $shrdir="$prefix_abs/tmp"; + + my @dirs = (); + + my $shrdir="$prefix_abs/share"; + push(@dirs,$shrdir); + my $libdir="$prefix_abs/lib"; + push(@dirs,$libdir); + my $piddir="$prefix_abs/pid"; - my $conffile="$libdir/server.conf"; + push(@dirs,$piddir); + my $privatedir="$prefix_abs/private"; + push(@dirs,$privatedir); + my $lockdir="$prefix_abs/lockdir"; + push(@dirs,$lockdir); + my $logdir="$prefix_abs/logs"; - my $domain = "SAMBA-TEST"; + push(@dirs,$logdir); + + # this gets autocreated by winbindd + my $wbsockdir="$prefix_abs/winbindd"; + my $wbsockprivdir="$lockdir/winbindd_privileged"; ## ## create the test directory layout @@ -205,10 +301,9 @@ sub provision($$) mkdir($prefix_abs, 0777); print "CREATE TEST ENVIRONMENT IN '$prefix'..."; system("rm -rf $prefix_abs/*"); - mkdir($_, 0777) foreach($privatedir,$libdir,$piddir,$lockdir,$logdir); - my $tmpdir = "$prefix_abs/tmp"; - mkdir($tmpdir, 0777); - chmod 0777, $tmpdir; + mkdir($_, 0777) foreach(@dirs); + + my $conffile="$libdir/server.conf"; open(CONF, ">$conffile") or die("Unable to open $conffile"); print CONF " @@ -241,8 +336,19 @@ sub provision($$) printing = bsd printcap name = /dev/null +"; + + if ($role eq "dc") { + print CONF "\tdomain logons = yes\n"; + print CONF "\tdomain master = yes\n"; + } + +print CONF " + + winbindd:socket dir = $wbsockdir + [tmp] - path = $tmpdir + path = $shrdir read only = no smbd:sharedelay = 100000 map hidden = yes @@ -279,6 +385,7 @@ sub provision($$) $ret{SERVER_IP} = $server_ip; $ret{NMBD_TEST_LOG} = "$prefix/nmbd_test.log"; + $ret{WINBINDD_TEST_LOG} = "$prefix/winbindd_test.log"; $ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log"; $ret{SERVERCONFFILE} = $conffile; $ret{CONFIGURATION} ="-s $conffile"; @@ -288,6 +395,8 @@ sub provision($$) $ret{NETBIOSNAME} = $server; $ret{PASSWORD} = $password; $ret{PIDDIR} = $piddir; + $ret{WINBINDD_SOCKET_DIR} = $wbsockdir; + $ret{WINBINDD_PRIV_PIPE_DIR} = $wbsockprivdir; return \%ret; } diff --git a/source4/selftest/env/Samba4.pm b/source4/selftest/env/Samba4.pm index 11afc0e6f3..944ed83d58 100644 --- a/source4/selftest/env/Samba4.pm +++ b/source4/selftest/env/Samba4.pm @@ -104,6 +104,9 @@ sub check_or_start($$$) if (defined($max_time)) { $optarg = "--maximum-runtime=$max_time "; } + if (defined($ENV{SMBD_OPTIONS})) { + $optarg.= " $ENV{SMBD_OPTIONS}"; + } my $ret = system("$valgrind $self->{bindir}/smbd $optarg $env_vars->{CONFIGURATION} -M single -i --leak-report-full"); if ($? == -1) { print "Unable to start smbd: $ret: $!\n"; @@ -216,7 +219,7 @@ sub mk_openldap($$$) system("$self->{bindir}/ad2oLschema $configuration --option=convert:target=openldap -H $ldapdir/schema-tmp.ldb -I $self->{setupdir}/schema-map-openldap-2.3 -O $ldapdir/backend-schema.schema >&2") == 0 or die("schema conversion for OpenLDAP failed"); my $oldpath = $ENV{PATH}; - $ENV{PATH} = "/usr/local/sbin:/usr/sbin:/sbin:$ENV{PATH}"; + $ENV{PATH} = "$ENV{OPENLDAP_PATH}/usr/local/sbin:/usr/sbin:/sbin:$ENV{PATH}"; unlink($modconf); open(CONF, ">$modconf"); close(CONF); @@ -225,8 +228,18 @@ sub mk_openldap($$$) open(CONF, ">$modconf"); # enable slapd modules print CONF " +moduleload back_hdb +moduleload syncprov +"; + close(CONF); + } + + if (system("slaptest -u -f $slapd_conf >&2") != 0) { + open(CONF, ">$modconf"); + # enable slapd modules + print CONF " modulepath /usr/lib/ldap -moduleload back_bdb +moduleload back_hdb moduleload syncprov "; close(CONF); @@ -283,6 +296,7 @@ sub provision($$$$$$) my $ncalrpcdir = "$prefix_abs/ncalrpc"; my $lockdir = "$prefix_abs/lockdir"; my $winbindd_socket_dir = "$prefix_abs/winbind_socket"; + my $winbindd_priv_pipe_dir = "$piddir/smbd.tmp/winbind_pipe"; my $configuration = "--configfile=$conffile"; my $ldapdir = "$privatedir/ldap"; @@ -297,10 +311,6 @@ sub provision($$$$$$) $tmpdir); - my $localdomain = $domain; - $localdomain = $netbiosname if $server_role eq "member server"; - my $localrealm = $realm; - $localrealm = $netbiosname if $server_role eq "member server"; my $localbasedn = $basedn; $localbasedn = "DC=$netbiosname" if $server_role eq "member server"; @@ -417,8 +427,8 @@ my @provision_options = ("$self->{bindir}/smbscript", "$self->{setupdir}/provisi push (@provision_options, "--host-name=$netbiosname"); push (@provision_options, "--host-ip=$ifaceipv4"); push (@provision_options, "--quiet"); - push (@provision_options, "--domain=$localdomain"); - push (@provision_options, "--realm=$localrealm"); + push (@provision_options, "--domain=$domain"); + push (@provision_options, "--realm=$realm"); push (@provision_options, "--adminpass=$password"); push (@provision_options, "--krbtgtpass=krbtgt$password"); push (@provision_options, "--machinepass=machine$password"); @@ -426,6 +436,7 @@ my @provision_options = ("$self->{bindir}/smbscript", "$self->{setupdir}/provisi push (@provision_options, "--simple-bind-dn=cn=Manager,$localbasedn"); push (@provision_options, "--password=$password"); push (@provision_options, "--root=$root"); + push (@provision_options, "--server-role=$server_role"); my $ldap_uri= "$ldapdir/ldapi"; $ldap_uri =~ s|/|%2F|g; @@ -445,7 +456,9 @@ my @provision_options = ("$self->{bindir}/smbscript", "$self->{setupdir}/provisi PASSWORD => $password, LDAPDIR => $ldapdir, WINBINDD_SOCKET_DIR => $winbindd_socket_dir, + WINBINDD_PRIV_PIPE_DIR => $winbindd_priv_pipe_dir, NCALRPCDIR => $ncalrpcdir, + LOCKDIR => $lockdir, CONFIGURATION => $configuration, SOCKET_WRAPPER_DEFAULT_IFACE => $swiface }; @@ -453,7 +466,7 @@ my @provision_options = ("$self->{bindir}/smbscript", "$self->{setupdir}/provisi if (defined($self->{ldap})) { push (@provision_options, "--ldap-backend=$ldap_uri"); - system("$self->{bindir}/smbscript $self->{setupdir}/provision-backend $configuration --ldap-manager-pass=$password --root=$root --realm=$localrealm --host-name=$netbiosname --ldap-backend-type=$self->{ldap}>&2") == 0 or die("backend provision failed"); + system("$self->{bindir}/smbscript $self->{setupdir}/provision-backend $configuration --ldap-manager-pass=$password --root=$root --realm=$realm --host-name=$netbiosname --ldap-backend-type=$self->{ldap}>&2") == 0 or die("backend provision failed"); if ($self->{ldap} eq "openldap") { ($ret->{SLAPD_CONF}, $ret->{OPENLDAP_PIDFILE}) = $self->mk_openldap($ldapdir, $configuration) or die("Unable to create openldap directories"); diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 7d6c3a987a..efb1e3ef5b 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -7,10 +7,10 @@ use Exporter; use strict; -sub new($$) { - my ($class) = @_; - my $self = { - start => time(), +sub new($$$$) { + my ($class, $statistics) = @_; + my $self = { + statistics => $statistics, test_output => {} }; bless($self, $class); @@ -21,11 +21,12 @@ sub start_testsuite($$) my ($self, $state) = @_; my $out = ""; + my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= "Running test $state->{NAME} (level 0 stdout)\n"; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= scalar(localtime())."\n"; - $out .= "SELFTEST RUNTIME: " . ($state->{START_TIME} - $self->{START_TIME}) . "s\n"; + $out .= "SELFTEST RUNTIME: " . $duration . "s\n"; $out .= "NAME: $state->{NAME}\n"; $out .= "CMD: $state->{CMD}\n"; @@ -58,7 +59,7 @@ sub end_testsuite($$$$$) if ($ret == $expected_ret) { $out .= "ALL OK\n"; } else { - $out .= "ERROR: $ret"; + $out .= "ERROR: $ret\n"; $out .= $self->{test_output}->{$state->{NAME}}; } @@ -84,7 +85,11 @@ sub start_test($$$) sub end_test($$$$$$) { - my ($self, $state, $testname, $result, $expected, $reason) = @_; + my ($self, $state, $testname, $result, $unexpected, $reason) = @_; + + return unless ($unexpected); + + $self->{test_output}->{$state->{NAME}} .= "UNEXPECTED($result): $testname\n"; } sub summary($) @@ -99,11 +104,11 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } -sub skip_testsuite($$) +sub skip_testsuite($$$$) { - my ($self, $name) = @_; + my ($self, $envname, $name, $reason) = @_; - print "SKIPPED: $name\n"; + # Ignore skipped tests } 1; diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 156b5b98c7..22488576b4 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -7,6 +7,8 @@ use Exporter; use strict; use warnings; +use FindBin qw($RealBin); + sub new($$$$) { my ($class, $dirname, $statistics) = @_; my $self = { @@ -21,11 +23,12 @@ sub new($$$$) { unexpected_success => [], expected_failure => [], unexpected_failure => [], + skip_testsuites => [], error => [] } }; - link("selftest/output/testresults.css", "$dirname/testresults.css"); + link("$RealBin/output/testresults.css", "$dirname/testresults.css"); open(INDEX, ">$dirname/index.html"); @@ -89,6 +92,29 @@ sub start_testsuite($$) $self->print_html_header("Test Results for $state->{NAME}", *TEST); + + if ($state->{ENVNAME} ne "none") { + print TEST "<h2>Environment settings</h2>\n"; + + print TEST " <table>\n"; + print TEST " <tr><td><b>Variable name</b></td><td><b>Variable value</b></td></tr>\n"; + foreach (keys %{$state->{ENVVARS}}) { + print TEST " <tr><td>$_</td><td>"; + my $val = $state->{ENVVARS}->{$_}; + if ($val =~ /^\.\// and -r $val) { + print TEST "<a href=\"../$val\">$val</a>"; + } elsif (-r $val) { + print TEST "<a href=\"$val\">$val</a>"; + } else { + print TEST $val; + } + print TEST "</td></tr>\n"; + } + print TEST " </table>\n"; + } + + print TEST "<h2>Tests</h2>\n"; + print TEST " <table>\n"; } @@ -116,6 +142,7 @@ sub end_testsuite($$$$$) print TEST "</table>\n"; + print TEST "<div class=\"command\">$state->{CMD}</div>\n"; print TEST "<div class=\"duration\">Duration: " . (time() - $state->{START_TIME}) . "s</div>\n"; $self->print_html_footer(*TEST); @@ -261,6 +288,7 @@ sub summary($) print INDEX "</tr>\n"; print INDEX "</table>\n"; + print INDEX "<a href=\"summary.html\">Summary</a>\n"; print INDEX "</center>\n"; $self->print_html_footer(*INDEX); close(INDEX); @@ -298,6 +326,27 @@ sub summary($) print_table("Unexpected failures", $summ->{unexpected_failure}); print_table("Skipped tests", $summ->{skip}); print_table("Expected failures", $summ->{expected_failure}); + + print SUMMARY "<h3>Skipped testsuites</h3>\n"; + print SUMMARY "<table>\n"; + print SUMMARY "<tr>\n"; + print SUMMARY " <td class=\"tableHead\">Testsuite</td>\n"; + print SUMMARY " <td class=\"tableHead\">Reason</td>\n"; + print SUMMARY "</tr>\n"; + + foreach (@{$summ->{skip_testsuites}}) { + print SUMMARY "<tr>\n"; + print SUMMARY " <td>$$_[1]</td>\n"; + if (defined($$_[2])) { + print SUMMARY " <td>$$_[2]</td>\n"; + } else { + print SUMMARY " <td></td>\n"; + } + print SUMMARY "</tr>\n"; + } + + print SUMMARY "</table>"; + $self->print_html_footer(*SUMMARY); close(SUMMARY); } @@ -306,20 +355,15 @@ sub missing_env($$$) { my ($self, $name, $envname) = @_; - print INDEX "<tr>\n"; - print INDEX " <td class=\"testSuite\">$name</td>\n"; - print INDEX " <td class=\"resultSkipped\" colspan=\"2\">SKIPPED - environment `$envname` not available!</td>\n"; - print INDEX "</tr>\n"; + $self->skip_testsuite($envname, $name, "environment `$envname` not available!"); } -sub skip_testsuite($$) +sub skip_testsuite($$$$) { - my ($self, $name) = @_; + my ($self, $envname, $name, $reason) = @_; - print INDEX "<tr>\n"; - print INDEX " <td class=\"testSuite\">$name</td>\n"; - print INDEX " <td class=\"resultSkipped\" colspan=\"2\">SKIPPED</td>\n"; - print INDEX "</tr>\n"; + push (@{$self->{error_summary}->{skip_testsuites}}, + [$envname, $name, $reason]); } 1; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 10d6eee215..e4abb2d05a 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -13,8 +13,7 @@ sub new($$$$) { immediate => $immediate, statistics => $statistics, test_output => {}, - suitesfailed => [], - start => time() + suitesfailed => [] }; bless($self, $class); } @@ -61,6 +60,8 @@ sub end_testsuite($$$$$) my ($self, $state, $expected_ret, $ret, $envlog) = @_; my $out = ""; + $self->output_msg($state, "ENVLOG: $envlog\n") if ($envlog ne ""); + if ($ret != $expected_ret) { $self->output_msg($state, "ERROR: $ret\n"); } @@ -77,9 +78,24 @@ sub start_test($$) my ($state, $testname) = @_; } -sub end_test($$$$$) +sub end_test($$$$$$) { - my ($state, $testname, $result, $unexpected, $reason) = @_; + my ($self, $state, $testname, $result, $unexpected, $reason) = @_; + my $append = ""; + + unless ($unexpected) { + $self->{test_output}->{$state->{NAME}} = ""; + return; + } + + $append = "UNEXPECTED($result): $testname\n"; + + $self->{test_output}->{$state->{NAME}} .= $append; + + if ($self->{immediate} and not $self->{verbose}) { + print $self->{test_output}->{$state->{NAME}}; + $self->{test_output}->{$state->{NAME}} = ""; + } } sub summary($) @@ -111,11 +127,15 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } -sub skip_testsuite($$) +sub skip_testsuite($$$) { - my ($self, $name) = @_; + my ($self, $envname, $name, $reason) = @_; - print "SKIPPED: $name\n"; + if ($reason) { + print "SKIPPED: $name [$reason]\n"; + } else { + print "SKIPPED: $name\n"; + } } 1; diff --git a/source4/selftest/output/testresults.css b/source4/selftest/output/testresults.css index 56c4b0ead4..66d1d6b2ad 100644 --- a/source4/selftest/output/testresults.css +++ b/source4/selftest/output/testresults.css @@ -122,3 +122,8 @@ div.duration text-align: right; font-weight: bold; } + +div.command +{ + background-color: gray; +} diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 3f8a74f7bc..3ab87f8dcc 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -13,7 +13,7 @@ selftest - Samba test runner selftest --help -selftest [--srcdir=DIR] [--builddir=DIR] [--target=samba4|samba3|win] [--socket-wrapper] [--quick] [--one] [--prefix=prefix] [--immediate] [TESTS] +selftest [--srcdir=DIR] [--builddir=DIR] [--target=samba4|samba3|win] [--socket-wrapper] [--quick] [--one] [--prefix=prefix] [--immediate] [--testlist=FILE] [TESTS] =head1 DESCRIPTION @@ -69,15 +69,23 @@ The format for the file is, one entry per line: TESTSUITE-NAME/TEST-NAME +The reason for a test can also be specified, by adding a hash sign (#) and the reason +after the test name. + =item I<--skip> Specify a file containing a list of tests that should be skipped. Possible candidates are -tests that segfault the server, flip or don't end. +tests that segfault the server, flip or don't end. The format of this file is the same as +for the --expected-failures flag. =item I<--one> Abort as soon as one test fails. +=item I<--testlist> + +Load a list of tests from the specified location. + =back =head1 ENVIRONMENT @@ -129,7 +137,7 @@ my $opt_socket_wrapper_keep_pcap = undef; my $opt_one = 0; my $opt_immediate = 0; my $opt_expected_failures = undef; -my $opt_skip = undef; +my @opt_skip = (); my $opt_verbose = 0; my $opt_testenv = 0; my $ldap = undef; @@ -138,6 +146,7 @@ my $opt_resetup_env = undef; my $opt_bindir = undef; my $opt_no_lazy_setup = undef; my $opt_format = "plain"; +my @opt_testlists = (); my $srcdir = "."; my $builddir = "."; @@ -161,26 +170,30 @@ my $statistics = { TESTS_SKIP => 0, }; -sub expecting_failure($) +sub find_in_list($$) { - my $fullname = shift; + my ($list, $fullname) = @_; - foreach (@expected_failures) { - return 1 if ($fullname =~ /$_/); + foreach (@$list) { + if ($fullname =~ /$$_[0]/) { + return ($$_[1]) if ($$_[1]); + return "NO REASON SPECIFIED"; + } } - return 0; + return undef; } -sub skip($) +sub expecting_failure($) { - my $fullname = shift; - - foreach (@skips) { - return 1 if ($fullname =~ /$_/); - } + my ($name) = @_; + return find_in_list(\@expected_failures, $name); +} - return 0; +sub skip($) +{ + my ($name) = @_; + return find_in_list(\@skips, $name); } sub getlog_env($); @@ -213,11 +226,12 @@ sub cleanup_pcap($$$) $state->{PCAP_FILE} = undef; } -sub run_testsuite($$$$$$) +sub run_testsuite($$$$$$$) { - my ($envname, $name, $cmd, $i, $totalsuites, $msg_ops) = @_; + my ($envname, $envvars, $name, $cmd, $i, $totalsuites, $msg_ops) = @_; my $msg_state = { ENVNAME => $envname, + ENVVARS => $envvars, NAME => $name, CMD => $cmd, INDEX => $i, @@ -234,6 +248,7 @@ sub run_testsuite($$$$$$) $msg_ops, $msg_state, $statistics, *RESULT, \&expecting_failure); my $ret = close(RESULT); + $ret = 0 unless $ret == 1; cleanup_pcap($msg_state, $expected_ret, $ret); @@ -266,6 +281,7 @@ Usage: $Script [OPTIONS] PREFIX Generic options: --help this help page --target=samba4|samba3|win Samba version to target + --testlist=FILE file to read available tests from Paths: --prefix=DIR prefix to run tests in [st] @@ -273,7 +289,7 @@ Paths: --builddir=DIR output directory [.] Target Specific: - --socket-wrapper-pcap=DIR save traffic to pcap directories + --socket-wrapper-pcap save traffic to pcap directories --socket-wrapper-keep-pcap keep all pcap files, not just those for tests that failed --socket-wrapper enable socket wrapper @@ -306,7 +322,7 @@ my $result = GetOptions ( 'one' => \$opt_one, 'immediate' => \$opt_immediate, 'expected-failures=s' => \$opt_expected_failures, - 'skip=s' => \$opt_skip, + 'skip=s' => \@opt_skip, 'srcdir=s' => \$srcdir, 'builddir=s' => \$builddir, 'verbose' => \$opt_verbose, @@ -317,6 +333,7 @@ my $result = GetOptions ( 'resetup-environment' => \$opt_resetup_env, 'bindir:s' => \$opt_bindir, 'format=s' => \$opt_format, + 'testlist=s' => \@opt_testlists ); exit(1) if (not $result); @@ -368,12 +385,12 @@ $ENV{PREFIX_ABS} = $prefix_abs; $ENV{SRCDIR} = $srcdir; $ENV{SRCDIR_ABS} = $srcdir_abs; -my $tls_enabled = not $opt_quick; if (defined($ENV{RUN_FROM_BUILD_FARM}) and ($ENV{RUN_FROM_BUILD_FARM} eq "yes")) { $opt_format = "buildfarm"; } +my $tls_enabled = not $opt_quick; $ENV{TLS_ENABLED} = ($tls_enabled?"yes":"no"); $ENV{LD_LDB_MODULE_PATH} = "$old_pwd/bin/modules/ldb"; $ENV{LD_SAMBA_MODULE_PATH} = "$old_pwd/bin/modules"; @@ -387,7 +404,8 @@ if (defined($ENV{PKG_CONFIG_PATH})) { } else { $ENV{PKG_CONFIG_PATH} = "$old_pwd/bin/pkgconfig"; } -$ENV{PATH} = "$old_pwd/bin:$ENV{PATH}"; +# Required for smbscript: +$ENV{PATH} = "$old_pwd/bin:$old_pwd:$ENV{PATH}"; if ($opt_socket_wrapper_pcap) { @@ -404,37 +422,48 @@ if ($opt_socket_wrapper) { } my $target; +my $testenv_default = "none"; if ($opt_target eq "samba4") { - $target = new Samba4("$srcdir/bin", $ldap, "$srcdir/setup"); + $testenv_default = "member"; + $target = new Samba4($opt_bindir or "$srcdir/bin", $ldap, "$srcdir/setup"); } elsif ($opt_target eq "samba3") { - if ($opt_socket_wrapper and `smbd -b | grep SOCKET_WRAPPER` eq "") { + if ($opt_socket_wrapper and `$opt_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 = "dc"; $target = new Samba3($opt_bindir); } elsif ($opt_target eq "win") { die("Windows tests will not run with socket wrapper enabled.") if ($opt_socket_wrapper); + $testenv_default = "dc"; $target = new Windows(); } -if (defined($opt_expected_failures)) { - open(KNOWN, "<$opt_expected_failures") or die("unable to read known failures file: $!"); - while (<KNOWN>) { +sub read_test_regexes($) +{ + my ($name) = @_; + my @ret = (); + open(LF, "<$name") or die("unable to read $name: $!"); + while (<LF>) { chomp; - s/([ \t]+)\#(.*)$//; - push (@expected_failures, $_); } - close(KNOWN); + if (/^(.*?)([ \t]+)\#(.*)$/) { + push (@ret, [$1, $3]); + } else { + s/^(.*?)([ \t]+)\#(.*)$//; + push (@ret, [$_, undef]); + } + } + close(LF); + return @ret; } -if (defined($opt_skip)) { - open(SKIP, "<$opt_skip") or die("unable to read skip file: $!"); - while (<SKIP>) { - chomp; - s/([ \t]+)\#(.*)$//; - push (@skips, $_); } - close(SKIP); +if (defined($opt_expected_failures)) { + @expected_failures = read_test_regexes($opt_expected_failures); +} + +foreach (@opt_skip) { + push (@skips, read_test_regexes($_)); } my $interfaces = join(',', ("127.0.0.6/8", @@ -504,7 +533,7 @@ push (@torture_options, "--configfile=$conffile"); # ensure any one smbtorture call doesn't run too long push (@torture_options, "--maximum-runtime=$torture_maxtime"); push (@torture_options, "--target=$opt_target"); -push (@torture_options, "--basedir=$prefix"); +push (@torture_options, "--basedir=$prefix_abs"); push (@torture_options, "--option=torture:progress=no") if ($opt_format eq "buildfarm"); push (@torture_options, "--format=subunit"); push (@torture_options, "--option=torture:quick=yes") if ($opt_quick); @@ -520,28 +549,47 @@ $ENV{CONFIGURATION} = "--configfile=$conffile"; my %required_envs = (); -if ($opt_quick) { - open(IN, "$testsdir/tests_quick.sh|"); -} else { - open(IN, "$testsdir/tests_all.sh|"); -} -while (<IN>) { - if ($_ eq "-- TEST --\n") { - my $name = <IN>; - $name =~ s/\n//g; - my $env = <IN>; - $env =~ s/\n//g; - my $cmdline = <IN>; - $cmdline =~ s/\n//g; - if (not defined($tests) or $name =~ /$tests/) { - $required_envs{$env} = 1; - push (@todo, [$name, $env, $cmdline]); +sub read_testlist($) +{ + my ($filename) = @_; + + my @ret = (); + open(IN, $filename) or die("Unable to open $filename: $!"); + + while (<IN>) { + if ($_ eq "-- TEST --\n") { + my $name = <IN>; + $name =~ s/\n//g; + my $env = <IN>; + $env =~ s/\n//g; + my $cmdline = <IN>; + $cmdline =~ s/\n//g; + if (not defined($tests) or $name =~ /$tests/) { + $required_envs{$env} = 1; + push (@ret, [$name, $env, $cmdline]); + } + } else { + print; } - } else { - print; } + close(IN) or die("Error creating recipe"); + return @ret; +} + +if ($opt_quick) { + @todo = read_testlist("$testsdir/tests_quick.sh|"); +} else { + @todo = read_testlist("$testsdir/tests_all.sh|"); } -close(IN) or die("Error creating recipe"); + +foreach (@opt_testlists) { + push(@todo, read_testlist($_)); +} + +if ($#todo == -1) { + print STDERR "No tests to run\n"; + exit(1); + } my $suitestotal = $#todo + 1; my $i = 0; @@ -574,9 +622,16 @@ my @exported_envvars = ( # misc stuff "KRB5_CONFIG", - "WINBINDD_SOCKET_DIR" + "WINBINDD_SOCKET_DIR", + "WINBINDD_PRIV_PIPE_DIR" ); +$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub { + my $signame = shift; + teardown_env($_) foreach(keys %running_envs); + die("Received signal $signame"); +}; + sub setup_env($) { my ($envname) = @_; @@ -595,6 +650,8 @@ sub setup_env($) return undef unless defined($testenv_vars); + $running_envs{$envname} = $testenv_vars; + SocketWrapper::set_default_iface(6); write_clientconf($conffile, $testenv_vars); @@ -606,7 +663,6 @@ sub setup_env($) } } - $running_envs{$envname} = $testenv_vars; return $testenv_vars; } @@ -648,7 +704,7 @@ sub teardown_env($) my $msg_ops; if ($opt_format eq "buildfarm") { require output::buildfarm; - $msg_ops = new output::buildfarm(); + $msg_ops = new output::buildfarm($statistics); } elsif ($opt_format eq "plain") { require output::plain; $msg_ops = new output::plain($opt_verbose, $opt_immediate, $statistics); @@ -666,7 +722,7 @@ if ($opt_no_lazy_setup) { if ($opt_testenv) { my $testenv_name = $ENV{SELFTEST_TESTENV}; - $testenv_name = "dc" unless defined($testenv_name); + $testenv_name = $testenv_default unless defined($testenv_name); my $testenv_vars = setup_env($testenv_name); @@ -696,21 +752,22 @@ $envvarstr my $name = $$_[0]; my $envname = $$_[1]; - if (skip($name)) { - $msg_ops->skip_testsuite($name); + my $skipreason = skip($name); + if ($skipreason) { + $msg_ops->skip_testsuite($envname, $name, $skipreason); $statistics->{SUITES_SKIPPED}++; next; } my $envvars = setup_env($envname); if (not defined($envvars)) { - $statistics->{SUITES_FAIL}++; - $statistics->{TESTS_ERROR}++; + $statistics->{SUITES_SKIPPED}++; $msg_ops->missing_env($name, $envname); next; } - run_testsuite($envname, $name, $cmd, $i, $suitestotal, $msg_ops); + run_testsuite($envname, $envvars, $name, $cmd, $i, $suitestotal, + $msg_ops); if (defined($opt_analyse_cmd)) { system("$opt_analyse_cmd \"$name\""); diff --git a/source4/selftest/test_binding_string.sh b/source4/selftest/test_binding_string.sh deleted file mode 100755 index a8afc07ac1..0000000000 --- a/source4/selftest/test_binding_string.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -incdir=`dirname $0` -. $incdir/test_functions.sh - -for I in "ncacn_np:\$SERVER" \ - "ncacn_ip_tcp:\$SERVER" \ - "ncacn_np:\$SERVER[rpcecho]" \ - "ncacn_np:\$SERVER[/pipe/rpcecho]" \ - "ncacn_np:\$SERVER[/pipe/rpcecho,sign,seal]" \ - "ncacn_np:\$SERVER[,sign]" \ - "ncacn_ip_tcp:\$SERVER[,sign]" \ - "ncalrpc:" \ - "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_np:\$SERVER" \ - "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_ip_tcp:\$SERVER" -do - plantest "$I" dc bin/smbtorture $TORTURE_OPTIONS "$I" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" --option=torture:quick=yes RPC-ECHO "$*" -done diff --git a/source4/selftest/test_cifs.sh b/source4/selftest/test_cifs.sh index 76bb4c65e7..f24f8d7398 100755 --- a/source4/selftest/test_cifs.sh +++ b/source4/selftest/test_cifs.sh @@ -8,10 +8,10 @@ ADDARGS="$*" incdir=`dirname $0` . $incdir/test_functions.sh -raw=`bin/smbtorture --list | grep "^RAW-" | xargs` -base=`bin/smbtorture --list | grep "^BASE-" | xargs` +raw=`$samba4bindir/smbtorture --list | grep "^RAW-" | xargs` +base=`$samba4bindir/smbtorture --list | grep "^BASE-" | xargs` tests="$base $raw" for t in $tests; do - plantest "ntvfs/cifs $t" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $t + plantest "ntvfs/cifs $t" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $ADDARGS //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $t done diff --git a/source4/selftest/test_echo.sh b/source4/selftest/test_echo.sh index f09aeca4e5..38bbec4f4e 100755 --- a/source4/selftest/test_echo.sh +++ b/source4/selftest/test_echo.sh @@ -10,7 +10,7 @@ for transport in $transports; do for ntlmoptions in \ "--option=socket:testnonblock=True --option=torture:quick=yes"; do name="RPC-ECHO on $transport with $bindoptions and $ntlmoptions" - plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" RPC-ECHO "$*" + plantest "$name" dc $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" RPC-ECHO "$*" done done done @@ -29,10 +29,10 @@ for transport in $transports; do "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \ ; do name="RPC-ECHO on $transport with $bindoptions and $ntlmoptions" - plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" + plantest "$name" dc $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" done done done name="RPC-ECHO on ncacn_np over smb2" -plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS ncacn_np:"\$SERVER[smb2]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" +plantest "$name" dc $samba4bindir/smbtorture $TORTURE_OPTIONS ncacn_np:"\$SERVER[smb2]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" diff --git a/source4/selftest/test_ejs.sh b/source4/selftest/test_ejs.sh index c81a2afefb..86ea6cd8c9 100755 --- a/source4/selftest/test_ejs.sh +++ b/source4/selftest/test_ejs.sh @@ -6,11 +6,8 @@ CONFIGURATION="$*" incdir=`dirname $0` . $incdir/test_functions.sh -SCRIPTDIR=../testprogs/ejs -DATADIR=../testdata - -PATH=bin:$PATH -export PATH +SCRIPTDIR=$samba4srcdir/../testprogs/ejs +DATADIR=$samba4srcdir/../testdata plantest "base.js" dc "$SCRIPTDIR/base.js" $CONFIGURATION plantest "samr.js" dc "$SCRIPTDIR/samr.js" $CONFIGURATION ncalrpc: -U\$USERNAME%\$PASSWORD @@ -18,4 +15,4 @@ plantest "echo.js" dc "$SCRIPTDIR/echo.js" $CONFIGURATION ncalrpc: -U\$USERNAME% #plantest "ejsnet.js" dc "$SCRIPTDIR/ejsnet.js" $CONFIGURATION -U\$USERNAME%\$PASSWORD \$DOMAIN ejstestuser plantest "ldb.js" none "$SCRIPTDIR/ldb.js" `pwd` $CONFIGURATION plantest "samba3sam.js" none $SCRIPTDIR/samba3sam.js $CONFIGURATION `pwd` $DATADIR/samba3/ -plantest "winreg" dc scripting/bin/winreg $CONFIGURATION ncalrpc: 'HKLM' -U\$USERNAME%\$PASSWORD +plantest "winreg" dc $samba4srcdir/scripting/bin/winreg $CONFIGURATION ncalrpc: 'HKLM' -U\$USERNAME%\$PASSWORD diff --git a/source4/selftest/test_functions.sh b/source4/selftest/test_functions.sh index 6a7f8aba98..1983760c64 100755 --- a/source4/selftest/test_functions.sh +++ b/source4/selftest/test_functions.sh @@ -10,3 +10,6 @@ plantest() { echo $env echo $cmdline } + +samba4srcdir=$incdir/.. +samba4bindir=$samba4srcdir/bin diff --git a/source4/selftest/test_ldap.sh b/source4/selftest/test_ldap.sh index 627eb905fb..85c3f95915 100755 --- a/source4/selftest/test_ldap.sh +++ b/source4/selftest/test_ldap.sh @@ -4,30 +4,28 @@ incdir=`dirname $0` . $incdir/test_functions.sh -p=ldap for options in "" "--option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD --option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD"; do - plantest "TESTING PROTOCOL $p with options $options" dc ../testprogs/blackbox/test_ldb.sh $p \$SERVER_IP $options + plantest "TESTING PROTOCOL ldap with options $options" dc $samba4srcdir/../testprogs/blackbox/test_ldb.sh ldap \$SERVER_IP $options done # see if we support ldaps if grep ENABLE_GNUTLS.1 include/config.h > /dev/null; then - p=ldaps for options in "" "-U\$USERNAME%\$PASSWORD"; do - plantest "TESTING PROTOCOL $p with options $options" dc ../testprogs/blackbox/test_ldb.sh $p \$SERVER_IP $options + plantest "TESTING PROTOCOL ldaps with options $options" dc $samba4srcdir/../testprogs/blackbox/test_ldb.sh ldaps \$SERVER_IP $options done fi for t in LDAP-CLDAP LDAP-BASIC LDAP-SCHEMA LDAP-UPTODATEVECTOR do - plantest "$t" dc bin/smbtorture $TORTURE_OPTIONS "-U\$USERNAME%\$PASSWORD" //\$SERVER_IP/_none_ $t + plantest "$t" dc $samba4bindir/smbtorture $TORTURE_OPTIONS "-U\$USERNAME%\$PASSWORD" //\$SERVER_IP/_none_ $t done # only do the ldb tests when not in quick mode - they are quite slow, and ldb # is now pretty well tested by the rest of the quick tests anyway test "$TORTURE_QUICK" = "yes" || { - LDBDIR=lib/ldb + LDBDIR=$samba4srcdir/lib/ldb export LDBDIR plantest "ldb" none $LDBDIR/tests/test-tdb.sh } -SCRIPTDIR=../testprogs/ejs +SCRIPTDIR=$samba4srcdir/../testprogs/ejs plantest "ejs ldap" dc $SCRIPTDIR/ldap.js $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD diff --git a/source4/selftest/test_local.sh b/source4/selftest/test_local.sh index b3b8387f00..5f53b4efed 100755 --- a/source4/selftest/test_local.sh +++ b/source4/selftest/test_local.sh @@ -1,12 +1,10 @@ #!/bin/sh -local_tests=`bin/smbtorture --list | grep "^LOCAL-" | xargs` - incdir=`dirname $0` . $incdir/test_functions.sh -for t in $local_tests; do - plantest "$t" none $VALGRIND bin/smbtorture $TORTURE_OPTIONS ncalrpc: $t "$*" +for t in `$samba4bindir/smbtorture --list | grep "^LOCAL-" | xargs`; do + plantest "$t" none $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS ncalrpc: $t "$*" done -plantest "tdb stress" none $VALGRIND bin/tdbtorture +plantest "tdb stress" none $VALGRIND $samba4bindir/tdbtorture diff --git a/source4/selftest/test_member.sh b/source4/selftest/test_member.sh index 88b382fbeb..0fdc957d53 100755 --- a/source4/selftest/test_member.sh +++ b/source4/selftest/test_member.sh @@ -3,6 +3,9 @@ incdir=`dirname $0` . $incdir/test_functions.sh -plantest "RPC-ECHO against member server with local creds" member $VALGRIND bin/smbtorture $TORTURE_OPTIONS ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" RPC-ECHO "$*" -plantest "RPC-ECHO against member server with domain creds" member $VALGRIND bin/smbtorture $TORTURE_OPTIONS ncacn_np:"\$NETBIOSNAME" -U"\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" RPC-ECHO "$*" -plantest "wbinfo -a against member server with domain creds" member $VALGRIND bin/wbinfo -a "\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" +plantest "RPC-ECHO against member server with local creds" member $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" RPC-ECHO "$*" +plantest "RPC-ECHO against member server with domain creds" member $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS ncacn_np:"\$NETBIOSNAME" -U"\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" RPC-ECHO "$*" +plantest "RPC-SAMR against member server with local creds" member $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR" "$*" +plantest "RPC-SAMR-USERS against member server with local creds" member $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-USERS" "$*" +plantest "RPC-SAMR-PASSWORDS against member server with local creds" member $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-PASSWORDS" "$*" +plantest "wbinfo -a against member server with domain creds" member $VALGRIND $samba4bindir/wbinfo -a "\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" diff --git a/source4/selftest/test_nbt.sh b/source4/selftest/test_nbt.sh index 1ff5ee641d..22062d5d44 100755 --- a/source4/selftest/test_nbt.sh +++ b/source4/selftest/test_nbt.sh @@ -4,18 +4,15 @@ incdir=`dirname $0` . $incdir/test_functions.sh -PATH=bin:$PATH -export PATH - TEST_NBT_ENVNAME=$1 if test x"$TEST_NBT_ENVNAME" = x"";then TEST_NBT_ENVNAME="dc" fi -NBT_TESTS=`bin/smbtorture --list | grep "^NBT-" | xargs` +NBT_TESTS=`$samba4bindir/smbtorture --list | grep "^NBT-" | xargs` if test x"$TEST_NBT_ENVNAME" = x"dc";then for f in $NBT_TESTS; do - plantest "$f:$TEST_NBT_ENVNAME" $TEST_NBT_ENVNAME bin/smbtorture $TORTURE_OPTIONS //\$SERVER/_none_ $f -U\$USERNAME%\$PASSWORD + plantest "$f:$TEST_NBT_ENVNAME" $TEST_NBT_ENVNAME $samba4bindir/smbtorture $TORTURE_OPTIONS //\$SERVER/_none_ $f -U\$USERNAME%\$PASSWORD done fi diff --git a/source4/selftest/test_net.sh b/source4/selftest/test_net.sh index c99fee4f46..1721c31b02 100755 --- a/source4/selftest/test_net.sh +++ b/source4/selftest/test_net.sh @@ -2,23 +2,11 @@ # add tests to this list as they start passing, so we test # that they stay passing -ncacn_np_tests="NET-API-LOOKUP NET-API-LOOKUPHOST NET-API-LOOKUPPDC NET-API-RPCCONN-BIND NET-API-RPCCONN-SRV NET-API-RPCCONN-PDC NET-API-RPCCONN-DC NET-API-RPCCONN-DCINFO NET-API-LISTSHARES NET-API-CREATEUSER NET-API-DELETEUSER NET-API-DOMLIST" -ncalrpc_tests="NET-API-RPCCONN-SRV NET-API-RPCCONN-DC NET-API-RPCCONN-DCINFO NET-API-LISTSHARES NET-API-CREATEUSER NET-API-DELETEUSER NET-USERINFO NET-USERADD NET-USERDEL NET-USERMOD NET-API-LOOKUPNAME NET-API-USERINFO NET-API-USERLIST NET-API-DOMOPENLSA NET-API-DOMCLOSELSA NET-API-DOMOPENSAMR NET-API-DOMCLOSESAMR NET-API-DOMLIST" -ncacn_ip_tcp_tests="NET-API-LOOKUP NET-API-LOOKUPHOST NET-API-LOOKUPPDC NET-API-RPCCONN-SRV NET-API-RPCCONN-DC NET-API-RPCCONN-DCINFO NET-API-LISTSHARES NET-API-CREATEUSER NET-API-DELETEUSER NET-API-MODIFYUSER NET-API-DOMLIST" - incdir=`dirname $0` . $incdir/test_functions.sh -for bindoptions in seal,padcheck $VALIDATE bigendian; do - for transport in ncalrpc ncacn_np ncacn_ip_tcp; do - case $transport in - ncalrpc) tests=$ncalrpc_tests ;; - ncacn_np) tests=$ncacn_np_tests ;; - ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;; - esac - for t in $tests; do - name="$t on $transport with $bindoptions" - plantest "$name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" $t "$*" - done - done +tests=`$samba4bindir/smbtorture --list | grep ^NET-` + +for t in $tests; do + plantest "$t" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS "\$SERVER[$VALIDATE]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" $t "$*" done diff --git a/source4/selftest/test_nss.sh b/source4/selftest/test_nss.sh index f493cbe208..689d1038f1 100755 --- a/source4/selftest/test_nss.sh +++ b/source4/selftest/test_nss.sh @@ -3,9 +3,9 @@ incdir=`dirname $0` . $incdir/test_functions.sh -if [ ! -f bin/nsstest ]; then +if [ ! -f $samba4bindir/nsstest ]; then exit 0 fi -plantest "NSS-TEST using winbind" member $VALGRIND bin/nsstest bin/shared/libnss_winbind.so +plantest "NSS-TEST using winbind" member $VALGRIND $samba4bindir/nsstest $samba4bindir/shared/libnss_winbind.so diff --git a/source4/selftest/test_pidl.sh b/source4/selftest/test_pidl.sh index 6a20cd9fc8..1c68acf053 100755 --- a/source4/selftest/test_pidl.sh +++ b/source4/selftest/test_pidl.sh @@ -10,8 +10,8 @@ incdir=`dirname $0` if test x"${PIDL_TESTS_SKIP}" = x"yes"; then echo "Skipping pidl tests - PIDL_TESTS_SKIP=yes" elif $PERL -e 'eval require Test::More;' > /dev/null 2>&1; then - for f in pidl/tests/*.pl; do - plantest "$f" none $PERL $f "|" ./script/harness2subunit.pl + for f in $samba4srcdir/pidl/tests/*.pl; do + plantest "pidl/`basename $f`" none $PERL $f "|" $samba4srcdir/script/harness2subunit.pl done else echo "Skipping pidl tests - Test::More not installed" diff --git a/source4/selftest/test_posix.sh b/source4/selftest/test_posix.sh index 8a547b906e..383766cdf3 100755 --- a/source4/selftest/test_posix.sh +++ b/source4/selftest/test_posix.sh @@ -8,11 +8,11 @@ ADDARGS="$*" incdir=`dirname $0` . $incdir/test_functions.sh -smb2=`bin/smbtorture --list | grep "^SMB2-" | xargs` -raw=`bin/smbtorture --list | grep "^RAW-" | xargs` -base=`bin/smbtorture --list | grep "^BASE-" | xargs` +smb2=`$samba4bindir/smbtorture --list | grep "^SMB2-" | xargs` +raw=`$samba4bindir/smbtorture --list | grep "^RAW-" | xargs` +base=`$samba4bindir/smbtorture --list | grep "^BASE-" | xargs` tests="$base $raw $smb2" for t in $tests; do - plantest "$t" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $t + plantest "$t" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $t done diff --git a/source4/selftest/test_quick.sh b/source4/selftest/test_quick.sh deleted file mode 100755 index 438c04e444..0000000000 --- a/source4/selftest/test_quick.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# run a quick set of filesystem tests - -ADDARGS="$*" - -incdir=`dirname $0` -. $incdir/test_functions.sh - -tests="BASE-UNLINK BASE-ATTR BASE-DELETE" -tests="$tests BASE-TCON BASE-OPEN" -tests="$tests BASE-CHKPATH RAW-QFSINFO RAW-QFILEINFO RAW-SFILEINFO" -tests="$tests RAW-MKDIR RAW-SEEK RAW-OPEN RAW-WRITE" -tests="$tests RAW-UNLINK RAW-READ RAW-CLOSE RAW-IOCTL RAW-RENAME" -tests="$tests RAW-EAS RAW-STREAMS" - -for t in $tests; do - plantest "$t" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $t -done - -name=BASE-OPEN -plantest "ntvfs/cifs $name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $name diff --git a/source4/selftest/test_rpc.sh b/source4/selftest/test_rpc.sh index adcab0af39..3ac4e3de66 100755 --- a/source4/selftest/test_rpc.sh +++ b/source4/selftest/test_rpc.sh @@ -2,16 +2,28 @@ # add tests to this list as they start passing, so we test # that they stay passing -ncacn_np_tests="RPC-SPOOLSS RPC-SRVSVC RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-MGMT RPC-HANDLES RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-INITSHUTDOWN RPC-EVENTLOG RPC-ATSVC RPC-SAMSYNC RPC-OXIDRESOLVE RPC-DFS" -ncalrpc_tests="RPC-MGMT RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-EVENTLOG RPC-ATSVC RPC-INITSHUTDOWN RPC-OXIDRESOLVE RPC-DFS" -ncacn_ip_tcp_tests="RPC-UNIXINFO RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-ECHO RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-MGMT RPC-HANDLES RPC-WINREG RPC-WKSSVC RPC-SVCCTL RPC-EPMAPPER RPC-ATSVC RPC-EVENTLOG RPC-DSSYNC RPC-OXIDRESOLVE RPC-DFS" -slow_ncacn_np_tests="RPC-SAMLOGON RPC-SAMR RPC-SAMR-USERS RPC-SAMR-PASSWORDS RPC-COUNTCALLS" -slow_ncalrpc_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-COUNTCALLS RPC-CRACKNAMES" -slow_ncacn_ip_tcp_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-COUNTCALLS RPC-CRACKNAMES" +ncacn_np_tests="RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-HANDLES RPC-SAMSYNC RPC-SAMBA3SESSIONKEY RPC-SAMBA3-GETUSERNAME RPC-SAMBA3-LSA RPC-BINDSAMBA3 RPC-NETLOGSAMBA3 RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-AUTHCONTEXT" +ncalrpc_tests="RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-DRSUAPI RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-AUTHCONTEXT" +ncacn_ip_tcp_tests="RPC-SCHANNEL RPC-JOIN RPC-LSA RPC-DSSETUP RPC-ALTERCONTEXT RPC-MULTIBIND RPC-NETLOGON RPC-HANDLES RPC-DSSYNC RPC-ASYNCBIND RPC-LSALOOKUP RPC-LSA-GETUSER RPC-SCHANNEL2 RPC-AUTHCONTEXT" +slow_ncacn_np_tests="RPC-SAMLOGON RPC-SAMR RPC-SAMR-USERS RPC-SAMR-PASSWORDS" +slow_ncalrpc_tests="RPC-SAMR RPC-SAMR-PASSWORDS" +slow_ncacn_ip_tcp_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-CRACKNAMES" incdir=`dirname $0` . $incdir/test_functions.sh +all_tests="$ncalrpc_tests $ncacn_np_tests $ncacn_ip_tcp_tests $slow_ncalrpc_tests $slow_ncacn_np_tests $slow_ncacn_ip_tcp_tests RPC-SECRETS RPC-SAMBA3-SHARESEC" + +# Make sure all tests get run +for t in `$samba4bindir/smbtorture --list | grep "^RPC-"` +do + echo $all_tests | grep $t > /dev/null + if [ $? -ne 0 ] + then + auto_rpc_tests="$auto_rpc_tests $t" + fi +done + for bindoptions in seal,padcheck $VALIDATE bigendian; do for transport in ncalrpc ncacn_np ncacn_ip_tcp; do case $transport in @@ -21,8 +33,15 @@ for bindoptions in seal,padcheck $VALIDATE bigendian; do esac for t in $tests; do name="$t on $transport with $bindoptions" - plantest "$name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + plantest "$name" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done + plantest "RPC-SAMBA3-SHARESEC on $transport with $bindoptions" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=torture:share=tmp $t "$*" + done +done + +for bindoptions in "" $VALIDATE bigendian; do + for t in $auto_rpc_tests; do + plantest "$t with $bindoptions" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS "\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done done @@ -35,7 +54,8 @@ for bindoptions in connect $VALIDATE ; do esac for t in $tests; do name="$t on $transport with $bindoptions" - plantest "$name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + plantest "$name" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done done done + diff --git a/source4/selftest/test_rpc_quick.sh b/source4/selftest/test_rpc_quick.sh deleted file mode 100755 index 8793e0b6e6..0000000000 --- a/source4/selftest/test_rpc_quick.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# add tests to this list as they start passing, so we test -# that they stay passing -ncacn_np_tests="RPC-ALTERCONTEXT RPC-JOIN RPC-ECHO RPC-SCHANNEL RPC-NETLOGON RPC-UNIXINFO RPC-HANDLES" -ncacn_ip_tcp_tests="RPC-ALTERCONTEXT RPC-JOIN RPC-ECHO RPC-HANDLES" -ncalrpc_tests="RPC-ECHO" - -incdir=`dirname $0` -. $incdir/test_functions.sh - -for bindoptions in seal,padcheck $VALIDATE bigendian; do - for transport in ncalrpc ncacn_np ncacn_ip_tcp; do - case $transport in - ncalrpc) tests=$ncalrpc_tests ;; - ncacn_np) tests=$ncacn_np_tests ;; - ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;; - esac - for t in $tests; do - name="$t on $transport with $bindoptions" - plantest "$name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" - done - done -done diff --git a/source4/selftest/test_s3upgrade.sh b/source4/selftest/test_s3upgrade.sh index 1ed43cb8eb..692199acda 100755 --- a/source4/selftest/test_s3upgrade.sh +++ b/source4/selftest/test_s3upgrade.sh @@ -7,16 +7,14 @@ then exit 1 fi -SCRIPTDIR=../testprogs/ejs -DATADIR=../testdata - -PATH=bin:$PATH -export PATH - mkdir -p $PREFIX rm -f $PREFIX/* -. selftest/test_functions.sh +incdir=`dirname $0` +. $incdir/test_functions.sh + +SCRIPTDIR=$samba4srcdir/../testprogs/ejs +DATADIR=$samba4srcdir/../testdata -plantest "parse samba3" none bin/smbscript ../testdata/samba3/verify $CONFIGURATION ../testdata/samba3 -#plantest "upgrade" none bin/smbscript setup/upgrade $CONFIGURATION --verify --targetdir=$PREFIX ../testdata/samba3 ../testdata/samba3/smb.conf +plantest "parse samba3" none $samba4bindir/smbscript $DATADIR/samba3/verify $CONFIGURATION $DATADIR/samba3 +#plantest "upgrade" none $samba4bindir/smbscript setup/upgrade $CONFIGURATION --verify --targetdir=$PREFIX ../testdata/samba3 ../testdata/samba3/smb.conf diff --git a/source4/selftest/test_session_key.sh b/source4/selftest/test_session_key.sh index 30d03431ba..93be4f99f2 100755 --- a/source4/selftest/test_session_key.sh +++ b/source4/selftest/test_session_key.sh @@ -4,11 +4,7 @@ incdir=`dirname $0` . $incdir/test_functions.sh transport="ncacn_np" -for bindoptions in bigendian seal; do - for keyexchange in "yes" "no"; do - for ntlm2 in "yes" "no"; do - for lm_key in "yes" "no"; do - for ntlmoptions in \ +for ntlmoptions in \ "-k no --option=usespnego=yes" \ "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no" \ "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=yes" \ @@ -21,18 +17,14 @@ for bindoptions in bigendian seal; do "-k no --option=usespnego=no --option=clientntlmv2auth=yes" \ "-k no --option=gensec:spnego=no --option=clientntlmv2auth=yes" \ "-k no --option=usespnego=no"; do - name="RPC-SECRETS on $transport with $bindoptions with NTLM2:$ntlm2 KEYEX:$keyexchange LM_KEY:$lm_key $ntlmoptions" - plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" --option=ntlmssp_client:keyexchange=$keyexchange --option=ntlmssp_client:ntlm2=$ntlm2 --option=ntlmssp_client:lm_key=$lm_key $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=gensec:target_hostname=\$NETBIOSNAME RPC-SECRETS "$*" - done - done - done - done - name="RPC-SECRETS on $transport with $bindoptions with Kerberos" - plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" - name="RPC-SECRETS on $transport with $bindoptions with Kerberos - use target principal" - plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=clientusespnegoprincipal=yes" "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" + name="RPC-SECRETS on $transport with $bindoptions with $ntlmoptions" + plantest "$name" dc $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=gensec:target_hostname=\$NETBIOSNAME RPC-SECRETS "$*" done +name="RPC-SECRETS on $transport with $bindoptions with Kerberos" +plantest "$name" dc $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" +name="RPC-SECRETS on $transport with $bindoptions with Kerberos - use target principal" +plantest "$name" dc $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=clientusespnegoprincipal=yes" "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" name="RPC-SECRETS on $transport with Kerberos - use Samba3 style login" - plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER" -k yes -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "--option=gensec:fake_gssapi_krb5=yes" "--option=gensec:gssapi_krb5=no" "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" + plantest "$name" dc $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER" -k yes -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "--option=gensec:fake_gssapi_krb5=yes" "--option=gensec:gssapi_krb5=no" "--option=gensec:target_hostname=\$NETBIOSNAME" "RPC-SECRETS-none*" "$*" name="RPC-SECRETS on $transport with Kerberos - use Samba3 style login, use target principal" - plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER" -k yes -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "--option=clientusespnegoprincipal=yes" "--option=gensec:fake_gssapi_krb5=yes" "--option=gensec:gssapi_krb5=no" "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" + plantest "$name" dc $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER" -k yes -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "--option=clientusespnegoprincipal=yes" "--option=gensec:fake_gssapi_krb5=yes" "--option=gensec:gssapi_krb5=no" "--option=gensec:target_hostname=\$NETBIOSNAME" "RPC-SECRETS-none*" "$*" diff --git a/source4/selftest/test_simple.sh b/source4/selftest/test_simple.sh index 00cfb34a9f..3532cba180 100755 --- a/source4/selftest/test_simple.sh +++ b/source4/selftest/test_simple.sh @@ -9,5 +9,5 @@ incdir=`dirname $0` tests="BASE-RW1" for t in $tests; do - plantest "$t" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/simple -U"\$USERNAME"%"\$PASSWORD" $t + plantest "ntvfs/simple $t" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/simple -U"\$USERNAME"%"\$PASSWORD" $t done diff --git a/source4/selftest/test_winbind.sh b/source4/selftest/test_winbind.sh new file mode 100755 index 0000000000..832d12c411 --- /dev/null +++ b/source4/selftest/test_winbind.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# + +incdir=`dirname $0` +. $incdir/test_functions.sh + +ENVNAME=$1 +if test x"$ENVNAME" = x"";then + ENVNAME="dc" +fi + +WB_OPTS="${TORTURE_OPTIONS}" +WB_OPTS="${WB_OPTS} --option=\"torture:strict mode=yes\"" +WB_OPTS="${WB_OPTS} --option=\"torture:timelimit=1\"" +WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=\\\\\"" +WB_OPTS="${WB_OPTS} --option=\"torture:winbindd private pipe dir=\$WINBINDD_PRIV_PIPE_DIR\"" +WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios name=\$SERVER\"" +WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios domain=\$DOMAIN\"" + +STRUCT_TESTS=`$samba4bindir/smbtorture --list | grep "^WINBIND-STRUCT" | xargs` +for t in $STRUCT_TESTS; do + plantest "$ENVNAME:$t" $ENVNAME $samba4bindir/smbtorture $WB_OPTS //_none_/_none_ $t +done + +NDR_TESTS=`$samba4bindir/smbtorture --list | grep "^WINBIND-NDR" | xargs` +for t in $NDR_TESTS; do + plantest "$ENVNAME:$t" $ENVNAME $samba4bindir/smbtorture $WB_OPTS //_none_/_none_ $t +done diff --git a/source4/selftest/tests_all.sh b/source4/selftest/tests_all.sh index 7a1167e9ac..0db8504848 100755 --- a/source4/selftest/tests_all.sh +++ b/source4/selftest/tests_all.sh @@ -1,18 +1,21 @@ #!/bin/sh - $SRCDIR/selftest/test_ejs.sh $CONFIGURATION - $SRCDIR/selftest/test_ldap.sh - $SRCDIR/selftest/test_nbt.sh "dc" - $SRCDIR/selftest/test_rpc.sh - $SRCDIR/selftest/test_net.sh - $SRCDIR/selftest/test_session_key.sh - $SRCDIR/selftest/test_binding_string.sh - $SRCDIR/selftest/test_echo.sh - $SRCDIR/selftest/test_posix.sh - $SRCDIR/selftest/test_cifs.sh - $SRCDIR/selftest/test_local.sh - $SRCDIR/selftest/test_pidl.sh - $SRCDIR/selftest/test_blackbox.sh $PREFIX - $SRCDIR/selftest/test_simple.sh - $SRCDIR/selftest/test_s3upgrade.sh $PREFIX/upgrade - $SRCDIR/selftest/test_member.sh - $SRCDIR/selftest/test_nbt.sh "member" +includedir=`dirname $0` +$includedir/../bin/smbtorture -V +$SRCDIR/selftest/test_ejs.sh $CONFIGURATION +$SRCDIR/selftest/test_ldap.sh +$SRCDIR/selftest/test_nbt.sh "dc" +$SRCDIR/selftest/test_winbind.sh "dc" +$SRCDIR/selftest/test_rpc.sh +$SRCDIR/selftest/test_net.sh +$SRCDIR/selftest/test_session_key.sh +$SRCDIR/selftest/test_echo.sh +$SRCDIR/selftest/test_posix.sh +$SRCDIR/selftest/test_cifs.sh +$SRCDIR/selftest/test_local.sh +$SRCDIR/selftest/test_pidl.sh +$SRCDIR/selftest/test_blackbox.sh $PREFIX +$SRCDIR/selftest/test_simple.sh +$SRCDIR/selftest/test_s3upgrade.sh $PREFIX/upgrade +$SRCDIR/selftest/test_member.sh +$SRCDIR/selftest/test_nbt.sh "member" +$SRCDIR/selftest/test_winbind.sh "member" diff --git a/source4/selftest/tests_quick.sh b/source4/selftest/tests_quick.sh index bb3065b0a3..c05185afad 100755 --- a/source4/selftest/tests_quick.sh +++ b/source4/selftest/tests_quick.sh @@ -1,9 +1,47 @@ #!/bin/sh +ADDARGS="$*" + +incdir=`dirname $0` +. $incdir/test_functions.sh + +$incdir/../bin/smbtorture -V + TORTURE_QUICK="yes" export TORTURE_QUICK $SRCDIR/selftest/test_ejs.sh $CONFIGURATION $SRCDIR/selftest/test_ldap.sh $SRCDIR/selftest/test_nbt.sh -$SRCDIR/selftest/test_quick.sh -$SRCDIR/selftest/test_rpc_quick.sh + +tests="BASE-UNLINK BASE-ATTR BASE-DELETE" +tests="$tests BASE-TCON BASE-OPEN" +tests="$tests BASE-CHKPATH RAW-QFSINFO RAW-QFILEINFO RAW-SFILEINFO" +tests="$tests RAW-MKDIR RAW-SEEK RAW-OPEN RAW-WRITE" +tests="$tests RAW-UNLINK RAW-READ RAW-CLOSE RAW-IOCTL RAW-RENAME" +tests="$tests RAW-EAS RAW-STREAMS" + +for t in $tests; do + plantest "$t" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $t +done + +plantest "ntvfs/cifs BASE-OPEN" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $ADDARGS //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" BASE-OPEN + +# add tests to this list as they start passing, so we test +# that they stay passing +ncacn_np_tests="RPC-ALTERCONTEXT RPC-JOIN RPC-ECHO RPC-SCHANNEL RPC-NETLOGON RPC-UNIXINFO RPC-HANDLES" +ncacn_ip_tcp_tests="RPC-ALTERCONTEXT RPC-JOIN RPC-ECHO RPC-HANDLES" +ncalrpc_tests="RPC-ECHO" + +for bindoptions in seal,padcheck $VALIDATE bigendian; do + for transport in ncalrpc ncacn_np ncacn_ip_tcp; do + case $transport in + ncalrpc) tests=$ncalrpc_tests ;; + ncacn_np) tests=$ncacn_np_tests ;; + ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;; + esac + for t in $tests; do + name="$t on $transport with $bindoptions" + plantest "$name" dc $VALGRIND $samba4bindir/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + done + done +done |