diff options
author | bubulle <bubulle@alioth.debian.org> | 2011-06-07 20:43:08 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2011-06-07 20:43:08 +0000 |
commit | e64520a9ed05c9782a6e8ca8015fdef01b92ecc3 (patch) | |
tree | fc3a71a0b741cbcc6a5a892f91cc0f2218dfe656 /source4/selftest | |
parent | 6fe9013ae23927a67fa6b6033e2711cef99b3533 (diff) | |
download | samba-e64520a9ed05c9782a6e8ca8015fdef01b92ecc3.tar.gz |
Revert upstream branch to 3.5.8....oops
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@3810 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source4/selftest')
-rw-r--r-- | source4/selftest/config.mk | 120 | ||||
-rw-r--r-- | source4/selftest/knownfail | 129 | ||||
-rw-r--r-- | source4/selftest/quick | 4 | ||||
-rw-r--r-- | source4/selftest/skip | 30 | ||||
-rw-r--r-- | source4/selftest/slow | 4 | ||||
-rwxr-xr-x | source4/selftest/test_w2k3_file.sh | 2 | ||||
-rwxr-xr-x | source4/selftest/tests.py | 433 | ||||
-rwxr-xr-x | source4/selftest/tests.sh | 468 | ||||
-rwxr-xr-x | source4/selftest/win/wintest_raw.sh | 2 | ||||
-rw-r--r-- | source4/selftest/wscript | 201 |
10 files changed, 651 insertions, 742 deletions
diff --git a/source4/selftest/config.mk b/source4/selftest/config.mk new file mode 100644 index 0000000000..a18986afc0 --- /dev/null +++ b/source4/selftest/config.mk @@ -0,0 +1,120 @@ +TEST_FORMAT = plain + +SELFTEST = $(LD_LIBPATH_OVERRIDE) PYTHON=$(PYTHON) \ + $(PERL) $(selftestdir)/selftest.pl --prefix=${selftest_prefix} \ + --builddir=$(builddir) --srcdir=$(srcdir) \ + --exclude=$(srcdir)/selftest/skip --testlist="./selftest/tests.sh|" \ + $(TEST_OPTIONS) +# this strange code is to handle the fact that the bash pipefail option is +# not portable. When we run selftest we use a pipeline, and the first element +# of that pipeline might abort. We need to catch this and mark the test +# as having failed +ST_RM = ( rm -f $(selftest_prefix)/st_done && +ST_TOUCH = && touch $(selftest_prefix)/st_done ) +ST_DONE_TEST = @test -f $(selftest_prefix)/st_done || { echo "SELFTEST FAILED"; exit 1; } + +SELFTEST_NOSLOW_OPTS = --exclude=$(srcdir)/selftest/slow +SELFTEST_QUICK_OPTS = $(SELFTEST_NOSLOW_OPTS) --quick --include=$(srcdir)/selftest/quick +FILTER_XFAIL = $(PERL) $(selftestdir)/filter-subunit.pl --expected-failures=$(srcdir)/selftest/knownfail +FORMAT_TEST_OUTPUT = $(FILTER_XFAIL) | $(PERL) $(selftestdir)/format-subunit.pl --format=$(TEST_FORMAT) + +test-subunit:: everything + $(SELFTEST) --socket-wrapper $(TESTS) $(ST_TOUCH) + $(ST_DONE_TEST) + +slowtest:: everything + $(SELFTEST) $(DEFAULT_TEST_OPTIONS) $(TESTS) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) + +ifeq ($(RUN_FROM_BUILD_FARM),yes) +test:: everything + $(ST_RM) $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) $(TESTS) $(ST_TOUCH) | $(FILTER_XFAIL) --strip-passed-output + $(ST_DONE_TEST) +else +test:: + $(ST_RM) $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) $(TESTS) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) +endif + +kvmtest:: everything + $(ST_RM) $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) \ + --target=kvm --image=$(KVM_IMAGE) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) + +kvmquicktest:: everything + $(ST_RM) $(SELFTEST) $(DEFAULT_TEST_OPTIONS) \ + $(SELFTEST_QUICK_OPTS) --target=kvm --image=$(KVM_IMAGE) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) + +testone:: everything + $(ST_RM) $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) $(DEFAULT_TEST_OPTIONS) --one $(TESTS) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) + $(ST_DONE_TEST) + +test-swrap:: everything + $(ST_RM) $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper $(TESTS) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) + +test-swrap-pcap:: everything + $(ST_RM) $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper-pcap $(TESTS) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) + +test-swrap-keep-pcap:: everything + $(ST_RM) $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper-keep-pcap $(TESTS) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) + +test-noswrap:: everything + $(ST_RM) $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) $(TESTS) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) + +quicktest:: all + $(ST_RM) $(SELFTEST) $(SELFTEST_QUICK_OPTS) --socket-wrapper $(TESTS) $(ST_TOUCH) | $(FORMAT_TEST_OUTPUT) --immediate + $(ST_DONE_TEST) + +quicktest-subunit:: all + $(ST_RM) $(SELFTEST) $(SELFTEST_QUICK_OPTS) --socket-wrapper $(TESTS) $(ST_TOUCH) + $(ST_DONE_TEST) + +quicktestone:: all + $(ST_RM) $(SELFTEST) $(SELFTEST_QUICK_OPTS) --socket-wrapper --one $(TESTS) | $(FORMAT_TEST_OUTPUT) + $(ST_DONE_TEST) + +testenv:: everything + $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper --testenv + +testenv-%:: everything + SELFTEST_TESTENV=$* $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper --testenv + +test-%:: + $(MAKE) test TESTS=$* + +valgrindtest:: valgrindtest-all + +valgrindtest-quick:: all + SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \ + VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \ + $(SELFTEST) $(SELFTEST_QUICK_OPTS) --socket-wrapper $(TESTS) | $(FORMAT_TEST_OUTPUT) --immediate + +valgrindtest-all:: everything + SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \ + VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \ + $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper $(TESTS) | $(FORMAT_TEST_OUTPUT) --immediate + +valgrindtest-env:: everything + SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/valgrind_run $(LD_LIBPATH_OVERRIDE)" \ + VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \ + $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper --testenv + +gdbtest:: gdbtest-all + +gdbtest-quick:: all + SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \ + $(SELFTEST) $(SELFTEST_QUICK_OPTS) --socket-wrapper $(TESTS) | $(FORMAT_TEST_OUTPUT) --immediate + +gdbtest-all:: everything + SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \ + $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper $(TESTS) | $(FORMAT_TEST_OUTPUT) --immediate + +gdbtest-env:: everything + SAMBA_VALGRIND="xterm -n server -e $(selftestdir)/gdb_run $(LD_LIBPATH_OVERRIDE)" \ + $(SELFTEST) $(SELFTEST_NOSLOW_OPTS) --socket-wrapper --testenv + diff --git a/source4/selftest/knownfail b/source4/selftest/knownfail index d3c3f4ee6d..fcb16c9814 100644 --- a/source4/selftest/knownfail +++ b/source4/selftest/knownfail @@ -3,83 +3,58 @@ # # "make test" will not report failures for tests listed here and will consider # a successful run for any of these tests an error. -samba4.local.resolve.*.async -samba4.local.iconv.*.next_codepoint() -samba4..*base.delete.*.deltest17 -samba4..*base.delete.*.deltest20a -samba4..*base.delete.*.deltest20b -samba4.raw.rename.*.osxrename -samba4.raw.rename.*.directory rename -samba4.rpc.winreg.*security +local.resolve.*.async +local.iconv.*.next_codepoint() +base.delete.*.deltest17 +base.delete.*.deltest20a +base.delete.*.deltest20b +raw.rename.*.osxrename +raw.rename.*.directory rename +rpc.winreg.*security samba4.local.registry.(dir|ldb).check hive security samba4.local.registry.local.security -samba4.rpc.wkssvc -samba4.rpc.handles.*.lsarpc-shared -samba4.rpc.handles.*.mixed-shared -samba4.rpc.epmapper -samba4.rpc.drsuapi.* -samba4.rpc.lsalookup -samba4.rpc.cracknames -samba4.rpc.netlogon.*.LogonUasLogon -samba4.rpc.netlogon.*.LogonUasLogoff -samba4.rpc.netlogon.*.DatabaseSync -samba4.rpc.netlogon.*.DatabaseSync2 -samba4.rpc.netlogon.*.LogonControl -samba4.rpc.netlogon.*.LogonControl2 -samba4.rpc.netlogon.*.DsrEnumerateDomainTrusts -samba4.rpc.netlogon.*.NetrEnumerateTrustedDomains -samba4.rpc.netlogon.*.NetrEnumerateTrustedDomainsEx -samba4.rpc.netlogon.*.GetPassword -samba4.rpc.netlogon.*.GetTrustPasswords -samba4.rpc.netlogon.*.DatabaseRedo -samba4.rpc.netlogon.*.ServerGetTrustInfo -samba4.rpc.netlogon.*.GetForestTrustInformation -samba4.rpc.samr.passwords.badpwdcount # Not provided by Samba 4 yet -samba4.rpc.samr.passwords.lockout -samba4.base.charset.*.Testing partial surrogate +rpc.wkssvc +rpc.handles.*.lsarpc-shared +rpc.handles.*.mixed-shared +rpc.epmapper.*.Insert +rpc.epmapper.*.InqObject +rpc.dfs.* +rpc.drsuapi.* +rpc.lsalookup +rpc.cracknames +rpc.netlogon.*.LogonUasLogon +rpc.netlogon.*.LogonUasLogoff +rpc.netlogon.*.DatabaseSync +rpc.netlogon.*.DatabaseSync2 +rpc.netlogon.*.LogonControl +rpc.netlogon.*.LogonControl2 +rpc.netlogon.*.DsrEnumerateDomainTrusts +rpc.netlogon.*.NetrEnumerateTrustedDomains +rpc.netlogon.*.NetrEnumerateTrustedDomainsEx +rpc.netlogon.*.DsrGetDcSiteCoverageW +rpc.netlogon.*.DsRAddressToSitenamesW +rpc.netlogon.*.DsRAddressToSitenamesExW +rpc.netlogon.*.GetPassword +rpc.netlogon.*.GetTrustPasswords +rpc.netlogon.*.DatabaseRedo +rpc.netlogon.*.ServerGetTrustInfo +samba4.rpc.samr.passwords.pwdlastset # Not provided by Samba 4 yet +samba4.rpc.samr.users.privileges +samba4.rpc.spoolss.printer # Not provided by Samba 4 yet +base.charset.*.Testing partial surrogate .*net.api.delshare.* # DelShare isn't implemented yet -samba4.rap.*netservergetinfo -samba4.rap.*netsessionenum -samba4.rap.*netsessiongetinfo -samba4.rap.*netremotetod -samba4.smb2.persistent.handles1 -samba4.winbind.struct.*.show_sequence # Not yet working in winbind -samba4.winbind.struct.*.getpwent # Not yet working in winbind -samba4.winbind.struct.*.setpwent # Not yet working in winbind -samba4.winbind.struct.*.lookup_name_sid # Not yet working in winbind -samba4.winbind.struct.*.list_groups -samba4.*base.delaywrite.*update of write time and SMBwrite truncate$ -samba4.*base.delaywrite.*update of write time and SMBwrite truncate expand$ -samba4.*base.delaywrite.*delayed update of write time 3a$ -samba4.*base.delaywrite.*delayed update of write time 3c$ -samba4.*base.delaywrite.*update of write time using SET_END_OF_FILE$ -samba4.*base.delaywrite.*update of write time using SET_ALLOCATION_SIZE$ -samba4.ldap.python \(dc\).Test add_ldif\(\) with BASE64 security descriptor input using WRONG domain SID$ -# some operations don't work over the CIFS NTVFS backend yet (eg. root_fid) -samba4.ntvfs.cifs.base.createx_access -samba4.ntvfs.cifs.base.createx_sharemodes_dir -samba4.ntvfs.cifs.base.maximum_allowed -samba4.base.createx_access # this test is broken for non-administrator users -samba4.smb2.oplock # oplocks in the s4 SMB2 server are a mess -samba4.raw.lock.*.async # bug 6960 -samba4.smb2.lock.*.multiple-unlock # bug 6959 -samba4.raw.sfileinfo.*.end-of-file # bug 6962 -samba4.raw.oplock.*.batch22 # bug 6963 -samba4.raw.oplock.*.brl4 # bug 7928 -samba4.raw.lock.*.zerobyteread # bug 6974 -samba4.smb2.lock.*.zerobyteread # bug 6974 -samba4.raw.streams.*.delete -samba4.raw.streams.*.createdisp -samba4.raw.streams.*.sumtab -samba4.raw.acls.*.create_dir -samba4.raw.acls.*.create_file -samba4.smb2.create.*.acldir -samba4.smb2.acls.*.generic -samba4.smb2.acls.*.inheritflags -samba4.smb2.acls.*.owner -samba4.smb2.compound.*.related1 -samba4.smb2.compound.*.related2 -samba4.smb2.compound.*.invalid2 -samba4.ldap.acl.*.search.* # ACL search behaviour not enabled by default -samba4.ldap.acl.*.ntSecurityDescriptor.* # ACL extended checks on search not enabled by default -samba4.nbt.winsreplication.owned # fails sometimes, timing related +rap.*netservergetinfo +smb2.persistent.handles1 +samba4.winbind.struct.*.SHOW_SEQUENCE # Not yet working in winbind +samba4.winbind.struct.*.GETPWENT # Not yet working in winbind +samba4.winbind.struct.*.SETPWENT # Not yet working in winbind +samba4.winbind.struct.*.LOOKUP_NAME_SID # Not yet working in winbind +^samba4.*base.delaywrite.*update of write time and SMBwrite truncate$ +^samba4.*base.delaywrite.*update of write time and SMBwrite truncate expand$ +^samba4.*base.delaywrite.*delayed update of write time 3a$ +^samba4.*base.delaywrite.*delayed update of write time 3c$ +^samba4.*base.delaywrite.*update of write time using SET_END_OF_FILE$ +^samba4.*base.delaywrite.*update of write time using SET_ALLOCATION_SIZE$ +^samba4.ldap.python \(dc\).Test add_ldif\(\) with BASE64 security descriptor input using WRONG domain SID$ +^samba4.ldap.python \(dc\).Testing ldb.add_ldif\(\) for nTSecurityDescriptor +^samba4.ldap.secdesc.python diff --git a/source4/selftest/quick b/source4/selftest/quick index 1827caf48f..7bea619f18 100644 --- a/source4/selftest/quick +++ b/source4/selftest/quick @@ -11,15 +11,18 @@ base.open base.chkpath raw.qfsinfo raw.qfileinfo +raw.sfileinfo raw.mkdir raw.seek raw.open raw.write +raw.unlink raw.read raw.close raw.ioctl raw.rename raw.eas +raw.streams base.open rpc.altercontext rpc.join @@ -33,4 +36,3 @@ rpc.join rpc.handles rpc.echo smb.signing -drs.unit diff --git a/source4/selftest/skip b/source4/selftest/skip index 671269a8fd..aa57c6b1b4 100644 --- a/source4/selftest/skip +++ b/source4/selftest/skip @@ -10,20 +10,17 @@ # # If a testsuite is partially succeeding, please list the failing bits # in the selftest/knownfail file rather than disabling the testsuite completely. -# That way those tests that do succeed still get run and we will be notified -# if a known failing test suddenly starts succeeding. # # If a testsuite is very slow, please add it to selftest/slow instead. -# This way it will still get run in "make slowtest" # -# Please add a comment for each testsuite you disable explaining why +# Please add a comment for each testsuite you disable explaining why # it is being skipped. raw.composite base.iometer base.casetable base.nttrans base.scan.maxfid -hold.oplock # Not a test, but a way to block other clients for a test +raw.hold.oplock # Not a test, but a way to block other clients for a test raw.ping.pong # Needs second server to test rpc.samr.accessmask raw.scan.eamax @@ -32,7 +29,6 @@ smb2.notify smb2.scan smb2.lease smb2.durable.open -smb2.dir ntvfs.cifs.base.charset ntvfs.cifs.base.iometer ntvfs.cifs.base.casetable @@ -45,42 +41,26 @@ ntvfs.cifs.raw.notify ntvfs.cifs.raw.scan-eamax ntvfs.cifs.raw.context ntvfs.cifs.raw.qfileinfo.ipc +rpc.dssync rpc.samsync rpc.remact # Not provided by Samba 4 rpc.oxidresolve # Not provided by Samba 4 rpc.eventlog # Not provided by Samba 4 rpc.initshutdown # Not provided by Samba 4 -rpc.spoolss # Not provided by Samba 4 rpc.svcctl # Not provided by Samba 4 rpc.atsvc # Not provided by Samba 4 rpc.frsapi # Not provided by Samba 4 rpc.ntsvcs # Not provided by Samba 4 -rpc.dfs # Not provided by Samba 4 -rpc.lsa.forest # Not provided by Samba 4 ^samba4.base.samba3.* # Samba3-specific test ^samba4.ntvfs.cifs.base.samba3.* # Samba3-specific test ^samba4.raw.samba3.* # Samba3-specific test ^samba4.ntvfs.cifs.raw.samba3.* # Samba3-specific test samba4.ntvfs.cifs.raw. ^samba4.rpc..*samba3.* # Samba3-specific test -^samba4.samba-tool.domopen.*$ # Hangs for some reason +^samba4.net.domopen.*$ # Hangs for some reason +^samba4.net.api.become.dc.*$ # Fails nss.test # Fails raw.offline # Samba 4 doesn't have much offline support yet rpc.autoidl # this one just generates a lot of noise, and is no longer useful samba4.rpc.countcalls # this is not useful now we have full IDL samba4.rap.scan # same thing here - we have docs now -samba4.rap.printing # Not provided by Samba 4 -samba4.rap.sam # Not provided by Samba 4 -samba4.gensec.python # not finished -bench # don't run benchmarks in our selftest -trans2.scan # uses huge number of file descriptors -base.scan.ioctl # bad idea in make test -base.scan.pipe_number # bad idea in make test -base.secleak # no point on build farm -base.delaywrite # This is randomly failing, depending on timing and filesystem features -base.winattr -base.birthtime -smb2.acls # new test which doesn't pass yet -# ktutil might not be installed or from mit... -# we should build a samba4ktutil and use that instead -samba4.blackbox.ktpass # this test isn't portable ... diff --git a/source4/selftest/slow b/source4/selftest/slow index 7c2090c0e6..d414368de8 100644 --- a/source4/selftest/slow +++ b/source4/selftest/slow @@ -1,9 +1,7 @@ -# This file contains regexes matching tests that are very slow and +# This file contains regexes matching tests that are very slow and # should be skipped during a normal test run. .*base.bench.holdcon.* # Slow raw.bench.lookup # Slow base.utable # Slow base.smb # Slow rpc.scanner # Slow -ntvfs.cifs.base.delaywrite # It's a slow test and having it on the proxy share is not needed -.*stress.* # Slow diff --git a/source4/selftest/test_w2k3_file.sh b/source4/selftest/test_w2k3_file.sh index 27714c2c19..d59d2b49ef 100755 --- a/source4/selftest/test_w2k3_file.sh +++ b/source4/selftest/test_w2k3_file.sh @@ -27,7 +27,7 @@ tests="$tests BASE-DENY3 BASE-XCOPY BASE-OPEN BASE-DENYDOS" tests="$tests BASE-DELETE BASE-PROPERTIES BASE-MANGLE" tests="$tests BASE-CHKPATH BASE-SECLEAK BASE-TRANS2" tests="$tests BASE-NTDENY1 BASE-NTDENY2 BASE-RENAME BASE-OPENATTR" -tests="$tests RAW-QFILEINFO RAW-SFILEINFO-BUG RAW-SFILEINFO-BASE" +tests="$tests RAW-QFILEINFO RAW-SFILEINFO-BUG RAW-SFILEINFO" tests="$tests RAW-LOCK RAW-MKDIR RAW-SEEK RAW-CONTEXT RAW-MUX RAW-OPEN RAW-WRITE" tests="$tests RAW-UNLINK RAW-READ RAW-CLOSE RAW-IOCTL RAW-CHKPATH RAW-RENAME" tests="$tests RAW-EAS RAW-STREAMS RAW-OPLOCK RAW-NOTIFY BASE-DELAYWRITE" diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py deleted file mode 100755 index c4707b0886..0000000000 --- a/source4/selftest/tests.py +++ /dev/null @@ -1,433 +0,0 @@ -#!/usr/bin/python -# This script generates a list of testsuites that should be run as part of -# the Samba 4 test suite. - -# The output of this script is parsed by selftest.pl, which then decides -# which of the tests to actually run. It will, for example, skip all tests -# listed in selftest/skip or only run a subset during "make quicktest". - -# The idea is that this script outputs all of the tests of Samba 4, not -# just those that are known to pass, and list those that should be skipped -# or are known to fail in selftest/skip or selftest/knownfail. This makes it -# very easy to see what functionality is still missing in Samba 4 and makes -# it possible to run the testsuite against other servers, such as Samba 3 or -# Windows that have a different set of features. - -# The syntax for a testsuite is "-- TEST --" on a single line, followed -# by the name of the test, the environment it needs and the command to run, all -# three separated by newlines. All other lines in the output are considered -# comments. - -import os, sys -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../selftest")) -from selftesthelpers import * -import subprocess - -samba4srcdir = source4dir() -samba4bindir = bindir() -smb4torture = binpath("smbtorture") -smb4torture_testsuite_list = subprocess.Popen([smb4torture, "--list-suites"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate("")[0].splitlines() -validate = os.getenv("VALIDATE", "") -if validate: - validate_list = [validate] -else: - validate_list = [] - -def plansmbtorturetestsuite(name, env, options): - modname = "samba4.%s" % name - cmdline = "%s $LISTOPT %s %s" % (valgrindify(smb4torture), options, name) - plantestsuite_loadlist(modname, env, cmdline) - -def smb4torture_testsuites(prefix): - return filter(lambda x: x.startswith(prefix), smb4torture_testsuite_list) - -subprocess.call([smb4torture, "-V"]) - -bbdir = os.path.join(srcdir(), "testprogs/blackbox") - -configuration = "--configfile=$SMB_CONF_PATH" - -torture_options = [configuration, "--maximum-runtime=$SELFTEST_MAXTIME", "--target=$SELFTEST_TARGET", "--basedir=$SELFTEST_TMPDIR"] -if not os.getenv("SELFTEST_VERBOSE"): - torture_options.append("--option=torture:progress=no") -torture_options.append("--format=subunit") -if os.getenv("SELFTEST_QUICK"): - torture_options.append("--option=torture:quick=yes") -smb4torture += " " + " ".join(torture_options) - -print "OPTIONS %s" % " ".join(torture_options) - -# Simple tests for LDAP and CLDAP -for options in ['-U"$USERNAME%$PASSWORD" --option=socket:testnonblock=true', '-U"$USERNAME%$PASSWORD"', '-U"$USERNAME%$PASSWORD" -k yes', '-U"$USERNAME%$PASSWORD" -k no', '-U"$USERNAME%$PASSWORD" -k no --sign', '-U"$USERNAME%$PASSWORD" -k no --encrypt', '-U"$USERNAME%$PASSWORD" -k yes --encrypt', '-U"$USERNAME%$PASSWORD" -k yes --sign']: - plantestsuite("samba4.ldb.ldap with options %s(dc)" % options, "dc", "%s/test_ldb.sh ldap $SERVER %s" % (bbdir, options)) - -# see if we support ldaps -try: - config_h = os.environ["CONFIG_H"] -except KeyError: - config_h = os.path.join(samba4bindir, "default/source4/include/config.h") -f = open(config_h, 'r') -try: - have_tls_support = ("ENABLE_GNUTLS 1" in f.read()) -finally: - f.close() - -if have_tls_support: - for options in ['-U"$USERNAME%$PASSWORD"']: - plantestsuite("samba4.ldb.ldaps with options %s(dc)" % options, "dc", - "%s/test_ldb.sh ldaps $SERVER_IP %s" % (bbdir, options)) - -for options in ['-U"$USERNAME%$PASSWORD"']: - plantestsuite("samba4.ldb.ldapi with options %s(dc:local)" % options, "dc:local", - "%s/test_ldb.sh ldapi $PREFIX_ABS/dc/private/ldapi %s" % (bbdir, options)) - -for t in smb4torture_testsuites("ldap."): - plansmbtorturetestsuite(t, "dc", '-U"$USERNAME%$PASSWORD" //$SERVER_IP/_none_') - -ldbdir = os.path.join(samba4srcdir, "lib/ldb") -# Don't run LDB tests when using system ldb, as we won't have ldbtest installed -if os.path.exists(os.path.join(samba4bindir, "ldbtest")): - plantestsuite("ldb.base", "none", "%s/tests/test-tdb.sh" % ldbdir, - allow_empty_output=True) -else: - skiptestsuite("ldb.base", "Using system LDB, ldbtest not available") - -# Tests for RPC - -# add tests to this list as they start passing, so we test -# that they stay passing -ncacn_np_tests = ["rpc.schannel", "rpc.join", "rpc.lsa", "rpc.dssetup", "rpc.altercontext", "rpc.multibind", "rpc.netlogon", "rpc.handles", "rpc.samsync", "rpc.samba3-sessionkey", "rpc.samba3-getusername", "rpc.samba3-lsa", "rpc.samba3-bind", "rpc.samba3-netlogon", "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"] -drs_rpc_tests = smb4torture_testsuites("drs.rpc") -ncacn_ip_tcp_tests = ["rpc.schannel", "rpc.join", "rpc.lsa", "rpc.dssetup", "rpc.altercontext", "rpc.multibind", "rpc.netlogon", "rpc.handles", "rpc.asyncbind", "rpc.lsalookup", "rpc.lsa-getuser", "rpc.schannel2", "rpc.authcontext", "rpc.objectuuid"] + drs_rpc_tests -slow_ncacn_np_tests = ["rpc.samlogon", "rpc.samr.users", "rpc.samr.large-dc", "rpc.samr.users.privileges", "rpc.samr.passwords", "rpc.samr.passwords.pwdlastset"] -slow_ncacn_ip_tcp_tests = ["rpc.samr", "rpc.cracknames"] - -all_rpc_tests = ncalrpc_tests + ncacn_np_tests + ncacn_ip_tcp_tests + slow_ncacn_np_tests + slow_ncacn_ip_tcp_tests + ["rpc.lsa.secrets", "rpc.pac", "rpc.samba3-sharesec", "rpc.countcalls"] - -# Make sure all tests get run -rpc_tests = smb4torture_testsuites("rpc.") -auto_rpc_tests = filter(lambda t: t not in all_rpc_tests, rpc_tests) - -for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]: - for transport in ["ncalrpc", "ncacn_np", "ncacn_ip_tcp"]: - env = "dc" - if transport == "ncalrpc": - tests = ncalrpc_tests - env = "dc:local" - elif transport == "ncacn_np": - tests = ncacn_np_tests - elif transport == "ncacn_ip_tcp": - tests = ncacn_ip_tcp_tests - for t in tests: - plantestsuite_loadlist("samba4.%s on %s with %s" % (t, transport, bindoptions), env, [valgrindify(smb4torture), "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t]) - plantestsuite_loadlist("samba4.rpc.samba3.sharesec on %s with %s" % (transport, bindoptions), env, [valgrindify(smb4torture), "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=torture:share=tmp', 'rpc.samba3-sharesec']) - -for bindoptions in [""] + validate_list + ["bigendian"]: - for t in auto_rpc_tests: - plantestsuite_loadlist("samba4.%s with %s" % (t, bindoptions), "dc", [valgrindify(smb4torture), "$LISTOPT", "$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t]) - -t = "rpc.countcalls" -plantestsuite_loadlist("samba4.%s" % t, "dc:local", [valgrindify(smb4torture), "$LISTOPT", "$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t]) - -for transport in ["ncacn_np", "ncacn_ip_tcp"]: - env = "dc" - if transport == "ncacn_np": - tests = slow_ncacn_np_tests - elif transport == "ncacn_ip_tcp": - tests = slow_ncacn_ip_tcp_tests - for t in tests: - plantestsuite_loadlist("samba4.%s on %s" % (t, transport), env, [valgrindify(smb4torture), "$LISTOPT", "%s:$SERVER" % transport, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t]) - -# Tests for the DFS referral calls implementation -for t in smb4torture_testsuites("dfs."): - plansmbtorturetestsuite(t, "dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD') - -# Tests for the NET API (net.api.become.dc tested below against all the roles) -net_tests = filter(lambda x: "net.api.become.dc" not in x, smb4torture_testsuites("net.")) -for t in net_tests: - plansmbtorturetestsuite(t, "dc", '$SERVER[%s] -U$USERNAME%%$PASSWORD -W $DOMAIN' % validate) - -# Tests for session keys and encryption of RPC pipes -# FIXME: Integrate these into a single smbtorture test - -transport = "ncacn_np" -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", - "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=no", - "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes", - "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=no", - "-k no --option=usespnego=yes --option=clientntlmv2auth=yes", - "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no", - "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes", - "-k no --option=usespnego=no --option=clientntlmv2auth=yes", - "-k no --option=gensec:spnego=no --option=clientntlmv2auth=yes", - "-k no --option=usespnego=no"]: - name = "rpc.lsa.secrets on %s with with %s" % (transport, ntlmoptions) - plantestsuite_loadlist("samba4.%s" % name, "dc", [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport), ntlmoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME', 'rpc.lsa.secrets']) - -transports = ["ncacn_np", "ncacn_ip_tcp"] - -#Kerberos varies between functional levels, so it is important to check this on all of them -for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]: - transport = "ncacn_np" - plantestsuite_loadlist("samba4.rpc.pac on %s" % (transport,), env, [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport, ), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.pac']) - for transport in transports: - plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos" % (transport,), env, [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME', 'rpc.lsa.secrets']) - plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use target principal" % (transport,), env, [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', "--option=clientusespnegoprincipal=yes", '--option=gensec:target_hostname=$NETBIOSNAME', 'rpc.lsa.secrets']) - plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login" % transport, env, [smb4torture, "$LISTOPT", "%s:$SERVER" % transport, '-k', 'yes', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', "--option=gensec:fake_gssapi_krb5=yes", '--option=gensec:gssapi_krb5=no', '--option=gensec:target_hostname=$NETBIOSNAME', "rpc.lsa.secrets.none*"]) - plantestsuite_loadlist("samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login, use target principal" % transport, env, [smb4torture, "$LISTOPT", "%s:$SERVER" % transport, '-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.lsa.secrets.none*"]) - plantestsuite_loadlist("samba4.rpc.echo on %s" % (transport, ), env, [smb4torture, "$LISTOPT", "%s:$SERVER[]" % (transport,), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.echo']) - - # Echo tests test bulk Kerberos encryption of DCE/RPC - for bindoptions in ["connect", "spnego", "spnego,sign", "spnego,seal"] + validate_list + ["padcheck", "bigendian", "bigendian,seal"]: - echooptions = "--option=socket:testnonblock=True --option=torture:quick=yes -k yes" - plantestsuite_loadlist("samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, echooptions), env, [smb4torture, "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), echooptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.echo']) - plansmbtorturetestsuite("net.api.become.dc", env, '$SERVER[%s] -U$USERNAME%%$PASSWORD -W $DOMAIN' % validate) - -for bindoptions in ["sign", "seal"]: - env = "dc" - plantestsuite_loadlist("samba4.rpc.backupkey with %s" % (bindoptions), env, [smb4torture, "$LISTOPT", "ncacn_np:$SERVER[%s]" % ( bindoptions), '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.backupkey']) - -for transport in transports: - for bindoptions in ["sign", "seal"]: - for ntlmoptions in [ - "--option=ntlmssp_client:ntlm2=yes --option=torture:quick=yes", - "--option=ntlmssp_client:ntlm2=no --option=torture:quick=yes", - "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:128bit=no --option=torture:quick=yes", - "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:128bit=no --option=torture:quick=yes", - "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes", - "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes", - "--option=clientntlmv2auth=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes", - "--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"]: - if transport == "ncalrpc": - env = "dc:local" - else: - env = "dc" - plantestsuite_loadlist("samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, ntlmoptions), env, [smb4torture, "$LISTOPT", "%s:$SERVER[%s]" % (transport, bindoptions), ntlmoptions, '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.echo']) - -plantestsuite_loadlist("samba4.rpc.echo on ncacn_np over smb2", "dc", [smb4torture, "$LISTOPT", 'ncacn_np:$SERVER[smb2]', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'rpc.echo']) - -plantestsuite_loadlist("samba4.ntp.signd", "dc:local", [smb4torture, "$LISTOPT", 'ncacn_np:$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', 'ntp.signd']) - -# Tests against the NTVFS POSIX backend -ntvfsargs = ["--option=torture:sharedelay=10000", "--option=torture:oplocktimeout=3", "--option=torture:writetimeupdatedelay=50000"] - -smb2 = smb4torture_testsuites("smb2.") -#The QFILEINFO-IPC test needs to be on ipc$ -raw = filter(lambda x: "raw.qfileinfo.ipc" not in x, smb4torture_testsuites("raw.")) -base = smb4torture_testsuites("base.") - -for t in base + raw + smb2: - plansmbtorturetestsuite(t, "dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD' + " " + " ".join(ntvfsargs)) - -plansmbtorturetestsuite("raw.qfileinfo.ipc", "dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD') - -for t in smb4torture_testsuites("rap."): - plansmbtorturetestsuite(t, "dc", '//$SERVER/IPC\$ -U$USERNAME%$PASSWORD') - -# Tests against the NTVFS CIFS backend -for t in base + raw: - plantestsuite_loadlist("samba4.ntvfs.cifs.%s" % t, "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/cifs', '-U$USERNAME%$PASSWORD'] + ntvfsargs + [t]) - -plansmbtorturetestsuite('echo.udp', 'dc:local', '//$SERVER/whatever') - -# Local tests -for t in smb4torture_testsuites("local."): - plansmbtorturetestsuite(t, "none", "ncalrpc:") - -tdbtorture4 = binpath("tdbtorture") -if os.path.exists(tdbtorture4): - plantestsuite("tdb.stress", "none", valgrindify(tdbtorture4)) -else: - skiptestsuite("tdb.stress", "Using system TDB, tdbtorture not available") - -plansmbtorturetestsuite("drs.unit", "none", "ncalrpc:") - -# Pidl tests -for f in sorted(os.listdir(os.path.join(samba4srcdir, "../pidl/tests"))): - if f.endswith(".pl"): - planperltestsuite("pidl.%s" % f[:-3], os.path.normpath(os.path.join(samba4srcdir, "../pidl/tests", f))) -planperltestsuite("selftest.samba4", os.path.normpath(os.path.join(samba4srcdir, "../selftest/test_samba4.pl"))) - -# Blackbox Tests: -# tests that interact directly with the command-line tools rather than using -# the API. These mainly test that the various command-line options of commands -# work correctly. - -planpythontestsuite("none", "samba.tests.blackbox.ndrdump") -plantestsuite("samba4.blackbox.samba_tool(dc:local)", "dc:local", [os.path.join(samba4srcdir, "utils/tests/test_samba_tool.sh"), '$SERVER', "$USERNAME", "$PASSWORD", "$DOMAIN"]) -plantestsuite("samba4.blackbox.pkinit(dc:local)", "dc:local", [os.path.join(bbdir, "test_pkinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", configuration]) -plantestsuite("samba4.blackbox.kinit(dc:local)", "dc:local", [os.path.join(bbdir, "test_kinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", configuration]) -plantestsuite("samba4.blackbox.kinit(fl2000dc:local)", "fl2000dc:local", [os.path.join(bbdir, "test_kinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "arcfour-hmac-md5", configuration]) -plantestsuite("samba4.blackbox.kinit(fl2008r2dc:local)", "fl2008r2dc:local", [os.path.join(bbdir, "test_kinit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", configuration]) -plantestsuite("samba4.blackbox.ktpass(dc)", "dc", [os.path.join(bbdir, "test_ktpass.sh"), '$PREFIX']) -plantestsuite("samba4.blackbox.passwords(dc:local)", "dc:local", [os.path.join(bbdir, "test_passwords.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', "$PREFIX"]) -plantestsuite("samba4.blackbox.export.keytab(dc:local)", "dc:local", [os.path.join(bbdir, "test_export_keytab.sh"), '$SERVER', '$USERNAME', '$REALM', '$DOMAIN', "$PREFIX"]) -plantestsuite("samba4.blackbox.cifsdd(dc)", "dc", [os.path.join(samba4srcdir, "client/tests/test_cifsdd.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "$DOMAIN"]) -plantestsuite("samba4.blackbox.nmblookup(dc)", "dc", [os.path.join(samba4srcdir, "utils/tests/test_nmblookup.sh"), '$NETBIOSNAME', '$NETBIOSALIAS', '$SERVER', '$SERVER_IP']) -plantestsuite("samba4.blackbox.nmblookup(member)", "member", [os.path.join(samba4srcdir, "utils/tests/test_nmblookup.sh"), '$NETBIOSNAME', '$NETBIOSALIAS', '$SERVER', '$SERVER_IP']) -plantestsuite("samba4.blackbox.locktest(dc)", "dc", [os.path.join(samba4srcdir, "torture/tests/test_locktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX']) -plantestsuite("samba4.blackbox.masktest", "dc", [os.path.join(samba4srcdir, "torture/tests/test_masktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX']) -plantestsuite("samba4.blackbox.gentest(dc)", "dc", [os.path.join(samba4srcdir, "torture/tests/test_gentest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', "$PREFIX"]) -plantestsuite("samba4.blackbox.wbinfo(dc:local)", "dc:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$USERNAME', '$PASSWORD', "dc"]) -plantestsuite("samba4.blackbox.wbinfo(member:local)", "member:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', "member"]) -plantestsuite("samba4.blackbox.chgdcpass(dc)", "dc", [os.path.join(bbdir, "test_chgdcpass.sh"), '$SERVER', "LOCALDC\$", '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", '$SELFTEST_PREFIX/dc']) - -# Tests using the "Simple" NTVFS backend -for t in ["base.rw1"]: - plantestsuite_loadlist("samba4.ntvfs.simple.%s" % t, "dc", [valgrindify(smb4torture), "$LISTOPT", "//$SERVER/simple", '-U$USERNAME%$PASSWORD', t]) - -# Domain Member Tests -plantestsuite_loadlist("samba4.rpc.echo against member server with local creds", "member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', 'rpc.echo']) -plantestsuite_loadlist("samba4.rpc.echo against member server with domain creds", "member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD', 'rpc.echo']) -plantestsuite_loadlist("samba4.rpc.samr against member server with local creds", "member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "rpc.samr"]) -plantestsuite_loadlist("samba4.rpc.samr.users against member server with local creds", "member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "rpc.samr.users"]) -plantestsuite_loadlist("samba4.rpc.samr.passwords against member server with local creds", "member", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD', "rpc.samr.passwords"]) -plantestsuite("samba4.blackbox.smbclient against member server with local creds", "member", [os.path.join(samba4srcdir, "client/tests/test_smbclient.sh"), '$NETBIOSNAME', '$USERNAME', '$PASSWORD', '$NETBIOSNAME', '$PREFIX']) - -# RPC Proxy -plantestsuite_loadlist("samba4.rpc.echo against rpc proxy with domain creds", "rpc_proxy", [valgrindify(smb4torture), "$LISTOPT", 'ncacn_ip_tcp:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD', "rpc.echo"]) - -# Tests SMB signing -for mech in [ - "-k no", - "-k no --option=usespnego=no", - "-k no --option=gensec:spengo=no", - "-k yes", - "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"]: - for signing in ["--signing=on", "--signing=required"]: - signoptions = "%s %s" % (mech, signing) - name = "smb.signing on with %s" % signoptions - plantestsuite_loadlist("samba4.%s" % name, "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$USERNAME%$PASSWORD', 'base.xcopy']) - -for mech in [ - "-k no", - "-k no --option=usespnego=no", - "-k no --option=gensec:spengo=no", - "-k yes", - "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"]: - signoptions = "%s --signing=off" % mech - name = "smb.signing on with %s" % signoptions - plantestsuite_loadlist("samba4.%s domain-creds" % name, "member", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$DC_USERNAME%$DC_PASSWORD', 'base.xcopy']) - -for mech in [ - "-k no", - "-k no --option=usespnego=no", - "-k no --option=gensec:spengo=no"]: - signoptions = "%s --signing=off" % mech - name = "smb.signing on with %s" % signoptions - plantestsuite_loadlist("samba4.%s local-creds" % name, "member", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', signoptions, '-U$NETBIOSNAME/$USERNAME%$PASSWORD', 'base.xcopy']) -plantestsuite_loadlist("samba4.smb.signing --signing=yes anon", "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=yes', '-U%', 'base.xcopy']) -plantestsuite_loadlist("samba4.smb.signing --signing=required anon", "dc", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=required', '-U%', 'base.xcopy']) -plantestsuite_loadlist("samba4.smb.signing --signing=no anon", "member", [valgrindify(smb4torture), "$LISTOPT", '//$NETBIOSNAME/tmp', '-k', 'no', '--signing=no', '-U%', 'base.xcopy']) - -nbt_tests = smb4torture_testsuites("nbt.") -for t in nbt_tests: - plansmbtorturetestsuite(t, "dc", "//$SERVER/_none_ -U\"$USERNAME%$PASSWORD\"") - -wb_opts = ["--option=\"torture:strict mode=no\"", "--option=\"torture:timelimit=1\"", "--option=\"torture:winbindd_separator=/\"", "--option=\"torture:winbindd_netbios_name=$SERVER\"", "--option=\"torture:winbindd_netbios_domain=$DOMAIN\""] - -winbind_struct_tests = smb4torture_testsuites("winbind.struct") -winbind_ndr_tests = smb4torture_testsuites("winbind.ndr") -for env in ["dc", "member"]: - for t in winbind_struct_tests: - plansmbtorturetestsuite(t, env, "%s //_none_/_none_" % " ".join(wb_opts)) - - for t in winbind_ndr_tests: - plansmbtorturetestsuite(t, env, "%s //_none_/_none_" % " ".join(wb_opts)) - -nsstest4 = binpath("nsstest") -if os.path.exists(nsstest4): - plantestsuite("samba4.nss.test using winbind(member)", "member", [valgrindify(nsstest4), os.path.join(samba4bindir, "shared/libnss_winbind.so")]) -else: - skiptestsuite("samba4.nss.test using winbind(member)", "nsstest not available") - -subunitrun = valgrindify(python) + " " + os.path.join(samba4srcdir, "scripting/bin/subunitrun") -def plansambapythontestsuite(name, env, path, module, environ={}, extra_args=[]): - environ = dict(environ) - environ["PYTHONPATH"] = "$PYTHONPATH:" + path - args = ["%s=%s" % item for item in environ.iteritems()] - args += [subunitrun, "$LISTOPT", module] - args += extra_args - plantestsuite(name, env, args) - - -plansambapythontestsuite("ldb.python", "none", "%s/lib/ldb/tests/python/" % samba4srcdir, 'api') -planpythontestsuite("none", "samba.tests.credentials") -plantestsuite_idlist("samba.tests.gensec", "dc:local", [subunitrun, "$LISTOPT", '-U"$USERNAME%$PASSWORD"', "samba.tests.gensec"]) -planpythontestsuite("none", "samba.tests.registry") -plansambapythontestsuite("tdb.python", "none", "%s/lib/tdb/python/tests" % srcdir(), 'simple') -planpythontestsuite("none", "samba.tests.auth") -planpythontestsuite("none", "samba.tests.security") -planpythontestsuite("none", "samba.tests.dcerpc.misc") -planpythontestsuite("none", "samba.tests.param") -planpythontestsuite("none", "samba.tests.upgrade") -planpythontestsuite("none", "samba.tests.core") -planpythontestsuite("none", "samba.tests.provision") -planpythontestsuite("none", "samba.tests.samba3") -planpythontestsuite("dc:local", "samba.tests.dcerpc.sam") -planpythontestsuite("dc:local", "samba.tests.dsdb") -planpythontestsuite("none", "samba.tests.netcmd") -planpythontestsuite("dc:local", "samba.tests.dcerpc.bare") -planpythontestsuite("dc:local", "samba.tests.dcerpc.unix") -planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc") -planpythontestsuite("none", "samba.tests.samdb") -planpythontestsuite("none", "samba.tests.hostconfig") -planpythontestsuite("none", "samba.tests.messaging") -planpythontestsuite("none", "samba.tests.samba3sam") -planpythontestsuite("none", "subunit") -planpythontestsuite("dc:local", "samba.tests.dcerpc.rpcecho") -plantestsuite_idlist("samba.tests.dcerpc.registry", "dc:local", [subunitrun, "$LISTOPT", '-U"$USERNAME%$PASSWORD"', "samba.tests.dcerpc.registry"]) -plantestsuite("samba4.ldap.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN']) -plantestsuite("samba4.tokengroups.python(dc)", "dc:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN']) -plantestsuite("samba4.sam.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN']) -plansambapythontestsuite("samba4.schemaInfo.python(dc)", "dc", os.path.join(samba4srcdir, 'dsdb/tests/python'), 'dsdb_schema_info', extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"']) -plantestsuite("samba4.urgent_replication.python(dc)", "dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/dc/private/sam.ldb'], allow_empty_output=True) -for env in ["dc", "fl2000dc", "fl2003dc", "fl2008r2dc"]: - plantestsuite("samba4.ldap_schema.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap_schema.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN']) - plantestsuite("samba4.ldap.possibleInferiors.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/samdb/ldb_modules/tests/possibleinferiors.py"), "ldap://$SERVER", '-U"$USERNAME%$PASSWORD"', "-W", "$DOMAIN"]) - plantestsuite("samba4.ldap.secdesc.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/sec_descriptor.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN']) - plantestsuite("samba4.ldap.acl.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/acl.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN']) - if env != "fl2000dc": - # This test makes excessively use of the "userPassword" attribute which - # isn't available on DCs with Windows 2000 domain function level - - # therefore skip it in that configuration - plantestsuite("samba4.ldap.passwords.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/passwords.py"), "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W", "$DOMAIN"]) -planpythontestsuite("dc:local", "samba.tests.upgradeprovisionneeddc") -planpythontestsuite("none", "samba.tests.upgradeprovision") -planpythontestsuite("none", "samba.tests.xattr") -planpythontestsuite("none", "samba.tests.ntacls") -plantestsuite("samba4.deletetest.python(dc)", "dc", ['PYTHONPATH="$PYTHONPATH:%s/lib/subunit/python:%s/lib/testtools"' % (srcdir(), srcdir()), - python, os.path.join(samba4srcdir, "dsdb/tests/python/deletetest.py"), - '$SERVER', '-U"$USERNAME%$PASSWORD"', '-W', '$DOMAIN']) -plansambapythontestsuite("samba4.policy.python", "none", "%s/lib/policy/tests/python" % samba4srcdir, 'bindings') -plantestsuite("samba4.blackbox.samba3dump", "none", [python, os.path.join(samba4srcdir, "scripting/bin/samba3dump"), os.path.join(samba4srcdir, "../testdata/samba3")], allow_empty_output=True) -plantestsuite("samba4.blackbox.upgrade", "none", ["rm -rf $PREFIX/upgrade;", python, os.path.join(samba4srcdir, "setup/upgrade_from_s3"), "--targetdir=$PREFIX/upgrade", os.path.normpath(os.path.join(samba4srcdir, "../testdata/samba3")), os.path.normpath(os.path.join(samba4srcdir, "../testdata/samba3/smb.conf"))], allow_empty_output=True) -plantestsuite("samba4.blackbox.provision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision.sh"), '$PREFIX/provision']) -plantestsuite("samba4.blackbox.upgradeprovision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_upgradeprovision.sh"), '$PREFIX/provision']) -plantestsuite("samba4.blackbox.setpassword.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_setpassword.sh"), '$PREFIX/provision']) -plantestsuite("samba4.blackbox.newuser.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_newuser.sh"), '$PREFIX/provision']) -plantestsuite("samba4.blackbox.group.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_group.sh"), '$PREFIX/provision']) -plantestsuite("samba4.blackbox.spn.py(dc:local)", "dc:local", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_spn.sh"), '$PREFIX/dc']) -plantestsuite("samba4.ldap.bind(dc)", "dc", [python, os.path.join(samba4srcdir, "auth/credentials/tests/bind.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"']) - -# DRS python tests -plansambapythontestsuite("samba4.blackbox.samba-tool.drs(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'scripting/python'), "samba.tests.blackbox.samba_tool_drs", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) -plansambapythontestsuite("samba4.drs.replica_sync.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "replica_sync", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) -plansambapythontestsuite("samba4.drs.delete_object.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "delete_object", environ={'DC1': '$DC_SERVER', 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) -plansambapythontestsuite("samba4.drs.fsmo.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "fsmo", environ={'DC1': "$DC_SERVER", 'DC2': "$VAMPIRE_DC_SERVER"}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) -plansambapythontestsuite("samba4.drs.repl_schema.python(vampire_dc)", "vampire_dc", os.path.join(samba4srcdir, 'torture/drs/python'), "repl_schema", environ={'DC1': "$DC_SERVER", 'DC2': '$VAMPIRE_DC_SERVER'}, extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) - -# This makes sure we test the rid allocation code -t = "rpc.samr.large-dc" -plantestsuite_loadlist("samba4.%s.one" % t, "vampire_dc", [valgrindify(smb4torture), "$LISTOPT", '$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t]) -plantestsuite_loadlist("samba4.%s.two" % t, "vampire_dc", [valgrindify(smb4torture), "$LISTOPT", '$SERVER', '-U$USERNAME%$PASSWORD', '-W', '$DOMAIN', t]) - -# some RODC testing -plantestsuite_loadlist("samba4.rpc.echo", "rodc", [smb4torture, "$LISTOPT", 'ncacn_np:$SERVER', "-k", "yes", '-U$USERNAME%$PASSWORD', '-W' '$DOMAIN', 'rpc.echo']) -plantestsuite_loadlist("samba4.rpc.echo", "rodc:local", [smb4torture, "$LISTOPT", 'ncacn_np:$SERVER', "-k", "yes", '-P', '-W' '$DOMAIN', 'rpc.echo']) -plantestsuite("samba4.blackbox.provision-backend.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision-backend.sh"), '$PREFIX/provision']) diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh new file mode 100755 index 0000000000..e145ea0e3b --- /dev/null +++ b/source4/selftest/tests.sh @@ -0,0 +1,468 @@ +#!/bin/sh +# This script generates a list of testsuites that should be run as part of +# the Samba 4 test suite. + +# The output of this script is parsed by selftest.pl, which then decides +# which of the tests to actually run. It will, for example, skip all tests +# listed in selftest/skip or only run a subset during "make quicktest". + +# The idea is that this script outputs all of the tests of Samba 4, not +# just those that are known to pass, and list those that should be skipped +# or are known to fail in selftest/skip or selftest/knownfail. This makes it +# very easy to see what functionality is still missing in Samba 4 and makes +# it possible to run the testsuite against other servers, such as Samba 3 or +# Windows that have a different set of features. + +# The syntax for a testsuite is "-- TEST --" on a single line, followed +# by the name of the test, the environment it needs and the command to run, all +# three separated by newlines. All other lines in the output are considered +# comments. + +if [ ! -n "$PERL" ] +then + PERL=perl +fi + +if [ ! -n "$PYTHON" ] +then + PYTHON=python +fi + +plantest() { + name=$1 + env=$2 + shift 2 + cmdline="$*" + echo "-- TEST --" + if [ "$env" = "none" ]; then + echo "samba4.$name" + else + echo "samba4.$name ($env)" + fi + echo $env + echo $cmdline +} + +skiptestsuite() { + name=$1 + reason=$2 + shift 2 + # FIXME: Report this using subunit, but re-adjust the testsuite count somehow + echo "skipping $name ($reason)" +} + +normalize_testname() { + name=$1 + shift 1 + echo $name | tr "A-Z-" "a-z." +} + +planperltest() { + name=$1 + env=$2 + shift 2 + cmdline="$*" + if $PERL -e 'eval require Test::More;' > /dev/null 2>&1; then + plantest "$name" "$env" $PERL $cmdline "|" $TAP2SUBUNIT + else + skiptestsuite "$name" "Test::More not available" + fi +} + +plansmbtorturetest() { + name=$1 + env=$2 + shift 2 + other_args="$*" + modname=`normalize_testname $name` + cmdline="$VALGRIND $smb4torture $other_args $name" + plantest "$modname" "$env" $cmdline +} + +samba4srcdir="`dirname $0`/.." +samba4bindir="$BUILDDIR/bin" +smb4torture="$samba4bindir/smbtorture${EXEEXT}" +if which tap2subunit 2>/dev/null; then + TAP2SUBUNIT=tap2subunit +else + TAP2SUBUNIT="$PERL $samba4srcdir/../lib/subunit/tap2subunit" +fi +$smb4torture -V + +bbdir=../testprogs/blackbox + +prefix_abs="$SELFTEST_PREFIX/s4client" +CONFIGURATION="--configfile=\$SMB_CONF_PATH" + +test -d "$prefix_abs" || mkdir "$prefix_abs" + +TORTURE_OPTIONS="" +TORTURE_OPTIONS="$TORTURE_OPTIONS $CONFIGURATION" +TORTURE_OPTIONS="$TORTURE_OPTIONS --maximum-runtime=$SELFTEST_MAXTIME" +TORTURE_OPTIONS="$TORTURE_OPTIONS --target=$SELFTEST_TARGET" +TORTURE_OPTIONS="$TORTURE_OPTIONS --basedir=$prefix_abs" +if [ -n "$SELFTEST_VERBOSE" ]; then + TORTURE_OPTIONS="$TORTURE_OPTIONS --option=torture:progress=no" +fi +TORTURE_OPTIONS="$TORTURE_OPTIONS --format=subunit" +if [ -n "$SELFTEST_QUICK" ]; then + TORTURE_OPTIONS="$TORTURE_OPTIONS --option=torture:quick=yes" +fi +smb4torture="$smb4torture $TORTURE_OPTIONS" + +echo "OPTIONS $TORTURE_OPTIONS" + +# Simple tests for LDAP and CLDAP + +for options in "" "--option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD --option=socket:testnonblock=true" "-U\$USERNAME%\$PASSWORD"; do + plantest "ldb.ldap with options $options" dc $bbdir/test_ldb.sh ldap \$SERVER_IP $options +done +# see if we support ldaps +if grep ENABLE_GNUTLS.1 include/config.h > /dev/null; then + for options in "" "-U\$USERNAME%\$PASSWORD"; do + plantest "ldb.ldaps with options $options" dc $bbdir/test_ldb.sh ldaps \$SERVER_IP $options + done +fi +plantest "ldb.ldapi with options $options" dc $bbdir/test_ldb.sh ldapi \$PREFIX_ABS/dc/private/ldapi $options +for t in `$smb4torture --list | grep "^LDAP-"` +do + 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 +# is now pretty well tested by the rest of the quick tests anyway +LDBDIR=$samba4srcdir/lib/ldb +export LDBDIR +# Don't run LDB tests when using system ldb, as we won't have ldbtest installed +if [ -f $samba4bindir/ldbtest ]; then + plantest "ldb" none TEST_DATA_PREFIX=\$PREFIX $LDBDIR/tests/test-tdb.sh +else + skiptestsuite "ldb" "Using system LDB, ldbtest not available" +fi + +# Tests for RPC + +# add tests to this list as they start passing, so we test +# that they stay passing +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 RPC-OBJECTUUID" +slow_ncacn_np_tests="RPC-SAMLOGON RPC-SAMR RPC-SAMR-USERS RPC-SAMR-LARGE-DC RPC-SAMR-USERS-PRIVILEGES RPC-SAMR-PASSWORDS RPC-SAMR-PASSWORDS-PWDLASTSET" +slow_ncalrpc_tests="RPC-SAMR RPC-SAMR-PASSWORDS" +slow_ncacn_ip_tcp_tests="RPC-SAMR RPC-SAMR-PASSWORDS RPC-CRACKNAMES" + +all_tests="$ncalrpc_tests $ncacn_np_tests $ncacn_ip_tcp_tests $slow_ncalrpc_tests $slow_ncacn_np_tests $slow_ncacn_ip_tcp_tests RPC-LSA-SECRETS RPC-SAMBA3-SHARESEC RPC-COUNTCALLS" + +# Make sure all tests get run +for t in `$smb4torture --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 + env="dc" + case $transport in + ncalrpc) tests=$ncalrpc_tests;env="dc:local" ;; + ncacn_np) tests=$ncacn_np_tests ;; + ncacn_ip_tcp) tests=$ncacn_ip_tcp_tests ;; + esac + for t in $tests; do + plantest "`normalize_testname $t` on $transport with $bindoptions" $env $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + done + plantest "rpc.samba3.sharesec on $transport with $bindoptions" $env $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 "`normalize_testname $t` with $bindoptions" dc $VALGRIND $smb4torture "\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + done +done + +t="RPC-COUNTCALLS" +plantest "`normalize_testname $t`" dc:local $VALGRIND $smb4torture "\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + +for bindoptions in connect $VALIDATE ; do + for transport in ncalrpc ncacn_np ncacn_ip_tcp; do + env="dc" + case $transport in + ncalrpc) tests=$slow_ncalrpc_tests; env="dc:local" ;; + ncacn_np) tests=$slow_ncacn_np_tests ;; + ncacn_ip_tcp) tests=$slow_ncacn_ip_tcp_tests ;; + esac + for t in $tests; do + plantest "`normalize_testname $t` on $transport with $bindoptions" $env $VALGRIND $smb4torture $transport:"\$SERVER[$bindoptions]" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN $t "$*" + done + done +done + + +# Tests for the NET API + +net=`$smb4torture --list | grep "^NET-"` + +for t in $net; do + plansmbtorturetest "$t" dc "\$SERVER[$VALIDATE]" -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" "$*" +done + +# Tests for session keys +# FIXME: Integrate these into a single smbtorture test + +bindoptions="" +transport="ncacn_np" +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" \ + "-k no --option=usespnego=yes --option=ntlmssp_client:56bit=no" \ + "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes" \ + "-k no --option=usespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=no" \ + "-k no --option=usespnego=yes --option=clientntlmv2auth=yes" \ + "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no" \ + "-k no --option=usespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes" \ + "-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.lsa.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-LSA-SECRETS "$*" +done +plantest "rpc.lsa.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-LSA-SECRETS "$*" +plantest "rpc.lsa.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-LSA-SECRETS "$*" +plantest "rpc.lsa.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-LSA-SECRETS-none*" "$*" +plantest "rpc.lsa.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-LSA-SECRETS-none*" "$*" + +# Echo tests +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 + env="dc" + if test x"$transport" = x"ncalrpc"; then + env="dc:local" + fi + plantest "rpc.echo on $transport with $bindoptions and $ntlmoptions" $env $smb4torture $transport:"\$SERVER[$bindoptions]" $ntlmoptions -U"\$USERNAME"%"\$PASSWORD" -W "\$DOMAIN" RPC-ECHO "$*" + done + done +done + +for transport in $transports; do + for bindoptions in sign seal; do + for ntlmoptions in \ + "--option=ntlmssp_client:ntlm2=yes --option=torture:quick=yes" \ + "--option=ntlmssp_client:ntlm2=no --option=torture:quick=yes" \ + "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:128bit=no --option=torture:quick=yes" \ + "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:128bit=no --option=torture:quick=yes" \ + "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \ + "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \ + "--option=clientntlmv2auth=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes" \ + "--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 + env="dc" + if test x"$transport" = x"ncalrpc"; then + env="dc:local" + fi + plantest "rpc.echo on $transport with $bindoptions and $ntlmoptions" $env $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 "ntp.signd" dc $smb4torture ncacn_np:"\$SERVER" -U"\$USERNAME"%"\$PASSWORD" -W \$DOMAIN NTP-SIGND "$*" --configfile=st/dc/etc/smb.conf + +# Tests against the NTVFS POSIX backend +NTVFSARGS="" +NTVFSARGS="${NTVFSARGS} --option=torture:sharedelay=100000" +NTVFSARGS="${NTVFSARGS} --option=torture:oplocktimeout=3" +NTVFSARGS="${NTVFSARGS} --option=torture:writetimeupdatedelay=500000" + +smb2=`$smb4torture --list | grep "^SMB2-" | xargs` +#The QFILEINFO-IPC test needs to be on ipc$ +raw=`$smb4torture --list | grep "^RAW-" | grep -v "RAW-QFILEINFO-IPC"| xargs` +base=`$smb4torture --list | grep "^BASE-" | xargs` + +for t in $base $raw $smb2; do + plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $NTVFSARGS +done + +plansmbtorturetest "RAW-QFILEINFO-IPC" dc $ADDARGS //\$SERVER/ipc$ -U"\$USERNAME"%"\$PASSWORD" + +rap=`$smb4torture --list | grep "^RAP-" | xargs` +for t in $rap; do + 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.`normalize_testname $t`" dc $VALGRIND $smb4torture //\$NETBIOSNAME/cifs -U"\$USERNAME"%"\$PASSWORD" $NTVFSARGS $t +done + +# Local tests + +for t in `$smb4torture --list | grep "^LOCAL-" | xargs`; do + plansmbtorturetest "$t" none ncalrpc: "$*" +done + +tdbtorture4="$samba4bindir/tdbtorture${EXEEXT}" +if test -f $tdbtorture4 +then + plantest "tdb.stress" none $VALGRIND $tdbtorture4 +else + skiptestsuite "tdb.stress" "Using system TDB, tdbtorture not available" +fi + +# Pidl tests + +for f in $samba4srcdir/../pidl/tests/*.pl; do + planperltest "pidl.`basename $f .pl`" none $f +done +planperltest "selftest.samba4.pl" none $samba4srcdir/../selftest/test_samba4.pl + +# Blackbox Tests: +# tests that interact directly with the command-line tools rather than using +# the API. These mainly test that the various command-line options of commands +# work correctly. + +plantest "blackbox.ndrdump" none $samba4srcdir/librpc/tests/test_ndrdump.sh +plantest "blackbox.net" dc $samba4srcdir/utils/tests/test_net.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" +plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" $CONFIGURATION +plantest "blackbox.passwords" dc $bbdir/test_passwords.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" --configfile=st/dc/etc/smb.conf +plantest "blackbox.export.keytab" dc $bbdir/test_export_keytab.sh "\$SERVER" "\$USERNAME" "\$REALM" "\$DOMAIN" "$PREFIX" --configfile=st/dc/etc/smb.conf +plantest "blackbox.cifsdd" dc $samba4srcdir/client/tests/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" +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 $samba4srcdir/torture/tests/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.masktest" dc $samba4srcdir/torture/tests/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.gentest" dc $samba4srcdir/torture/tests/test_gentest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" +plantest "blackbox.wbinfo" dc:local $samba4srcdir/../nsswitch/tests/test_wbinfo.sh "\$DOMAIN" "\$USERNAME" "\$PASSWORD" "dc" +plantest "blackbox.wbinfo" member:local $samba4srcdir/../nsswitch/tests/test_wbinfo.sh "\$DOMAIN" "\$DC_USERNAME" "\$DC_PASSWORD" "member" + +# Tests using the "Simple" NTVFS backend + +for t in "BASE-RW1"; do + plantest "ntvfs.simple.`normalize_testname $t`" dc $VALGRIND $smb4torture $ADDARGS //\$SERVER/simple -U"\$USERNAME"%"\$PASSWORD" $t +done + +# 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 "blackbox.smbclient against member server with local creds" member $samba4srcdir/client/tests/test_smbclient.sh "\$NETBIOSNAME" "\$USERNAME" "\$PASSWORD" "\$NETBIOSNAME" "$PREFIX" + +# Tests SMB signing + +for mech in \ + "-k no" \ + "-k no --option=usespnego=no" \ + "-k no --option=gensec:spengo=no" \ + "-k yes" \ + "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"; do + for signing in \ + "--signing=on" \ + "--signing=required"; do + + signoptions="$mech $signing" + name="smb.signing on with $signoptions" + plantest "$name" dc $VALGRIND $smb4torture //"\$NETBIOSNAME"/tmp $signoptions -U"\$USERNAME"%"\$PASSWORD" BASE-XCOPY "$*" + done +done + +for mech in \ + "-k no" \ + "-k no --option=usespnego=no" \ + "-k no --option=gensec:spengo=no" \ + "-k yes" \ + "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"; do + signoptions="$mech --signing=off" + name="smb.signing on with $signoptions" + plantest "$name domain-creds" member $VALGRIND $smb4torture //"\$NETBIOSNAME"/tmp $signoptions -U"\$DC_USERNAME"%"\$DC_PASSWORD" BASE-XCOPY "$*" +done +for mech in \ + "-k no" \ + "-k no --option=usespnego=no" \ + "-k no --option=gensec:spengo=no"; do + signoptions="$mech --signing=off" + name="smb.signing on with $signoptions" + plantest "$name local-creds" member $VALGRIND $smb4torture //"\$NETBIOSNAME"/tmp $signoptions -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" BASE-XCOPY "$*" +done +plantest "smb.signing --signing=yes anon" dc $VALGRIND $smb4torture //"\$NETBIOSNAME"/tmp -k no --signing=yes -U% BASE-XCOPY "$*" +plantest "smb.signing --signing=required anon" dc $VALGRIND $smb4torture //"\$NETBIOSNAME"/tmp -k no --signing=required -U% BASE-XCOPY "$*" +plantest "smb.signing --signing=no anon" member $VALGRIND $smb4torture //"\$NETBIOSNAME"/tmp -k no --signing=no -U% BASE-XCOPY "$*" + +NBT_TESTS=`$smb4torture --list | grep "^NBT-" | xargs` + +for t in $NBT_TESTS; do + plansmbtorturetest "$t" dc //\$SERVER/_none_ -U\$USERNAME%\$PASSWORD +done + +WB_OPTS="--option=\"torture:strict mode=no\"" +WB_OPTS="${WB_OPTS} --option=\"torture:timelimit=1\"" +WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=/\"" +WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios name=\$SERVER\"" +WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios domain=\$DOMAIN\"" + +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 + plansmbtorturetest $t $env $WB_OPTS //_none_/_none_ + done + + for t in $WINBIND_NDR_TESTS; do + plansmbtorturetest $t $env $WB_OPTS //_none_/_none_ + done +done + +nsstest4="$samba4bindir/nsstest${EXEEXT}" +if test -f $nsstest4 +then + plantest "nss.test using winbind" member $VALGRIND $nsstest4 $samba4bindir/shared/libnss_winbind.so +fi + +SUBUNITRUN="$VALGRIND $PYTHON $samba4srcdir/scripting/bin/subunitrun" +plantest "ldb.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/lib/ldb/tests/python/" $SUBUNITRUN api +plantest "credentials.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/auth/credentials/tests" $SUBUNITRUN bindings +plantest "gensec.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/auth/gensec/tests" $SUBUNITRUN bindings +plantest "registry.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/lib/registry/tests/" $SUBUNITRUN bindings +plantest "tdb.python" none PYTHONPATH="$PYTHONPATH:../lib/tdb/python/tests" $SUBUNITRUN simple +plantest "auth.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/auth/tests/" $SUBUNITRUN bindings +plantest "security.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/libcli/security/tests" $SUBUNITRUN bindings +plantest "misc.python" none $SUBUNITRUN samba.tests.dcerpc.misc +plantest "param.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/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:local $SUBUNITRUN samba.tests.dcerpc.sam +plantest "dcerpc.bare.python" dc:local $SUBUNITRUN samba.tests.dcerpc.bare +plantest "unixinfo.python" dc:local $SUBUNITRUN samba.tests.dcerpc.unix +plantest "samdb.python" none $SUBUNITRUN samba.tests.samdb +plantest "shares.python" none $SUBUNITRUN samba.tests.shares +plantest "messaging.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/lib/messaging/tests" $SUBUNITRUN bindings +plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam +plantest "subunit.python" none $SUBUNITRUN subunit +plantest "rpcecho.python" dc:local $SUBUNITRUN samba.tests.dcerpc.rpcecho +plantest "winreg.python" dc:local $SUBUNITRUN -U\$USERNAME%\$PASSWORD samba.tests.dcerpc.registry +plantest "ldap.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "ldap.possibleInferiors.python" dc $PYTHON $samba4srcdir/dsdb/samdb/ldb_modules/tests/possibleinferiors.py $CONFIGURATION ldap://\$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "ldap.secdesc.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/sec_descriptor.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "blackbox.samba3dump" none $PYTHON $samba4srcdir/scripting/bin/samba3dump $samba4srcdir/../testdata/samba3 +rm -rf $PREFIX/upgrade +plantest "blackbox.upgrade" none $PYTHON $samba4srcdir/setup/upgrade $CONFIGURATION --targetdir=$PREFIX/upgrade $samba4srcdir/../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" +plantest "blackbox.provision-backend.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_provision-backend.sh "$PREFIX/provision" +plantest "blackbox.setpassword.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_setpassword.sh "$PREFIX/provision" +plantest "blackbox.newuser.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_newuser.sh "$PREFIX/provision" diff --git a/source4/selftest/win/wintest_raw.sh b/source4/selftest/win/wintest_raw.sh index d1bece2659..541e19829a 100755 --- a/source4/selftest/win/wintest_raw.sh +++ b/source4/selftest/win/wintest_raw.sh @@ -22,7 +22,7 @@ shift 4 export SMBTORTURE_REMOTE_HOST=$server -raw_tests="RAW-QFILEINFO RAW-SFILEINFO-BASE RAW-MKDIR RAW-SEEK RAW-OPEN RAW-WRITE RAW-UNLINK RAW-READ RAW-CLOSE RAW-IOCTL RAW-RENAME RAW-EAS RAW-STREAMS" +raw_tests="RAW-QFILEINFO RAW-SFILEINFO RAW-MKDIR RAW-SEEK RAW-OPEN RAW-WRITE RAW-UNLINK RAW-READ RAW-CLOSE RAW-IOCTL RAW-RENAME RAW-EAS RAW-STREAMS" # This test fails: RAW-QFSINFO all_errs=0 diff --git a/source4/selftest/wscript b/source4/selftest/wscript deleted file mode 100644 index e9c24b055f..0000000000 --- a/source4/selftest/wscript +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/env python -# vim: expandtab ft=python - -# selftest main code. - -import Scripting, os, Options, Utils, Environment, optparse, sys -from samba_utils import * -from samba_autoconf import * - -def set_options(opt): - - opt.add_option('--enable-selftest', - help=("enable options necessary for selftest (default=no)"), - action="store_true", dest='enable_selftest', default=False) - opt.add_option('--with-selftest-prefix', - help=("specify location of selftest directory (default=./st)"), - action="store", dest='SELFTEST_PREFIX', default='./st') - - opt.ADD_COMMAND('test', cmd_test) - opt.ADD_COMMAND('testonly', cmd_testonly) - - gr = opt.add_option_group('test options') - - gr.add_option('--load-list', - help=("Load a test id list from a text file"), - action="store", dest='LOAD_LIST', default=None) - gr.add_option('--list', - help=("List available tests"), - action="store_true", dest='LIST', default=False) - gr.add_option('--tests', - help=("wildcard pattern of tests to run"), - action="store", dest='TESTS', default='') - gr.add_option('--filtered-subunit', - help=("output (xfail) filtered subunit"), - action="store_true", dest='FILTERED_SUBUNIT', default=False) - gr.add_option('--quick', - help=("enable only quick tests"), - action="store_true", dest='QUICKTEST', default=False) - gr.add_option('--slow', - help=("enable the really slow tests"), - action="store_true", dest='SLOWTEST', default=False) - gr.add_option('--testenv', - help=("start a terminal with the test environment setup"), - action="store_true", dest='TESTENV', default=False) - gr.add_option('--valgrind', - help=("use valgrind on client programs in the tests"), - action="store_true", dest='VALGRIND', default=False) - gr.add_option('--valgrind-log', - help=("where to put the valgrind log"), - action="store", dest='VALGRINDLOG', default=None) - gr.add_option('--valgrind-server', - help=("use valgrind on the server in the tests (opens an xterm)"), - action="store_true", dest='VALGRIND_SERVER', default=False) - gr.add_option('--screen', - help=("run the samba servers in screen sessions"), - action="store_true", dest='SCREEN', default=False) - gr.add_option('--gdbtest', - help=("run the servers within a gdb window"), - action="store_true", dest='GDBTEST', default=False) - gr.add_option('--fail-immediately', - help=("stop tests on first failure"), - action="store_true", dest='FAIL_IMMEDIATELY', default=False) - gr.add_option('--socket-wrapper-pcap', - help=("create a pcap file for each failing test"), - action="store_true", dest='SOCKET_WRAPPER_PCAP', default=False) - gr.add_option('--socket-wrapper-keep-pcap', - help=("create a pcap file for all individual test"), - action="store_true", dest='SOCKET_WRAPPER_KEEP_PCAP', default=False) - -def configure(conf): - conf.env.SELFTEST_PREFIX = Options.options.SELFTEST_PREFIX - -def cmd_testonly(opt): - '''run tests without doing a build first''' - env = LOAD_ENVIRONMENT() - opt.env = env - - if (not CONFIG_SET(opt, 'NSS_WRAPPER') or - not CONFIG_SET(opt, 'UID_WRAPPER') or - not CONFIG_SET(opt, 'SOCKET_WRAPPER')): - print("ERROR: You must use --enable-selftest to enable selftest") - sys.exit(1) - - os.environ['SAMBA_SELFTEST'] = '1' - - env.TESTS = Options.options.TESTS - - env.SUBUNIT_FORMATTER = os.getenv('SUBUNIT_FORMATTER') - if not env.SUBUNIT_FORMATTER: - env.SUBUNIT_FORMATTER = '${PYTHON} -u ${srcdir}/selftest/format-subunit --prefix=${SELFTEST_PREFIX} --immediate' - env.FILTER_XFAIL = '${PYTHON} -u ${srcdir}/selftest/filter-subunit --expected-failures=${srcdir}/source4/selftest/knownfail' - - if Options.options.FAIL_IMMEDIATELY: - env.FILTER_XFAIL += ' --fail-immediately' - - env.FORMAT_TEST_OUTPUT = '${SUBUNIT_FORMATTER}' - - # clean any previous temporary files - os.system("rm -rf %s/tmp" % env.SELFTEST_PREFIX); - - # put all command line options in the environment as TESTENV_*=* - for o in dir(Options.options): - if o[0:1] != '_': - os.environ['TESTENV_%s' % o.upper()] = str(getattr(Options.options, o, '')) - - env.OPTIONS = '' - if not Options.options.SLOWTEST: - env.OPTIONS += ' --exclude=${srcdir}/source4/selftest/slow' - if Options.options.QUICKTEST: - env.OPTIONS += ' --quick --include=${srcdir}/source4/selftest/quick' - if Options.options.LOAD_LIST: - env.OPTIONS += ' --load-list=%s' % Options.options.LOAD_LIST - if Options.options.TESTENV: - env.OPTIONS += ' --testenv' - if Options.options.SOCKET_WRAPPER_PCAP: - env.OPTIONS += ' --socket-wrapper-pcap' - if Options.options.SOCKET_WRAPPER_KEEP_PCAP: - env.OPTIONS += ' --socket-wrapper-keep-pcap' - if Options.options.LIST: - env.OPTIONS += ' --list' - if os.environ.get('RUN_FROM_BUILD_FARM') is not None: - env.FILTER_OPTIONS = '${FILTER_XFAIL} --strip-passed-output' - else: - env.FILTER_OPTIONS = '${FILTER_XFAIL}' - - if Options.options.VALGRIND: - os.environ['VALGRIND'] = 'valgrind -q --num-callers=30' - if Options.options.VALGRINDLOG is not None: - os.environ['VALGRIND'] += ' --log-file=%s' % Options.options.VALGRINDLOG - - server_wrapper='' - - if Options.options.VALGRIND_SERVER: - server_wrapper = '${srcdir}/selftest/valgrind_run _DUMMY=X' - elif Options.options.GDBTEST: - server_wrapper = '${srcdir}/selftest/gdb_run _DUMMY=X' - - if Options.options.SCREEN: - server_wrapper = '${srcdir}/selftest/in_screen %s' % server_wrapper - os.environ['TERMINAL'] = EXPAND_VARIABLES(opt, '${srcdir}/selftest/in_screen') - elif server_wrapper != '': - server_wrapper = 'xterm -n server -l -e %s' % server_wrapper - - if server_wrapper != '': - os.environ['SAMBA_VALGRIND'] = EXPAND_VARIABLES(opt, server_wrapper) - - # this is needed for systems without rpath, or with rpath disabled - ADD_LD_LIBRARY_PATH('bin/shared') - ADD_LD_LIBRARY_PATH('bin/shared/private') - - # if we are using a system version of ldb then we need to tell it to - # load modules from our modules path - if env.USING_SYSTEM_LDB: - os.environ['LDB_MODULES_PATH'] = 'bin/modules/ldb' - - # tell build system where to find config.h - config_paths = [ 'bin/default/source4/include/config.h', - 'bin/default/include/config.h' ] - for p in config_paths: - if os.path.exists(p): - os.environ['CONFIG_H'] = p - break - - st_done = os.path.join(env.SELFTEST_PREFIX, 'st_done') - if os.path.exists(st_done): - os.unlink(st_done) - - if not os.path.isdir(env.SELFTEST_PREFIX): - os.makedirs(env.SELFTEST_PREFIX, int('755', 8)) - - # We use the full path rather than relative path because it cause problems on some plateforms (ie. solaris 8). - cmd = '(${PERL} ${srcdir}/selftest/selftest.pl --prefix=${SELFTEST_PREFIX} --builddir=. --srcdir=${srcdir} --exclude=${srcdir}/source4/selftest/skip --testlist="${PYTHON} ${srcdir}/source4/selftest/tests.py|" ${OPTIONS} --socket-wrapper ${TESTS} && touch ${SELFTEST_PREFIX}/st_done) | ${FILTER_OPTIONS} | tee ${SELFTEST_PREFIX}/subunit' - if os.environ.get('RUN_FROM_BUILD_FARM') is None and not Options.options.FILTERED_SUBUNIT: - cmd += ' | ${FORMAT_TEST_OUTPUT}' - else: - cmd += ' | ${PYTHON} -u ${srcdir}/selftest/filter-subunit' - cmd = EXPAND_VARIABLES(opt, cmd) - - print("test: running %s" % cmd) - ret = RUN_COMMAND(cmd, env=env) - if os.path.exists(".testrepository"): - # "testr load -q" isn't - cmd = 'testr load -q < ${SELFTEST_PREFIX}/subunit > /dev/null' - cmd = EXPAND_VARIABLES(opt, cmd) - RUN_COMMAND(cmd, env=env) - - if ret != 0: - print("ERROR: test failed with exit code %d" % ret) - sys.exit(ret) - - if not os.path.exists(st_done): - print("ERROR: test command failed to complete") - sys.exit(1) - - -######################################################################## -# main test entry point -def cmd_test(opt): - '''Run the test suite (see test options below)''' - Scripting.commands.append('build') - Scripting.commands.append('testonly') |