diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-04-10 20:19:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:49:55 -0500 |
commit | e338b4b47b6271ca46060a1fe8c61ab8afaecc8f (patch) | |
tree | 315e3b28abd60f04f5d5a7cc871e6d246ef931f2 /source4/script/tests | |
parent | 4cc500433d07decf8fc2551b117e15537f6c8558 (diff) | |
download | samba-e338b4b47b6271ca46060a1fe8c61ab8afaecc8f.tar.gz samba-e338b4b47b6271ca46060a1fe8c61ab8afaecc8f.tar.bz2 samba-e338b4b47b6271ca46060a1fe8c61ab8afaecc8f.zip |
r22156: - Lazy evaluate variable names.
- Don't set up environments until necessary
- Add --resetup-environment option
- Add 'none' environment
(This used to be commit ed0410309bfdefb0d31cb247c26b947956fb1137)
Diffstat (limited to 'source4/script/tests')
-rw-r--r-- | source4/script/tests/Samba4.pm | 58 | ||||
-rwxr-xr-x | source4/script/tests/mk-openldap.sh | 2 | ||||
-rwxr-xr-x | source4/script/tests/mktestdc.sh | 2 | ||||
-rwxr-xr-x | source4/script/tests/selftest.pl | 111 | ||||
-rwxr-xr-x | source4/script/tests/test_binding_string.sh | 33 | ||||
-rwxr-xr-x | source4/script/tests/test_blackbox.sh | 18 | ||||
-rwxr-xr-x | source4/script/tests/test_echo.sh | 27 | ||||
-rwxr-xr-x | source4/script/tests/test_ejs.sh | 21 | ||||
-rwxr-xr-x | source4/script/tests/test_ldap.sh | 25 | ||||
-rwxr-xr-x | source4/script/tests/test_local.sh | 7 | ||||
-rwxr-xr-x | source4/script/tests/test_nbt.sh | 17 | ||||
-rwxr-xr-x | source4/script/tests/test_net.sh | 15 | ||||
-rwxr-xr-x | source4/script/tests/test_posix.sh | 14 | ||||
-rwxr-xr-x | source4/script/tests/test_quick.sh | 18 | ||||
-rwxr-xr-x | source4/script/tests/test_rpc.sh | 17 | ||||
-rwxr-xr-x | source4/script/tests/test_rpc_quick.sh | 15 | ||||
-rwxr-xr-x | source4/script/tests/test_session_key.sh | 24 | ||||
-rwxr-xr-x | source4/script/tests/test_simple.sh | 18 | ||||
-rwxr-xr-x | source4/script/tests/tests_all.sh | 22 | ||||
-rwxr-xr-x | source4/script/tests/tests_quick.sh | 10 |
20 files changed, 186 insertions, 288 deletions
diff --git a/source4/script/tests/Samba4.pm b/source4/script/tests/Samba4.pm index fa20ccbdaf..ac3dc653b8 100644 --- a/source4/script/tests/Samba4.pm +++ b/source4/script/tests/Samba4.pm @@ -16,10 +16,14 @@ sub new($$$$) { return $self; } -sub slapd_start($$$) +sub slapd_start($$) { my $count = 0; - my ($self, $conf, $uri) = @_; + my ($self, $env_vars) = @_; + + my $conf = $env_vars->{SLAPD_CONF}; + my $uri = $env_vars->{LDAP_URI}; + # running slapd in the background means it stays in the same process group, so it can be # killed by timelimit if (defined($ENV{FEDORA_DS_PREFIX})) { @@ -33,7 +37,7 @@ sub slapd_start($$$) while (system("$self->{bindir}/ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") != 0) { $count++; if ($count > 10) { - $self->slapd_stop(); + $self->slapd_stop($env_vars); return 0; } sleep(1); @@ -41,13 +45,13 @@ sub slapd_start($$$) return 1; } -sub slapd_stop($) +sub slapd_stop($$) { - my ($self) = @_; - if (defined($ENV{FEDORA_DS_PREFIX})) { - system("$ENV{LDAPDIR}/slapd-samba4/stop-slapd"); + my ($self, $envvars) = @_; + if (defined($envvars->{FEDORA_DS_PREFIX})) { + system("$envvars->{LDAPDIR}/slapd-samba4/stop-slapd"); } else { - open(IN, "<$ENV{PIDDIR}/slapd.pid") or + open(IN, "<$envvars->{PIDDIR}/slapd.pid") or die("unable to open slapd pid file"); kill 9, <IN>; close(IN); @@ -61,7 +65,7 @@ sub check_or_start($$$$) # Start slapd before smbd if ($self->{ldap}) { - $self->slapd_start($ENV{SLAPD_CONF}, $ENV{LDAP_URI}) or + $self->slapd_start($env_vars) or die("couldn't start slapd"); print "LDAP PROVISIONING..."; @@ -132,9 +136,9 @@ sub wait_for_start($$) system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER} $testenv_vars->{NETBIOSNAME}"); } -sub provision($$$) +sub provision($$) { - my ($self, $environment, $prefix) = @_; + my ($self, $prefix) = @_; my %ret = (); print "PROVISIONING..."; open(IN, "$RealBin/mktestdc.sh $prefix|") or die("Unable to setup"); @@ -156,9 +160,9 @@ sub provision_ldap($) die("LDAP PROVISIONING failed: $self->{bindir}/smbscript $self->{setupdir}/provision $ENV{PROVISION_OPTIONS} \"$ENV{PROVISION_ACI}\" --ldap-backend=$ENV{LDAP_URI}"); } -sub stop($) +sub teardown_env($$) { - my ($self) = @_; + my ($self, $envvars) = @_; close(DATA); @@ -166,22 +170,33 @@ sub stop($) my $failed = $? >> 8; - if (-f "$ENV{PIDDIR}/smbd.pid" ) { - open(IN, "<$ENV{PIDDIR}/smbd.pid") or die("unable to open smbd pid file"); + if (-f "$envvars->{PIDDIR}/smbd.pid" ) { + open(IN, "<$envvars->{PIDDIR}/smbd.pid") or die("unable to open smbd pid file"); kill 9, <IN>; close(IN); } - $self->slapd_stop() if ($self->{ldap}); + $self->slapd_stop($envvars) if ($self->{ldap}); return $failed; } -sub setup_env($$$) +sub setup_env($$$$) { - my ($self, $name, $path, $socket_wrapper_dir) = @_; + my ($self, $envname, $path, $socket_wrapper_dir) = @_; + + if ($envname eq "dc") { + return $self->setup_dc("$path/dc", $socket_wrapper_dir); + } else { + die("Samba4 can't provide environment $envname"); + } +} + +sub setup_dc($$$) +{ + my ($self, $path, $socket_wrapper_dir) = @_; - my $env = $self->provision($name, $path); + my $env = $self->provision($path); $self->check_or_start($env, $socket_wrapper_dir, ($ENV{SMBD_MAX_TIME} or 5400)); @@ -191,4 +206,9 @@ sub setup_env($$$) return $env; } +sub stop($) +{ + my ($self) = @_; +} + 1; diff --git a/source4/script/tests/mk-openldap.sh b/source4/script/tests/mk-openldap.sh index b580d75417..a70db73c74 100755 --- a/source4/script/tests/mk-openldap.sh +++ b/source4/script/tests/mk-openldap.sh @@ -99,7 +99,7 @@ rm -f $MODCONF touch $MODCONF slaptest -u -f $SLAPD_CONF >&2 || { - echo "enabling slapd modules" >&2 + # echo "enabling slapd modules" >&2 cat > $MODCONF <<EOF modulepath /usr/lib/ldap moduleload back_bdb diff --git a/source4/script/tests/mktestdc.sh b/source4/script/tests/mktestdc.sh index fc495e7b57..bbf2e2b395 100755 --- a/source4/script/tests/mktestdc.sh +++ b/source4/script/tests/mktestdc.sh @@ -24,7 +24,6 @@ REALM=SAMBA.EXAMPLE.COM DNSNAME="samba.example.com" BASEDN="dc=samba,dc=example,dc=com" PASSWORD=penguin -AUTH="-U$USERNAME%$PASSWORD" SRCDIR=`pwd` ROOT=$USER SERVER=localhost @@ -274,7 +273,6 @@ echo "KRB5_CONFIG=$KRB5_CONFIG" echo "PREFIX_ABS=$PREFIX_ABS" echo "SLAPD_CONF=$SLAPD_CONF" echo "PIDDIR=$PIDDIR" -echo "AUTH=$AUTH" echo "SERVER=$SERVER" echo "NETBIOSNAME=$NETBIOSNAME" echo "LDAP_URI=$LDAP_URI" diff --git a/source4/script/tests/selftest.pl b/source4/script/tests/selftest.pl index e056077b82..bb9510a00b 100755 --- a/source4/script/tests/selftest.pl +++ b/source4/script/tests/selftest.pl @@ -132,6 +132,7 @@ my $opt_verbose = 0; my $opt_testenv = 0; my $opt_ldap = undef; my $opt_analyse_cmd = undef; +my $opt_resetup_env = undef; my $srcdir = "."; my $builddir = "."; @@ -233,7 +234,7 @@ sub run_test_plain($$$$) my ($name, $cmd, $i, $totalsuites) = @_; my $err = ""; if ($#$suitesfailed+1 > 0) { $err = ", ".($#$suitesfailed+1)." errors"; } - printf "[$i/$totalsuites in " . (time() - $start)."s$err] $name\n"; + print "[$i/$totalsuites in " . (time() - $start)."s$err] $name\n"; open(RESULT, "$cmd 2>&1|"); my $expected_ret = 1; my $open_tests = {}; @@ -335,6 +336,7 @@ my $result = GetOptions ( 'testenv' => \$opt_testenv, 'ldap' => \$opt_ldap, 'analyse-cmd=s' => \$opt_analyse_cmd, + 'resetup-environment' => \$opt_resetup_env, ); exit(1) if (not $result); @@ -434,28 +436,44 @@ my $interfaces = join(',', ("127.0.0.6/8", "127.0.0.10/8", "127.0.0.11/8")); -my $testenv_vars = $target->setup_env("dc", "$prefix/dc", $socket_wrapper_dir); - my $conffile = "$prefix/client.conf"; -my $abs_srcdir = cwd(); -open(CF, ">$conffile"); -print CF "[global]\n"; -if (defined($ENV{VALGRIND})) { - print CF "\ticonv:native = true\n"; -} else { - print CF "\ticonv:native = false\n"; -} -print CF + +sub write_clientconf($$) +{ + my ($conffile, $vars) = @_; + + my $abs_srcdir = cwd(); + + open(CF, ">$conffile"); + print CF "[global]\n"; + if (defined($ENV{VALGRIND})) { + print CF "\ticonv:native = true\n"; + } else { + print CF "\ticonv:native = false\n"; + } + print CF " netbios name = localtest netbios aliases = localhost - workgroup = $testenv_vars->{DOMAIN} - realm = $testenv_vars->{REALM} - pid directory = $testenv_vars->{PIDDIR} - ncalrpc dir = $testenv_vars->{NCALRPCDIR} +"; + if (defined($vars->{DOMAIN})) { + print CF "\tworkgroup = $vars->{DOMAIN}\n"; + } + if (defined($vars->{REALM})) { + print CF "\trealm = $vars->{REALM}\n"; + } + if (defined($vars->{PIDDIR})) { + print CF "\tpid directory = $vars->{PIDDIR}\n"; + } + if (defined($vars->{NCALRPCDIR})) { + print CF "\tncalrpc dir = $vars->{NCALRPCDIR}\n"; + } + if (defined($vars->{WINBINDD_SOCKET_DIR})) { + print CF "\twinbindd socket directory = $vars->{WINBINDD_SOCKET_DIR}\n"; + } + print CF " js include = $abs_srcdir/scripting/libjs - winbindd socket directory = $testenv_vars->{WINBINDD_SOCKET_DIR} name resolve order = bcast - interfaces = 127.0.0.1/8 + interfaces = $interfaces panic action = $abs_srcdir/script/gdb_backtrace \%PID\% \%PROG\% max xmit = 32K notify:inotify = false @@ -465,10 +483,11 @@ print CF torture:basedir = ./st gensec:require_pac = true "; -close(CF); + close(CF); +} + my @torture_options = (); -push (@torture_options, "--option=interfaces=$interfaces"); push (@torture_options, "--configfile=$conffile"); # ensure any one smbtorture call doesn't run too long push (@torture_options, "--maximum-runtime=$torture_maxtime"); @@ -480,15 +499,12 @@ push (@torture_options, "--option=torture:quick=yes") if ($opt_quick); $ENV{TORTURE_OPTIONS} = join(' ', @torture_options); print "OPTIONS $ENV{TORTURE_OPTIONS}\n"; -foreach ("PASSWORD", "DOMAIN", "SERVER", "USERNAME", "NETBIOSNAME") { - $ENV{$_} = $testenv_vars->{$_}; -} - my @todo = (); my $testsdir = "$srcdir/script/tests"; $ENV{CONFIGURATION} = "--configfile=$conffile"; + if ($opt_quick) { open(IN, "$testsdir/tests_quick.sh|"); } else { @@ -514,14 +530,44 @@ my $suitestotal = $#todo + 1; my $i = 0; $| = 1; -# The Kerberos tests fail if this variable is set. -delete $ENV{DOMAIN}; +my %running_envs = (); -$ENV{KRB5_CONFIG} = $testenv_vars->{KRB5_CONFIG}; +sub setup_env($) +{ + my ($envname) = @_; + my $testenv_vars; + if (defined($running_envs{$envname})) { + $testenv_vars = $running_envs{$envname}; + } elsif ($envname eq "none") { + $testenv_vars = {}; + } else { + $testenv_vars = $target->setup_env($envname, $prefix, $socket_wrapper_dir); + } + write_clientconf($conffile, $testenv_vars); + foreach ("PASSWORD", "DOMAIN", "SERVER", "USERNAME", "NETBIOSNAME", + "KRB5_CONFIG") { + if (defined($testenv_vars->{$_})) { + $ENV{$_} = $testenv_vars->{$_}; + } else { + delete $ENV{$_}; + } + } + + $running_envs{$envname} = $testenv_vars; + return $testenv_vars; +} + +sub teardown_env($) +{ + my ($envname) = @_; + $target->teardown_env($running_envs{$envname}); + delete $running_envs{$envname}; +} SocketWrapper::set_default_iface(6); if ($opt_testenv) { + my $testenv_vars = setup_env("dc"); $ENV{PIDDIR} = $testenv_vars->{PIDDIR}; my $term = ($ENV{TERM} or "xterm"); system("$term -e 'echo -e \"Welcome to the Samba4 Test environment @@ -533,6 +579,7 @@ TORTURE_OPTIONS=\$TORTURE_OPTIONS CONFIGURATION=\$CONFIGURATION SERVER=\$SERVER NETBIOSNAME=\$NETBIOSNAME\" && bash'"); + teardown_env("dc"); } else { foreach (@todo) { $i++; @@ -547,7 +594,7 @@ NETBIOSNAME=\$NETBIOSNAME\" && bash'"); next; } - # $target->setup_env($envname, "$prefix/$envname", $socket_wrapper_dir); + setup_env($envname); if ($from_build_farm) { run_test_buildfarm($name, $cmd, $i, $suitestotal); @@ -558,12 +605,16 @@ NETBIOSNAME=\$NETBIOSNAME\" && bash'"); if (defined($opt_analyse_cmd)) { system("$opt_analyse_cmd \"$name\""); } + + teardown_env($envname) if ($opt_resetup_env); } } print "\n"; -my $failed = $target->stop(); +teardown_env($_) foreach (keys %running_envs); + +$target->stop(); my $end = time(); my $duration = ($end-$start); @@ -587,6 +638,8 @@ if ($numfailed == 0) { } print "DURATION: $duration seconds\n"; +my $failed = 0; + # if there were any valgrind failures, show them foreach (<$prefix/valgrind.log*>) { next unless (-s $_); diff --git a/source4/script/tests/test_binding_string.sh b/source4/script/tests/test_binding_string.sh index 9558893981..a8afc07ac1 100755 --- a/source4/script/tests/test_binding_string.sh +++ b/source4/script/tests/test_binding_string.sh @@ -1,31 +1,18 @@ #!/bin/sh -if [ $# -lt 4 ]; then -cat <<EOF -Usage: test_binding_string.sh SERVER USERNAME PASSWORD DOMAIN -EOF -exit 1; -fi - -server="$1" -username="$2" -password="$3" -domain="$4" -shift 4 - 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]" \ +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" + "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_np:\$SERVER" \ + "308FB580-1EB2-11CA-923B-08002B1075A7@ncacn_ip_tcp:\$SERVER" do - plantest "$I" rpc bin/smbtorture $TORTURE_OPTIONS "$I" -U"$username"%"$password" -W $domain --option=torture:quick=yes RPC-ECHO "$*" + plantest "$I" dc bin/smbtorture $TORTURE_OPTIONS "$I" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" --option=torture:quick=yes RPC-ECHO "$*" done diff --git a/source4/script/tests/test_blackbox.sh b/source4/script/tests/test_blackbox.sh index dd6c31c436..ea50761d9a 100755 --- a/source4/script/tests/test_blackbox.sh +++ b/source4/script/tests/test_blackbox.sh @@ -2,23 +2,19 @@ # this runs tests that interact directly with the command-line tools rather than using the API -if [ $# -lt 5 ]; then +if [ $# -lt 1 ]; then cat <<EOF -Usage: test_blackbox.sh SERVER USERNAME PASSWORD DOMAIN PREFIX [...] +Usage: test_blackbox.sh PREFIX [...] EOF exit 1; fi -SERVER=$1 -USERNAME=$2 -PASSWORD=$3 -DOMAIN=$4 -PREFIX=$5 -shift 5 -ADDARGS="$@" +PREFIX=$1 +shift 1 +ADDARGS="$*" incdir=`dirname $0` . $incdir/test_functions.sh -plantest "blackbox.smbclient" smb $incdir/../../../testprogs/blackbox/test_smbclient.sh "$SERVER" "$USERNAME" "$PASSWORD" "$DOMAIN" "$PREFIX" "$ADDARGS" -plantest "blackbox.cifsdd" smb $incdir/../../../testprogs/blackbox/test_cifsdd.sh "$SERVER" "$USERNAME" "$PASSWORD" "$DOMAIN" "$ADDARGS" +plantest "blackbox.smbclient" dc $incdir/../../../testprogs/blackbox/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" "$ADDARGS" +plantest "blackbox.cifsdd" dc $incdir/../../../testprogs/blackbox/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$ADDARGS" diff --git a/source4/script/tests/test_echo.sh b/source4/script/tests/test_echo.sh index 79a19b1c2e..f09aeca4e5 100755 --- a/source4/script/tests/test_echo.sh +++ b/source4/script/tests/test_echo.sh @@ -1,35 +1,16 @@ #!/bin/sh -if [ $# -lt 4 ]; then -cat <<EOF -Usage: test_echo.sh SERVER USERNAME PASSWORD DOMAIN -EOF -exit 1; -fi - -server="$1" -username="$2" -password="$3" -domain="$4" -shift 4 - incdir=`dirname $0` . $incdir/test_functions.sh -transports="ncacn_np ncacn_ip_tcp" -if [ $server = "localhost" ]; then - transports="ncalrpc $transports" -fi -if [ $server = "localtest" ]; then - transports="ncalrpc $transports" -fi +transports="ncacn_np ncacn_ip_tcp ncalrpc" for transport in $transports; do for bindoptions in connect spnego spnego,sign spnego,seal $VALIDATE padcheck bigendian bigendian,seal; do for ntlmoptions in \ "--option=socket:testnonblock=True --option=torture:quick=yes"; do name="RPC-ECHO on $transport with $bindoptions and $ntlmoptions" - plantest "$name" rpc bin/smbtorture $TORTURE_OPTIONS $transport:"$server[$bindoptions]" $ntlmoptions -U"$username"%"$password" -W $domain RPC-ECHO "$*" + plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" RPC-ECHO "$*" done done done @@ -48,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" rpc bin/smbtorture $TORTURE_OPTIONS $transport:"$server[$bindoptions]" $ntlmoptions -U"$username"%"$password" -W $domain RPC-ECHO "$*" + plantest "$name" dc bin/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" rpc bin/smbtorture $TORTURE_OPTIONS ncacn_np:"$server[smb2]" -U"$username"%"$password" -W $domain RPC-ECHO "$*" +plantest "$name" dc bin/smbtorture $TORTURE_OPTIONS ncacn_np:"\$SERVER[smb2]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" diff --git a/source4/script/tests/test_ejs.sh b/source4/script/tests/test_ejs.sh index 4eba2de81a..858602ce38 100755 --- a/source4/script/tests/test_ejs.sh +++ b/source4/script/tests/test_ejs.sh @@ -1,17 +1,6 @@ #!/bin/sh # test some simple EJS operations -if [ $# -lt 3 ]; then -cat <<EOF -Usage: test_ejs.sh DOMAIN USERNAME PASSWORD [OPTIONS] -EOF -exit 1; -fi - -DOMAIN="$1" -USERNAME="$2" -PASSWORD="$3" -shift 3 CONFIGURATION="$*" incdir=`dirname $0` @@ -23,10 +12,10 @@ DATADIR=../testdata PATH=bin:$PATH export PATH -plantest "base.js" rpc "$SCRIPTDIR/base.js" $CONFIGURATION -plantest "samr.js" rpc "$SCRIPTDIR/samr.js" $CONFIGURATION ncalrpc: -U$USERNAME%$PASSWORD -plantest "echo.js" rpc "$SCRIPTDIR/echo.js" $CONFIGURATION ncalrpc: -U$USERNAME%$PASSWORD -plantest "ejsnet.js" rpc "$SCRIPTDIR/ejsnet.js" $CONFIGURATION -U$USERNAME%$PASSWORD $DOMAIN ejstestuser +plantest "base.js" dc "$SCRIPTDIR/base.js" $CONFIGURATION +plantest "samr.js" dc "$SCRIPTDIR/samr.js" $CONFIGURATION ncalrpc: -U\$USERNAME%\$PASSWORD +plantest "echo.js" dc "$SCRIPTDIR/echo.js" $CONFIGURATION ncalrpc: -U\$USERNAME%\$PASSWORD +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" rpc scripting/bin/winreg $CONFIGURATION ncalrpc: 'HKLM' -U$USERNAME%$PASSWORD +plantest "winreg" dc scripting/bin/winreg $CONFIGURATION ncalrpc: 'HKLM' -U\$USERNAME%\$PASSWORD diff --git a/source4/script/tests/test_ldap.sh b/source4/script/tests/test_ldap.sh index 8d85e5a8e5..57f1160136 100755 --- a/source4/script/tests/test_ldap.sh +++ b/source4/script/tests/test_ldap.sh @@ -1,34 +1,23 @@ #!/bin/sh # test some simple LDAP and CLDAP operations -if [ $# -lt 3 ]; then -cat <<EOF -Usage: test_ldap.sh SERVER USERNAME PASSWORD -EOF -exit 1; -fi - -SERVER="$1" -USERNAME="$2" -PASSWORD="$3" - 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" ldap ../testprogs/blackbox/test_ldb.sh $p $SERVER $options +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 $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" ldap ../testprogs/blackbox/test_ldb.sh $p $SERVER $options + for options in "" "-U\$USERNAME%\$PASSWORD"; do + plantest "TESTING PROTOCOL $p with options $options" dc ../testprogs/blackbox/test_ldb.sh $p \$SERVER $options done fi for t in LDAP-CLDAP LDAP-BASIC LDAP-SCHEMA LDAP-UPTODATENESS do - plantest "$t" ldap bin/smbtorture $TORTURE_OPTIONS "-U$USERNAME%$PASSWORD" //$SERVER/_none_ $t + plantest "$t" dc bin/smbtorture $TORTURE_OPTIONS "-U\$USERNAME%\$PASSWORD" //\$SERVER/_none_ $t done # only do the ldb tests when not in quick mode - they are quite slow, and ldb @@ -36,9 +25,9 @@ done test "$TORTURE_QUICK" = "yes" || { LDBDIR=lib/ldb export LDBDIR - plantest "ldb" ldap $LDBDIR/tests/test-tdb.sh + plantest "ldb" dc $LDBDIR/tests/test-tdb.sh } SCRIPTDIR=../testprogs/ejs -plantest "ejs ldap" ldap $SCRIPTDIR/ldap.js $CONFIGURATION $SERVER -U$USERNAME%$PASSWORD +plantest "ejs ldap" dc $SCRIPTDIR/ldap.js $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD diff --git a/source4/script/tests/test_local.sh b/source4/script/tests/test_local.sh index 57e11961bb..e8bf10c901 100755 --- a/source4/script/tests/test_local.sh +++ b/source4/script/tests/test_local.sh @@ -8,13 +8,6 @@ if [ `uname` = "Linux" ]; then local_tests="$local_tests LOCAL-ICONV" fi -if [ $# -lt 0 ]; then -cat <<EOF -Usage: test_local.sh -EOF -exit 1; -fi - incdir=`dirname $0` . $incdir/test_functions.sh diff --git a/source4/script/tests/test_nbt.sh b/source4/script/tests/test_nbt.sh index c3a09d4fb1..95bfb9696c 100755 --- a/source4/script/tests/test_nbt.sh +++ b/source4/script/tests/test_nbt.sh @@ -1,17 +1,6 @@ #!/bin/sh # test some NBT/WINS operations -if [ $# -lt 1 ]; then -cat <<EOF -Usage: test_nbt.sh SERVER -EOF -exit 1; -fi - -SERVER="$1" -USERNAME="$2" -PASSWORD="$3" - incdir=`dirname $0` . $incdir/test_functions.sh @@ -20,11 +9,11 @@ SCRIPTDIR=../testprogs/ejs PATH=bin:$PATH export PATH -plantest "nmblookup -U $SERVER $SERVER" netbios bin/nmblookup $TORTURE_OPTIONS -U $SERVER $SERVER -plantest "nmblookup $SERVER" netbios bin/nmblookup $TORTURE_OPTIONS $SERVER +plantest "nmblookup -U \$SERVER \$SERVER" dc bin/nmblookup $TORTURE_OPTIONS -U \$SERVER \$SERVER +plantest "nmblookup \$SERVER" dc bin/nmblookup $TORTURE_OPTIONS \$SERVER NBT_TESTS=`bin/smbtorture --list | grep ^NBT` for f in $NBT_TESTS; do - plantest "$f" netbios bin/smbtorture $TORTURE_OPTIONS //$SERVER/_none_ $f -U$USERNAME%$PASSWORD + plantest "$f" dc bin/smbtorture $TORTURE_OPTIONS //\$SERVER/_none_ $f -U\$USERNAME%\$PASSWORD done diff --git a/source4/script/tests/test_net.sh b/source4/script/tests/test_net.sh index b7b12c8b7a..5156aa5967 100755 --- a/source4/script/tests/test_net.sh +++ b/source4/script/tests/test_net.sh @@ -6,19 +6,6 @@ ncacn_np_tests="NET-API-LOOKUP NET-API-LOOKUPHOST NET-API-LOOKUPPDC NET-API-RPCC 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" 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" -if [ $# -lt 4 ]; then -cat <<EOF -Usage: test_net.sh SERVER USERNAME PASSWORD DOMAIN -EOF -exit 1; -fi - -server="$1" -username="$2" -password="$3" -domain="$4" -shift 4 - incdir=`dirname $0` . $incdir/test_functions.sh @@ -31,7 +18,7 @@ for bindoptions in seal,padcheck $VALIDATE bigendian; do esac for t in $tests; do name="$t on $transport with $bindoptions" - plantest "$name" rpc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"$server[$bindoptions]" -U"$username"%"$password" -W $domain $t "$*" + plantest "$name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" $t "$*" done done done diff --git a/source4/script/tests/test_posix.sh b/source4/script/tests/test_posix.sh index 8faaac1a88..88040def88 100755 --- a/source4/script/tests/test_posix.sh +++ b/source4/script/tests/test_posix.sh @@ -3,18 +3,6 @@ # this runs the file serving tests that are expected to pass with the # current posix ntvfs backend -if [ $# -lt 3 ]; then -cat <<EOF -Usage: test_posix.sh UNC USERNAME PASSWORD <first> <smbtorture args> -EOF -exit 1; -fi - -unc="$1" -username="$2" -password="$3" -start="$4" -shift 4 ADDARGS="$*" incdir=`dirname $0` @@ -30,5 +18,5 @@ for t in $tests; do continue; fi start="" - plantest "$t" smb $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS $unc -U"$username"%"$password" $t + plantest "$t" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $t done diff --git a/source4/script/tests/test_quick.sh b/source4/script/tests/test_quick.sh index 19dfab5730..e601bc7f9b 100755 --- a/source4/script/tests/test_quick.sh +++ b/source4/script/tests/test_quick.sh @@ -1,18 +1,6 @@ #!/bin/sh # run a quick set of filesystem tests -if [ $# -lt 3 ]; then -cat <<EOF -Usage: test_quick.sh UNC USERNAME PASSWORD <first> <smbtorture args> -EOF -exit 1; -fi - -unc="$1" -username="$2" -password="$3" -start="$4" -shift 4 ADDARGS="$*" incdir=`dirname $0` @@ -26,10 +14,6 @@ tests="$tests RAW-UNLINK RAW-READ RAW-CLOSE RAW-IOCTL RAW-RENAME" tests="$tests RAW-EAS RAW-STREAMS" for t in $tests; do - if [ ! -z "$start" -a "$start" != $t ]; then - continue; - fi - start="" name="$t" - plantest "$name" base $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS $unc -U"$username"%"$password" $t + plantest "$name" base $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/cifs -U"\$USERNAME"%"\$PASSWORD" $t done diff --git a/source4/script/tests/test_rpc.sh b/source4/script/tests/test_rpc.sh index 59a403a735..1b8b57d534 100755 --- a/source4/script/tests/test_rpc.sh +++ b/source4/script/tests/test_rpc.sh @@ -9,19 +9,6 @@ slow_ncacn_np_tests="RPC-SAMLOGON RPC-SAMR RPC-SAMR-USERS RPC-SAMR-PASSWORDS RPC slow_ncalrpc_tests="RPC-SAMR RPC-SAMR-USERS RPC-SAMR-PASSWORDS RPC-COUNTCALLS RPC-CRACKNAMES" slow_ncacn_ip_tcp_tests="RPC-SAMR RPC-SAMR-USERS RPC-SAMR-PASSWORDS RPC-COUNTCALLS RPC-CRACKNAMES" -if [ $# -lt 4 ]; then -cat <<EOF -Usage: test_rpc.sh SERVER USERNAME PASSWORD DOMAIN -EOF -exit 1; -fi - -server="$1" -username="$2" -password="$3" -domain="$4" -shift 4 - incdir=`dirname $0` . $incdir/test_functions.sh @@ -34,7 +21,7 @@ for bindoptions in seal,padcheck $VALIDATE bigendian; do esac for t in $tests; do name="$t on $transport with $bindoptions" - plantest "$name" rpc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"$server[$bindoptions]" -U"$username"%"$password" -W $domain $t "$*" + plantest "$name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done done done @@ -48,7 +35,7 @@ for bindoptions in connect $VALIDATE ; do esac for t in $tests; do name="$t on $transport with $bindoptions" - plantest "$name" rpc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"$server[$bindoptions]" -U"$username"%"$password" -W $domain $t "$*" + plantest "$name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done done done diff --git a/source4/script/tests/test_rpc_quick.sh b/source4/script/tests/test_rpc_quick.sh index 3526c53c3b..1f37bac2e5 100755 --- a/source4/script/tests/test_rpc_quick.sh +++ b/source4/script/tests/test_rpc_quick.sh @@ -6,19 +6,6 @@ ncacn_np_tests="RPC-ALTERCONTEXT RPC-JOIN RPC-ECHO RPC-SCHANNEL RPC-NETLOGON RPC ncacn_ip_tcp_tests="RPC-ALTERCONTEXT RPC-JOIN RPC-ECHO RPC-HANDLES" ncalrpc_tests="RPC-ECHO" -if [ $# -lt 4 ]; then -cat <<EOF -Usage: test_rpc_quick.sh SERVER USERNAME PASSWORD DOMAIN -EOF -exit 1; -fi - -server="$1" -username="$2" -password="$3" -domain="$4" -shift 4 - incdir=`dirname $0` . $incdir/test_functions.sh @@ -31,7 +18,7 @@ for bindoptions in seal,padcheck $VALIDATE bigendian; do esac for t in $tests; do name="$t on $transport with $bindoptions" - plantest "$name" rpc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"$server[$bindoptions]" -U"$username"%"$password" -W $domain $t "$*" + plantest "$name" rpc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done done done diff --git a/source4/script/tests/test_session_key.sh b/source4/script/tests/test_session_key.sh index e9ce143eaa..30d03431ba 100755 --- a/source4/script/tests/test_session_key.sh +++ b/source4/script/tests/test_session_key.sh @@ -1,19 +1,5 @@ #!/bin/sh -if [ $# -lt 4 ]; then -cat <<EOF -Usage: test_session_key.sh SERVER USERNAME PASSWORD DOMAIN NETBIOSNAME -EOF -exit 1; -fi - -server="$1" -username="$2" -password="$3" -domain="$4" -netbios_name="$5" -shift 5 - incdir=`dirname $0` . $incdir/test_functions.sh @@ -36,17 +22,17 @@ for bindoptions in bigendian seal; do "-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" rpc 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=$netbios_name RPC-SECRETS "$*" + 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" rpc bin/smbtorture $TORTURE_OPTIONS $transport:"$server[$bindoptions]" -k yes -U"$username"%"$password" -W $domain "--option=gensec:target_hostname=$netbios_name" RPC-SECRETS "$*" + 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" rpc bin/smbtorture $TORTURE_OPTIONS $transport:"$server[$bindoptions]" -k yes -U"$username"%"$password" -W $domain "--option=clientusespnegoprincipal=yes" "--option=gensec:target_hostname=$netbios_name" RPC-SECRETS "$*" + 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 "$*" done name="RPC-SECRETS on $transport with Kerberos - use Samba3 style login" - plantest "$name" rpc 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=$netbios_name" RPC-SECRETS "$*" + 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 "$*" name="RPC-SECRETS on $transport with Kerberos - use Samba3 style login, use target principal" - plantest "$name" rpc 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=$netbios_name" RPC-SECRETS "$*" + 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 "$*" diff --git a/source4/script/tests/test_simple.sh b/source4/script/tests/test_simple.sh index 56db719001..a4a672cd5b 100755 --- a/source4/script/tests/test_simple.sh +++ b/source4/script/tests/test_simple.sh @@ -1,18 +1,6 @@ #!/bin/sh # run a quick set of filesystem tests -if [ $# -lt 3 ]; then -cat <<EOF -Usage: test_simple.sh UNC USERNAME PASSWORD <first> <smbtorture args> -EOF -exit 1; -fi - -unc="$1" -username="$2" -password="$3" -start="$4" -shift 4 ADDARGS="$*" incdir=`dirname $0` @@ -21,10 +9,6 @@ incdir=`dirname $0` tests="BASE-RW1" for t in $tests; do - if [ ! -z "$start" -a "$start" != $t ]; then - continue; - fi - start="" name="$t" - plantest "$name" smb $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS $unc -U"$username"%"$password" $t + plantest "$name" dc $VALGRIND bin/smbtorture $TORTURE_OPTIONS $ADDARGS //\$SERVER/simple -U"\$USERNAME"%"\$PASSWORD" $t done diff --git a/source4/script/tests/tests_all.sh b/source4/script/tests/tests_all.sh index 79694df98e..1d761efea3 100755 --- a/source4/script/tests/tests_all.sh +++ b/source4/script/tests/tests_all.sh @@ -1,15 +1,15 @@ #!/bin/sh - $SRCDIR/script/tests/test_ejs.sh $DOMAIN $USERNAME $PASSWORD $CONFIGURATION - $SRCDIR/script/tests/test_ldap.sh $SERVER $USERNAME $PASSWORD - $SRCDIR/script/tests/test_nbt.sh $SERVER $USERNAME $PASSWORD - $SRCDIR/script/tests/test_rpc.sh $SERVER $USERNAME $PASSWORD $DOMAIN - $SRCDIR/script/tests/test_net.sh $SERVER $USERNAME $PASSWORD $DOMAIN - $SRCDIR/script/tests/test_session_key.sh $SERVER $USERNAME $PASSWORD $DOMAIN $NETBIOSNAME - $SRCDIR/script/tests/test_binding_string.sh $SERVER $USERNAME $PASSWORD $DOMAIN - $SRCDIR/script/tests/test_echo.sh $SERVER $USERNAME $PASSWORD $DOMAIN - $SRCDIR/script/tests/test_posix.sh //$SERVER/tmp $USERNAME $PASSWORD "" + $SRCDIR/script/tests/test_ejs.sh $CONFIGURATION + $SRCDIR/script/tests/test_ldap.sh + $SRCDIR/script/tests/test_nbt.sh + $SRCDIR/script/tests/test_rpc.sh + $SRCDIR/script/tests/test_net.sh + $SRCDIR/script/tests/test_session_key.sh + $SRCDIR/script/tests/test_binding_string.sh + $SRCDIR/script/tests/test_echo.sh + $SRCDIR/script/tests/test_posix.sh $SRCDIR/script/tests/test_local.sh $SRCDIR/script/tests/test_pidl.sh - $SRCDIR/script/tests/test_blackbox.sh $SERVER $USERNAME $PASSWORD $DOMAIN $PREFIX - $SRCDIR/script/tests/test_simple.sh //$SERVER/simple $USERNAME $PASSWORD "" + $SRCDIR/script/tests/test_blackbox.sh $PREFIX/blackbox + $SRCDIR/script/tests/test_simple.sh $SRCDIR/script/tests/test_s3upgrade.sh $PREFIX/upgrade diff --git a/source4/script/tests/tests_quick.sh b/source4/script/tests/tests_quick.sh index f66b035e7e..9c57f8b20a 100755 --- a/source4/script/tests/tests_quick.sh +++ b/source4/script/tests/tests_quick.sh @@ -2,8 +2,8 @@ TORTURE_QUICK="yes" export TORTURE_QUICK -$SRCDIR/script/tests/test_ejs.sh $DOMAIN $USERNAME $PASSWORD $CONFIGURATION -$SRCDIR/script/tests/test_ldap.sh $SERVER $USERNAME $PASSWORD -$SRCDIR/script/tests/test_nbt.sh $SERVER $USERNAME $PASSWORD -$SRCDIR/script/tests/test_quick.sh //$SERVER/cifs $USERNAME $PASSWORD "" -$SRCDIR/script/tests/test_rpc_quick.sh $SERVER $USERNAME $PASSWORD $DOMAIN +$SRCDIR/script/tests/test_ejs.sh $CONFIGURATION +$SRCDIR/script/tests/test_ldap.sh +$SRCDIR/script/tests/test_nbt.sh +$SRCDIR/script/tests/test_quick.sh +$SRCDIR/script/tests/test_rpc_quick.sh |