diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-02-21 09:55:13 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-02-21 09:55:13 +1100 |
commit | 774fa12ac1695600710ce9fac18024edd38161ee (patch) | |
tree | 5440d8c0f00d28656e0d8f65f3b771eb11a01842 /source4/selftest | |
parent | 49b3a4829325967df9d1e616ad32e5379ce6cf5d (diff) | |
parent | 910a1cafdf253255510d3aff7cc2385da43331dd (diff) | |
download | samba-774fa12ac1695600710ce9fac18024edd38161ee.tar.gz samba-774fa12ac1695600710ce9fac18024edd38161ee.tar.bz2 samba-774fa12ac1695600710ce9fac18024edd38161ee.zip |
Merge branch 'v4-0-test' of git://git.samba.org/samba into 4-0-local
(This used to be commit 5cd3310b78a85243eb436d05db3228c3495f9162)
Diffstat (limited to 'source4/selftest')
-rw-r--r-- | source4/selftest/README | 21 | ||||
-rw-r--r-- | source4/selftest/config.mk | 45 | ||||
-rw-r--r-- | source4/selftest/output/plain.pm | 11 | ||||
-rwxr-xr-x | source4/selftest/samba4_tests.sh | 139 | ||||
-rwxr-xr-x | source4/selftest/selftest.pl | 48 | ||||
-rw-r--r-- | source4/selftest/target/Kvm.pm | 167 | ||||
-rw-r--r-- | source4/selftest/target/Samba4.pm | 24 |
7 files changed, 359 insertions, 96 deletions
diff --git a/source4/selftest/README b/source4/selftest/README index 3250f32ec7..e8e87c8b3f 100644 --- a/source4/selftest/README +++ b/source4/selftest/README @@ -39,3 +39,24 @@ The following environments are currently available: * DOMAIN: Domain name * REALM: Realm name * SERVER: Name of the member server + + +============= +Running tests +============= + +To run all the tests use: + + make test + +To run a quick subset (aiming for about 1 minute of testing) run: + + make quicktest + +To run a specific test, use this syntax + + make test TESTS=testname + +for example + + make test TESTS=samba4.BASE-DELETE diff --git a/source4/selftest/config.mk b/source4/selftest/config.mk index 0d5f4d6ab4..4e9d31b684 100644 --- a/source4/selftest/config.mk +++ b/source4/selftest/config.mk @@ -7,65 +7,66 @@ SELFTEST = $(LD_LIBPATH_OVERRIDE) $(PERL) $(srcdir)/selftest/selftest.pl --prefi --exclude=$(srcdir)/samba4-skip --testlist="./selftest/samba4_tests.sh|" \ $(TEST_OPTIONS) -test: everything +test:: everything $(SELFTEST) $(DEFAULT_TEST_OPTIONS) --immediate $(TESTS) -testone: everything +kvmtest:: everything + $(SELFTEST) $(DEFAULT_TEST_OPTIONS) --immediate --target=kvm --image=$(KVM_IMAGE) + +kvmquicktest:: everything + $(SELFTEST) $(DEFAULT_TEST_OPTIONS) --immediate --quick --target=kvm --image=$(KVM_IMAGE) + +testone:: everything $(SELFTEST) $(DEFAULT_TEST_OPTIONS) --one $(TESTS) -test-swrap: everything +test-swrap:: everything $(SELFTEST) --socket-wrapper --immediate $(TESTS) -test-swrap-pcap: everything +test-swrap-pcap:: everything $(SELFTEST) --socket-wrapper-pcap --immediate $(TESTS) -test-swrap-keep-pcap: everything +test-swrap-keep-pcap:: everything $(SELFTEST) --socket-wrapper-keep-pcap --immediate $(TESTS) -test-noswrap: everything +test-noswrap:: everything $(SELFTEST) --immediate $(TESTS) -quicktest: all +quicktest:: all $(SELFTEST) --quick --socket-wrapper --immediate $(TESTS) -quicktestone: all +quicktestone:: all $(SELFTEST) --quick --socket-wrapper --one $(TESTS) -testenv: everything +testenv:: everything $(SELFTEST) --socket-wrapper --testenv -valgrindtest: valgrindtest-all +valgrindtest:: valgrindtest-all -valgrindtest-quick: all +valgrindtest-quick:: all SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/valgrind_run $(LD_LIBPATH_OVERRIDE)" \ VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \ $(SELFTEST) --quick --immediate --socket-wrapper $(TESTS) -valgrindtest-all: everything +valgrindtest-all:: everything SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/valgrind_run $(LD_LIBPATH_OVERRIDE)" \ VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \ $(SELFTEST) --immediate --socket-wrapper $(TESTS) -valgrindtest-env: everything +valgrindtest-env:: everything SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/valgrind_run $(LD_LIBPATH_OVERRIDE)" \ VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \ $(SELFTEST) --socket-wrapper --testenv -gdbtest: gdbtest-all +gdbtest:: gdbtest-all -gdbtest-quick: all +gdbtest-quick:: all SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run $(LD_LIBPATH_OVERRIDE)" \ $(SELFTEST) --immediate --quick --socket-wrapper $(TESTS) -gdbtest-all: everything +gdbtest-all:: everything SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run $(LD_LIBPATH_OVERRIDE)" \ $(SELFTEST) --immediate --socket-wrapper $(TESTS) -gdbtest-env: everything +gdbtest-env:: everything SMBD_VALGRIND="xterm -n smbd -e $(srcdir)/script/gdb_run $(LD_LIBPATH_OVERRIDE)" \ $(SELFTEST) --socket-wrapper --testenv - -wintest: all - $(SELFTEST) win - - diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 1e6dead326..e491a999ab 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -46,8 +46,15 @@ sub start_testsuite($$) my $out = ""; $out .= "[$self->{index}/$self->{totalsuites} in ".$duration."s"; $out .= sprintf(", %d errors", ($#{$self->{suitesfailed}}+1)) if ($#{$self->{suitesfailed}} > -1); - $out .= "] $name\n", - print "$out"; + $out .= "] $name"; + if ($self->{immediate}) { + print "$out\n"; + } else { + require Term::ReadKey; + my ($wchar, $hchar, $wpixels, $hpixels) = Term::ReadKey::GetTerminalSize(); + foreach (1..$wchar) { $out.= " "; } + print "\r".substr($out, 0, $wchar); + } } sub output_msg($$) diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index d00b492953..c57ec4d6bd 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -40,6 +40,22 @@ plantest() { echo $cmdline } +normalize_testname() { + name=$1 + shift 1 + echo $name | tr "A-Z-" "a-z." +} + +plansmbtorturetest() { + name=$1 + env=$2 + shift 2 + other_args="$*" + modname=`normalize_testname $name` + cmdline="$VALGRIND $smb4torture $other_args $name" + plantest "$modname" "$env" $cmdline +} + $incdir/../bin/smbtorture -V samba4srcdir=$incdir/.. @@ -67,7 +83,7 @@ if grep ENABLE_GNUTLS.1 include/config.h > /dev/null; then fi for t in LDAP-CLDAP LDAP-BASIC LDAP-SCHEMA LDAP-UPTODATEVECTOR do - plantest "$t" dc $smb4torture "-U\$USERNAME%\$PASSWORD" //\$SERVER_IP/_none_ $t + plansmbtorturetest "$t" dc "-U\$USERNAME%\$PASSWORD" //\$SERVER_IP/_none_ done # only do the ldb tests when not in quick mode - they are quite slow, and ldb @@ -75,7 +91,6 @@ done LDBDIR=$samba4srcdir/lib/ldb export LDBDIR plantest "ldb" none TEST_DATA_PREFIX=\$PREFIX $LDBDIR/tests/test-tdb.sh - plantest "js.ldap" dc $SCRIPTDIR/ldap.js $CONFIGURATION -d 10 \$SERVER -U\$USERNAME%\$PASSWORD # Tests for RPC @@ -109,15 +124,15 @@ for bindoptions in seal,padcheck $VALIDATE bigendian; do ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;; esac for t in $tests; do - plantest "$t on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + plantest "`normalize_testname $t` on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done - plantest "RPC-SAMBA3-SHARESEC on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=torture:share=tmp $t "$*" + plantest "rpc.samba3.sharesec on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=torture:share=tmp RPC-SAMBA3-SHARESEC "$*" done done for bindoptions in "" $VALIDATE bigendian; do for t in $auto_rpc_tests; do - plantest "$t with $bindoptions" dc $VALGRIND $smb4torture "\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + plantest "`normalize_testname $t` with $bindoptions" dc $VALGRIND $smb4torture "\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done done @@ -129,7 +144,7 @@ for bindoptions in connect $VALIDATE ; do ncacn_ip_tcp) tests=$slow_ncacn_ip_tcp_tests ;; esac for t in $tests; do - plantest "$t on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + plantest "`normalize_testname $t` on $transport with $bindoptions" dc $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" done done done @@ -140,7 +155,7 @@ done net=`$smb4torture --list | grep ^NET-` for t in $net; do - plantest "$t" dc $VALGRIND $smb4torture "\$SERVER[$VALIDATE]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" $t "$*" + plansmbtorturetest "$t" dc "\$SERVER[$VALIDATE]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "$*" done # Tests for session keys @@ -160,13 +175,13 @@ for ntlmoptions in \ "-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 $ntlmoptions" + name="rpc.secrets on $transport with $bindoptions with $ntlmoptions" plantest "$name" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN --option=gensec:target_hostname=\$NETBIOSNAME RPC-SECRETS "$*" done -plantest "RPC-SECRETS on $transport with $bindoptions with Kerberos" dc $smb4torture $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" -plantest "RPC-SECRETS on $transport with $bindoptions with Kerberos - use target principal" dc $smb4torture $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=clientusespnegoprincipal=yes" "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" - plantest "RPC-SECRETS on $transport with Kerberos - use Samba3 style login" dc $smb4torture $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*" "$*" - plantest "RPC-SECRETS on $transport with Kerberos - use Samba3 style login, use target principal" dc $smb4torture $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*" "$*" +plantest "rpc.secrets on $transport with $bindoptions with Kerberos" dc $smb4torture $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" +plantest "rpc.secrets on $transport with $bindoptions with Kerberos - use target principal" dc $smb4torture $transport:"\$SERVER[$bindoptions]" -k yes -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN "--option=clientusespnegoprincipal=yes" "--option=gensec:target_hostname=\$NETBIOSNAME" RPC-SECRETS "$*" +plantest "rpc.secrets on $transport with Kerberos - use Samba3 style login" dc $smb4torture $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*" "$*" +plantest "rpc.secrets on $transport with Kerberos - use Samba3 style login, use target principal" dc $smb4torture $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*" "$*" # Echo tests transports="ncacn_np ncacn_ip_tcp ncalrpc" @@ -175,7 +190,7 @@ 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 - plantest "RPC-ECHO on $transport with $bindoptions and $ntlmoptions" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" RPC-ECHO "$*" + plantest "rpc.echo on $transport with $bindoptions and $ntlmoptions" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" RPC-ECHO "$*" done done done @@ -193,12 +208,12 @@ for transport in $transports; do "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=yes --option=torture:quick=yes" \ "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \ ; do - plantest "RPC-ECHO on $transport with $bindoptions and $ntlmoptions" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" + plantest "rpc.echo on $transport with $bindoptions and $ntlmoptions" dc $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" done done done -plantest "RPC-ECHO on ncacn_np over smb2" dc $smb4torture ncacn_np:"\$SERVER[smb2]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" +plantest "rpc.echo on ncacn_np over smb2" dc $smb4torture ncacn_np:"\$SERVER[smb2]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN RPC-ECHO "$*" # Tests against the NTVFS POSIX backend smb2=`$smb4torture --list | grep "^SMB2-" | xargs` @@ -206,28 +221,28 @@ raw=`$smb4torture --list | grep "^RAW-" | xargs` base=`$smb4torture --list | grep "^BASE-" | xargs` for t in $base $raw $smb2; do - plantest "$t" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $t + plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" done rap=`$smb4torture --list | grep "^RAP-" | xargs` for t in $rap; do - plantest "$t" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/IPC\\\$ -U"\$USERNAME"%"\$PASSWORD" $t + plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/IPC\\\$ -U"\$USERNAME"%"\$PASSWORD" done # Tests against the NTVFS CIFS backend for t in $base $raw; do - plantest "ntvfs.cifs.$t" dc $VALGRIND $smb4torture //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $t + plantest "ntvfs.cifs.`normalize_testname $t`" dc $VALGRIND $smb4torture //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $t done # Local tests for t in `$smb4torture --list | grep "^LOCAL-" | xargs`; do - plantest "$t" none $VALGRIND $smb4torture ncalrpc: $t "$*" + plansmbtorturetest "$t" none ncalrpc: "$*" done if test -f $samba4bindir/tdbtorture then - plantest "tdb stress" none $VALGRIND $samba4bindir/tdbtorture + plantest "tdb.stress" none $VALGRIND $samba4bindir/tdbtorture fi # Pidl tests @@ -251,33 +266,35 @@ bbdir=$incdir/../../testprogs/blackbox plantest "blackbox.smbclient" dc $bbdir/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" -plantest "blackbox.nmblookup" dc $bbdir/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" -plantest "blackbox.nmblookup" member $bbdir/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" +plantest "blackbox.nmblookup" dc $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" +plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh "\$NETBIOSNAME" "\$NETBIOSALIAS" "\$SERVER" "\$SERVER_IP" +plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.masktest" dc $bbdir/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.gentest" dc $bbdir/test_gentest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" # Tests using the "Simple" NTVFS backend for t in "BASE-RW1"; do - plantest "ntvfs/simple $t" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/simple -U"\$USERNAME"%"\$PASSWORD" $t + plantest "ntvfs.simple.`normalize_testname $t`" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/simple -U"\$USERNAME"%"\$PASSWORD" $t done DATADIR=$samba4srcdir/../testdata -plantest "parse samba3" none $samba4bindir/smbscript $DATADIR/samba3/verify $CONFIGURATION $DATADIR/samba3 plantest "js.samba3sam" none $SCRIPTDIR/samba3sam.js $CONFIGURATION `pwd` $DATADIR/samba3/ # Domain Member Tests -plantest "RPC-ECHO against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" RPC-ECHO "$*" -plantest "RPC-ECHO against member server with domain creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" RPC-ECHO "$*" -plantest "RPC-SAMR against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR" "$*" -plantest "RPC-SAMR-USERS against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-USERS" "$*" -plantest "RPC-SAMR-PASSWORDS against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-PASSWORDS" "$*" +plantest "rpc.echo against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" RPC-ECHO "$*" +plantest "rpc.echo against member server with domain creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD" RPC-ECHO "$*" +plantest "rpc.samr against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR" "$*" +plantest "rpc.samr.users against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-USERS" "$*" +plantest "rpc.samr.passwords against member server with local creds" member $VALGRIND $smb4torture 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" NBT_TESTS=`$smb4torture --list | grep "^NBT-" | xargs` -for f in $NBT_TESTS; do - plantest $f dc $smb4torture //\$SERVER/_none_ $f -U\$USERNAME%\$PASSWORD +for t in $NBT_TESTS; do + plansmbtorturetest "$t" dc //\$SERVER/_none_ -U\$USERNAME%\$PASSWORD done WB_OPTS="--option=\"torture:strict mode=yes\"" @@ -291,44 +308,42 @@ WINBIND_STRUCT_TESTS=`$smb4torture --list | grep "^WINBIND-STRUCT" | xargs` WINBIND_NDR_TESTS=`$smb4torture --list | grep "^WINBIND-NDR" | xargs` for env in dc member; do for t in $WINBIND_STRUCT_TESTS; do - plantest $t $env $smb4torture $WB_OPTS //_none_/_none_ $t + plansmbtorturetest $t $env $WB_OPTS //_none_/_none_ done for t in $WINBIND_NDR_TESTS; do - plantest $t $env $smb4torture $WB_OPTS //_none_/_none_ $t + plansmbtorturetest $t $env $WB_OPTS //_none_/_none_ done done if test -f $samba4bindir/nsstest then - plantest "NSS-TEST using winbind" member $VALGRIND $samba4bindir/nsstest $samba4bindir/shared/libnss_winbind.so + plantest "nss.test using winbind" member $VALGRIND $samba4bindir/nsstest $samba4bindir/shared/libnss_winbind.so fi -# if python is available, run the python tests: -if test -f $samba4bindir/smbpython -then - PYTHON=bin/smbpython - SUBUNITRUN="$PYTHON ./scripting/bin/subunitrun" - plantest "ldb.python" none PYTHONPATH="$PYTHONPATH:lib/ldb/tests/python/" $SUBUNITRUN api - plantest "credentials.python" none PYTHONPATH="$PYTHONPATH:auth/credentials/tests" $SUBUNITRUN bindings - plantest "registry.python" none PYTHONPATH="$PYTHONPATH:lib/registry/tests/" $SUBUNITRUN bindings - plantest "tdb.python" none PYTHONPATH="$PYTHONPATH:lib/tdb/python/tests" $SUBUNITRUN simple - plantest "auth.python" none PYTHONPATH="$PYTHONPATH:auth/tests/" $SUBUNITRUN bindings - plantest "security.python" none PYTHONPATH="$PYTHONPATH:libcli/security/tests" $SUBUNITRUN bindings - plantest "param.python" none PYTHONPATH="$PYTHONPATH:param/tests" $SUBUNITRUN bindings - plantest "upgrade.python" none $SUBUNITRUN samba.tests.upgrade - plantest "samba.python" none $SUBUNITRUN samba.tests - plantest "provision.python" none $SUBUNITRUN samba.tests.provision - plantest "samba3.python" none $SUBUNITRUN samba.tests.samba3 - plantest "samr.python" dc $SUBUNITRUN samba.tests.dcerpc.sam - plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests - plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam - plantest "rpcecho.python" dc $SUBUNITRUN samba.tests.dcerpc.rpcecho - plantest "winreg.python" dc $SUBUNITRUN samba.tests.dcerpc.registry - plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN - plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3 - rm -rf $PREFIX/upgrade - plantest "blackbox.upgrade" none $PYTHON setup/upgrade.py $CONFIGURATION --targetdir=$PREFIX/upgrade ../testdata/samba3 ../testdata/samba3/smb.conf - rm -rf $PREFIX/provision - plantest "blackbox.provision.py" none $PYTHON ./setup/provision.py $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/provision -fi +PYTHON=bin/smbpython +SUBUNITRUN="$PYTHON ./scripting/bin/subunitrun" +plantest "ldb.python" none PYTHONPATH="$PYTHONPATH:lib/ldb/tests/python/" $SUBUNITRUN api +plantest "credentials.python" none PYTHONPATH="$PYTHONPATH:auth/credentials/tests" $SUBUNITRUN bindings +plantest "registry.python" none PYTHONPATH="$PYTHONPATH:lib/registry/tests/" $SUBUNITRUN bindings +plantest "tdb.python" none PYTHONPATH="$PYTHONPATH:lib/tdb/python/tests" $SUBUNITRUN simple +plantest "auth.python" none PYTHONPATH="$PYTHONPATH:auth/tests/" $SUBUNITRUN bindings +plantest "security.python" none PYTHONPATH="$PYTHONPATH:libcli/security/tests" $SUBUNITRUN bindings +plantest "param.python" none PYTHONPATH="$PYTHONPATH:param/tests" $SUBUNITRUN bindings +plantest "upgrade.python" none $SUBUNITRUN samba.tests.upgrade +plantest "samba.python" none $SUBUNITRUN samba.tests +plantest "provision.python" none $SUBUNITRUN samba.tests.provision +plantest "samba3.python" none $SUBUNITRUN samba.tests.samba3 +plantest "samr.python" dc $SUBUNITRUN samba.tests.dcerpc.sam +plantest "samdb.python" dc $SUBUNITRUN samba.tests.samdb +plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests +plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam +plantest "rpcecho.python" dc $SUBUNITRUN samba.tests.dcerpc.rpcecho +plantest "winreg.python" dc $SUBUNITRUN samba.tests.dcerpc.registry +plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3 +rm -rf $PREFIX/upgrade +plantest "blackbox.upgrade" none $PYTHON setup/upgrade.py $CONFIGURATION --targetdir=$PREFIX/upgrade ../testdata/samba3 ../testdata/samba3/smb.conf +rm -rf $PREFIX/provision +mkdir $PREFIX/provision +plantest "blackbox.provision.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_provision.sh "$PREFIX/provision" "$CONFIGURATION" diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index aab2ca8f07..aa4423c7e2 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # Bootstrap Samba and run a number of tests against it. -# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org> +# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer@samba.org> # Published under the GNU GPL, v3 or later. =pod @@ -13,7 +13,7 @@ selftest - Samba test runner selftest --help -selftest [--srcdir=DIR] [--builddir=DIR] [--target=samba4|samba3|win] [--socket-wrapper] [--quick] [--exclude=FILE] [--include=FILE] [--one] [--prefix=prefix] [--immediate] [--testlist=FILE] [TESTS] +selftest [--srcdir=DIR] [--builddir=DIR] [--target=samba4|samba3|win|kvm] [--socket-wrapper] [--quick] [--exclude=FILE] [--include=FILE] [--one] [--prefix=prefix] [--immediate] [--testlist=FILE] [TESTS] =head1 DESCRIPTION @@ -43,7 +43,7 @@ Change directory to run tests in. Default is 'st'. Show errors as soon as they happen rather than at the end of the test run. -=item I<--target samba4|samba3|win> +=item I<--target samba4|samba3|win|kvm> Specify test target against which to run. Default is 'samba4'. @@ -144,6 +144,7 @@ my $opt_expected_failures = undef; my @opt_exclude = (); my @opt_include = (); my $opt_verbose = 0; +my $opt_image = undef; my $opt_testenv = 0; my $ldap = undef; my $opt_analyse_cmd = undef; @@ -280,7 +281,7 @@ Usage: $Script [OPTIONS] PREFIX Generic options: --help this help page - --target=samba4|samba3|win Samba version to target + --target=samba[34]|win|kvm Samba version to target --testlist=FILE file to read available tests from Paths: @@ -301,6 +302,9 @@ Samba4 Specific: Samba3 Specific: --bindir=PATH path to binaries +Kvm Specific: + --image=PATH path to KVM image + Behaviour: --quick run quick overall test --one abort when the first test fails @@ -334,6 +338,7 @@ my $result = GetOptions ( 'resetup-environment' => \$opt_resetup_env, 'bindir:s' => \$opt_bindir, 'format=s' => \$opt_format, + 'image=s' => \$opt_image, 'testlist=s' => \@testlists ); @@ -442,6 +447,37 @@ if ($opt_target eq "samba4") { $testenv_default = "dc"; require target::Windows; $target = new Windows(); +} elsif ($opt_target eq "kvm") { + die("Kvm tests will not run with socket wrapper enabled.") + if ($opt_socket_wrapper); + require target::Kvm; + die("No image specified") unless ($opt_image); + $target = new Kvm($opt_image, undef); +} + +# +# Start a Virtual Distributed Ethernet Switch +# Returns the pid of the switch. +# +sub start_vde_switch($) +{ + my ($path) = @_; + + system("vde_switch --pidfile $path/vde.pid --sock $path/vde.sock --daemon"); + + open(PID, "$path/vde.pid"); + <PID> =~ /([0-9]+)/; + my $pid = $1; + close(PID); + + return $pid; +} + +# Stop a Virtual Distributed Ethernet Switch +sub stop_vde_switch($) +{ + my ($pid) = @_; + kill 9, $pid; } sub read_test_regexes($) @@ -522,11 +558,13 @@ sub write_clientconf($$) if (defined($vars->{WINBINDD_SOCKET_DIR})) { print CF "\twinbindd socket directory = $vars->{WINBINDD_SOCKET_DIR}\n"; } + if ($opt_socket_wrapper) { + print CF "\tinterfaces = $interfaces\n"; + } print CF " private dir = $prefix_abs/client/private js include = $srcdir_abs/scripting/libjs name resolve order = bcast - interfaces = $interfaces panic action = $srcdir_abs/script/gdb_backtrace \%PID\% \%PROG\% max xmit = 32K notify:inotify = false diff --git a/source4/selftest/target/Kvm.pm b/source4/selftest/target/Kvm.pm new file mode 100644 index 0000000000..3b17a2909c --- /dev/null +++ b/source4/selftest/target/Kvm.pm @@ -0,0 +1,167 @@ +#!/usr/bin/perl +# Start a KVM machine and run a number of tests against it. +# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer@samba.org> +# Published under the GNU GPL, v3 or later. + +package Kvm; + +use strict; +use Cwd qw(abs_path); +use FindBin qw($RealBin); +use POSIX; + +sub new($$$$) { + my ($classname, $dc_image, $vdesocket) = @_; + my $self = { + dc_image => $dc_image, + vdesocket => $vdesocket, + }; + bless $self; + return $self; +} + +sub write_kvm_ifup($$$) +{ + my ($self, $path, $ip_prefix) = @_; + open(SCRIPT, ">$path/kvm-ifup"); + + print SCRIPT <<__EOF__; +#!/bin/sh + +PREFIX=$ip_prefix + +/sbin/ifconfig \$1 \$PREFIX.1 up + +cat <<EOF>$path/udhcpd.conf +interface \$1 +start \$PREFIX.20 +end \$PREFIX.20 +max_leases 1 +lease_file $path/udhcpd.leases +pidfile $path/udhcpd.pid +EOF + +touch $path/udhcpd.leases + +/usr/sbin/udhcpd $path/udhcpd.conf + +exit 0 +__EOF__ + close(SCRIPT); + chmod(0755, "$path/kvm-ifup"); + + return ("$path/kvm-ifup", "$path/udhcpd.pid", "$ip_prefix.20"); +} + +sub teardown_env($$) +{ + my ($self, $envvars) = @_; + + print "Killing kvm instance $envvars->{KVM_PID}\n"; + + kill 9, $envvars->{KVM_PID}; + + if (defined($envvars->{DHCPD_PID})) { + print "Killing dhcpd instance $envvars->{DHCPD_PID}\n"; + kill 9, $envvars->{DHCPD_PID}; + } + + return 0; +} + +sub getlog_env($$) +{ + my ($self, $envvars) = @_; + + return ""; +} + +sub check_env($$) +{ + my ($self, $envvars) = @_; + + # FIXME: Check whether $self->{pid} is still running + + return 1; +} + +sub read_pidfile($) +{ + my ($path) = @_; + + open(PID, $path); + <PID> =~ /([0-9]+)/; + my ($pid) = $1; + close(PID); + return $pid; +} + +sub start($$$) +{ + my ($self, $path, $image) = @_; + + my $pidfile = "$path/kvm.pid"; + + my $opts = (defined($ENV{KVM_OPTIONS})?$ENV{KVM_OPTIONS}:"-nographic"); + + if (defined($ENV{KVM_SNAPSHOT})) { + $opts .= " -loadvm $ENV{KVM_SNAPSHOT}"; + } + + my $netopts; + my $dhcp_pid; + my $ip_address; + + if ($self->{vdesocket}) { + $netopts = "vde,socket=$self->{vdesocket}"; + } else { + my $ifup_script, $dhcpd_pidfile; + ($ifup_script, $dhcpd_pidfile, $ip_address) = $self->write_kvm_ifup($path, "192.168.9"); + $netopts = "tap,script=$ifup_script"; + $dhcp_pid = read_pidfile($dhcpd_pidfile); + } + + system("kvm -name \"Samba 4 Test Subject\" $opts -monitor unix:$path/kvm.monitor,server,nowait -daemonize -pidfile $pidfile -snapshot $image -net nic -net $netopts"); + + return (read_pidfile($pidfile), $dhcp_pid, $ip_address); +} + +sub setup_env($$$) +{ + my ($self, $envname, $path) = @_; + + if ($envname eq "dc") { + ($self->{dc_pid}, $self->{dc_dhcpd_pid}, $self->{dc_ip}) = $self->start($path, $self->{dc_image}); + + sub choose_var($$) { + my ($name, $default) = @_; + return defined($ENV{"KVM_DC_$name"})?$ENV{"KVM_DC_$name"}:$default; + } + + if ($envname eq "dc") { + return { + KVM_PID => $self->{dc_pid}, + DHCPD_PID => $self->{dc_dhcpd_pid}, + USERNAME => choose_var("USERNAME", "Administrator"), + PASSWORD => choose_var("PASSWORD", "penguin"), + DOMAIN => choose_var("DOMAIN", "SAMBA"), + REALM => choose_var("REALM", "SAMBA"), + SERVER => choose_var("SERVER", "DC"), + SERVER_IP => $self->{dc_ip}, + NETBIOSNAME => choose_var("NETBIOSNAME", "DC"), + NETBIOSALIAS => choose_var("NETBIOSALIAS", "DC"), + }; + } else { + return undef; + } + } else { + return undef; + } +} + +sub stop($) +{ + my ($self) = @_; +} + +1; diff --git a/source4/selftest/target/Samba4.pm b/source4/selftest/target/Samba4.pm index 87a86ef06f..563aca876e 100644 --- a/source4/selftest/target/Samba4.pm +++ b/source4/selftest/target/Samba4.pm @@ -525,7 +525,7 @@ sub provision($$$$$$) (system("rm -rf $prefix/*") == 0) or die("Unable to clean up"); mkdir($_, 0777) foreach ($privatedir, $etcdir, $piddir, $ncalrpcdir, $lockdir, - $tmpdir); + $tmpdir, "$tmpdir/test1", "$tmpdir/test2"); my $localbasedn = $basedn; @@ -569,6 +569,20 @@ sub provision($$$$$$) posix:sharedelay = 100000 posix:eadb = $lockdir/eadb.tdb +[test1] + path = $tmpdir/test1 + read only = no + ntvfs handler = posix + posix:sharedelay = 100000 + posix:eadb = $lockdir/eadb.tdb + +[test2] + path = $tmpdir/test2 + read only = no + ntvfs handler = posix + posix:sharedelay = 100000 + posix:eadb = $lockdir/eadb.tdb + [cifs] read only = no ntvfs handler = cifs @@ -660,12 +674,12 @@ nogroup:x:65534:nobody my @provision_options = (); push (@provision_options, "NSS_WRAPPER_PASSWD=\"$nsswrap_passwd\""); push (@provision_options, "NSS_WRAPPER_GROUP=\"$nsswrap_group\""); - if (defined($ENV{PROVISION_PYTHON})) { - push (@provision_options, "$self->{bindir}/smbpython"); - push (@provision_options, "$self->{setupdir}/provision.py"); - } else { + if (defined($ENV{PROVISION_EJS})) { push (@provision_options, "$self->{bindir}/smbscript"); push (@provision_options, "$self->{setupdir}/provision"); + } else { + push (@provision_options, "$self->{bindir}/smbpython"); + push (@provision_options, "$self->{setupdir}/provision.py"); } push (@provision_options, split(' ', $configuration)); push (@provision_options, "--host-name=$netbiosname"); |