~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/selftest/tests.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# This script generates a list of testsuites that should be run as part of 
 
3
# the Samba 3 test suite.
 
4
 
 
5
# The output of this script is parsed by selftest.pl, which then decides 
 
6
# which of the tests to actually run. It will, for example, skip all tests 
 
7
# listed in selftest/skip or only run a subset during "make quicktest".
 
8
 
 
9
# The idea is that this script outputs all of the tests of Samba 3, not 
 
10
# just those that are known to pass, and list those that should be skipped 
 
11
# or are known to fail in selftest/skip or selftest/samba4-knownfail. This makes it 
 
12
# very easy to see what functionality is still missing in Samba 3 and makes 
 
13
# it possible to run the testsuite against other servers, such as Samba 4 or 
 
14
# Windows that have a different set of features.
 
15
 
 
16
# The syntax for a testsuite is "-- TEST --" on a single line, followed 
 
17
# by the name of the test, the environment it needs and the command to run, all 
 
18
# three separated by newlines. All other lines in the output are considered 
 
19
# comments.
 
20
 
 
21
import os, sys
 
22
sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(__file__), "../../selftest")))
 
23
from selftesthelpers import *
 
24
import subprocess
 
25
 
 
26
smb4torture = binpath("smbtorture4")
 
27
samba3srcdir = srcdir() + "/source3"
 
28
configuration = "--configfile=$SMB_CONF_PATH"
 
29
scriptdir=os.path.join(samba3srcdir, "../script/tests")
 
30
 
 
31
torture_options = [configuration, "--maximum-runtime=$SELFTEST_MAXTIME", 
 
32
                   "--target=$SELFTEST_TARGET", "--basedir=$SELFTEST_TMPDIR",
 
33
                   '--option="torture:winbindd_netbios_name=$SERVER"',
 
34
                   '--option="torture:winbindd_netbios_domain=$DOMAIN"', 
 
35
                   '--option=torture:sharedelay=100000']
 
36
 
 
37
if not os.getenv("SELFTEST_VERBOSE"):
 
38
    torture_options.append("--option=torture:progress=no")
 
39
torture_options.append("--format=subunit")
 
40
if os.getenv("SELFTEST_QUICK"):
 
41
    torture_options.append("--option=torture:quick=yes")
 
42
smb4torture += " " + " ".join(torture_options)
 
43
 
 
44
def plansmbtorturetestsuite(name, env, options, description=''):
 
45
    modname = "samba3.posix_s3.%s %s" % (name, description)
 
46
    cmdline = "%s $LISTOPT %s %s" % (valgrindify(smb4torture), options, name)
 
47
    plantestsuite_loadlist(modname, env, cmdline)
 
48
 
 
49
plantestsuite("samba3.blackbox.success", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_success.sh")])
 
50
plantestsuite("samba3.blackbox.failure", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_failure.sh")])
 
51
 
 
52
plantestsuite("samba3.local_s3", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_local_s3.sh")])
 
53
 
 
54
tests=[ "FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7", "LOCK9",
 
55
        "UNLINK", "BROWSE", "ATTR", "TRANS2", "TORTURE",
 
56
        "OPLOCK1", "OPLOCK2", "OPLOCK3", "OPLOCK4", "STREAMERROR",
 
57
        "DIR", "DIR1", "DIR-CREATETIME", "TCON", "TCONDEV", "RW1", "RW2", "RW3", "RW-SIGNING",
 
58
        "OPEN", "XCOPY", "RENAME", "DELETE", "DELETE-LN", "PROPERTIES", "W2K",
 
59
        "TCON2", "IOCTL", "CHKPATH", "FDSESS", "LOCAL-SUBSTITUTE", "CHAIN1",
 
60
        "GETADDRINFO", "POSIX", "UID-REGRESSION-TEST", "SHORTNAME-TEST",
 
61
        "LOCAL-BASE64", "LOCAL-GENCACHE", "POSIX-APPEND",
 
62
        "LOCAL-string_to_sid" ]
 
63
 
 
64
for t in tests:
 
65
    plantestsuite("samba3.smbtorture_s3.plain(dc).%s" % t, "s3dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', "", "-l $LOCAL_PATH"])
 
66
    plantestsuite("samba3.smbtorture_s3.crypt(dc).%s" % t, "s3dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/tmp', '$USERNAME', '$PASSWORD', "-e", "-l $LOCAL_PATH"])
 
67
 
 
68
tests=["--ping", "--separator",
 
69
       "--own-domain",
 
70
       "--all-domains",
 
71
       "--trusted-domains",
 
72
       "--domain-info=BUILTIN",
 
73
       "--domain-info=$DOMAIN",
 
74
       "--online-status",
 
75
       "--online-status --domain=BUILTIN",
 
76
       "--online-status --domain=$DOMAIN",
 
77
       "--check-secret --domain=$DOMAIN",
 
78
       "--change-secret --domain=$DOMAIN",
 
79
       "--check-secret --domain=$DOMAIN",
 
80
       "--online-status --domain=$DOMAIN",
 
81
       #Didn't pass yet# "--domain-users",
 
82
       "--domain-groups",
 
83
       "--name-to-sid=$USERNAME",
 
84
       "--name-to-sid=$DOMAIN\\\\$USERNAME",
 
85
     #Didn't pass yet# "--user-info=$USERNAME",
 
86
       "--user-groups=$DOMAIN\\\\$USERNAME",
 
87
       "--allocate-uid",
 
88
       "--allocate-gid"]
 
89
 
 
90
for t in tests:
 
91
    plantestsuite("samba3.wbinfo_s3.(s3dc:local).%s" % t, "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_wbinfo_s3.sh"), t])
 
92
    plantestsuite("samba3.wbinfo_s3.(member:local).%s" % t, "member:local", [os.path.join(samba3srcdir, "script/tests/test_wbinfo_s3.sh"), t])
 
93
 
 
94
plantestsuite(
 
95
    "samba3.wbinfo_sids2xids.(member:local)", "member:local",
 
96
    [os.path.join(samba3srcdir, "script/tests/test_wbinfo_sids2xids.sh")])
 
97
 
 
98
plantestsuite("samba3.ntlm_auth.(s3dc:local)", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_s3.sh"), valgrindify(python), samba3srcdir, configuration])
 
99
 
 
100
for env in ["s3dc", "member"]:
 
101
    plantestsuite("samba3.blackbox.smbclient_auth.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', configuration])
 
102
 
 
103
for env in ["secserver"]:
 
104
    plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) domain creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN\\\\$DC_USERNAME', '$DC_PASSWORD', configuration + " --option=clientntlmv2auth=no"])
 
105
 
 
106
for env in ["member"]:
 
107
    plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$SERVER\\\\$USERNAME', '$PASSWORD', configuration])
 
108
 
 
109
for env in ["secshare", "secserver"]:
 
110
    plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) local creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', configuration + " --option=clientntlmv2auth=no --option=clientlanmanauth=yes"])
 
111
 
 
112
# plain
 
113
for env in ["s3dc"]:
 
114
    plantestsuite("samba3.blackbox.smbclient_s3.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', configuration])
 
115
 
 
116
for env in ["member"]:
 
117
    plantestsuite("samba3.blackbox.smbclient_s3.plain (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER\\\\$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', configuration])
 
118
 
 
119
for env in ["s3dc"]:
 
120
    plantestsuite("samba3.blackbox.smbclient_s3.sign (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', configuration, "--signing=required"])
 
121
 
 
122
for env in ["member"]:
 
123
    plantestsuite("samba3.blackbox.smbclient_s3.sign (%s) member creds" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$SERVER\\\\$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', configuration, "--signing=required"])
 
124
 
 
125
# encrypted
 
126
for env in ["s3dc"]:
 
127
    plantestsuite("samba3.blackbox.smbclient_s3.crypt (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', configuration, "-e"])
 
128
 
 
129
#TODO encrypted against member, with member creds, and with DC creds
 
130
plantestsuite("samba3.blackbox.net.misc", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_misc.sh"),
 
131
                                                       scriptdir, "$SMB_CONF_PATH", configuration])
 
132
plantestsuite("samba3.blackbox.net.local.registry", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_registry.sh"),
 
133
                                                       scriptdir, "$SMB_CONF_PATH", configuration])
 
134
plantestsuite("samba3.blackbox.net.rpc.registry", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_registry.sh"),
 
135
                                                       scriptdir, "$SMB_CONF_PATH", configuration, 'rpc'])
 
136
 
 
137
plantestsuite("samba3.blackbox.net.local.registry.roundtrip", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_registry_roundtrip.sh"),
 
138
                                                       scriptdir, "$SMB_CONF_PATH", configuration])
 
139
plantestsuite("samba3.blackbox.testparm", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_testparm_s3.sh"),
 
140
                                                       "$LOCAL_PATH"])
 
141
 
 
142
plantestsuite(
 
143
    "samba3.pthreadpool", "s3dc",
 
144
    [os.path.join(samba3srcdir, "script/tests/test_pthreadpool.sh")])
 
145
 
 
146
#smbtorture4 tests
 
147
 
 
148
base = ["base.attr", "base.charset", "base.chkpath", "base.defer_open", "base.delaywrite", "base.delete",
 
149
        "base.deny1", "base.deny2", "base.deny3", "base.denydos", "base.dir1", "base.dir2",
 
150
        "base.disconnect", "base.fdpass", "base.lock",
 
151
        "base.mangle", "base.negnowait", "base.ntdeny1",
 
152
        "base.ntdeny2", "base.open", "base.openattr", "base.properties", "base.rename", "base.rw1",
 
153
        "base.secleak", "base.tcon", "base.tcondev", "base.trans2", "base.unlink", "base.vuid",
 
154
        "base.xcopy", "base.samba3error"]
 
155
 
 
156
raw = ["raw.acls", "raw.chkpath", "raw.close", "raw.composite", "raw.context", "raw.eas",
 
157
       "raw.ioctl", "raw.lock", "raw.mkdir", "raw.mux", "raw.notify", "raw.open", "raw.oplock"
 
158
       "raw.qfileinfo", "raw.qfsinfo", "raw.read", "raw.rename", "raw.search", "raw.seek",
 
159
       "raw.sfileinfo.base", "raw.sfileinfo.bug", "raw.streams", "raw.unlink", "raw.write",
 
160
       "raw.samba3hide", "raw.samba3badpath", "raw.sfileinfo.rename",
 
161
       "raw.samba3caseinsensitive", "raw.samba3posixtimedlock",
 
162
       "raw.samba3rootdirfid", "raw.sfileinfo.end-of-file"]
 
163
 
 
164
smb2 = ["smb2.lock", "smb2.read", "smb2.compound", "smb2.connect", "smb2.scan", "smb2.scanfind",
 
165
        "smb2.bench-oplock"]
 
166
 
 
167
rpc = ["rpc.authcontext", "rpc.samba3.bind", "rpc.samba3.srvsvc", "rpc.samba3.sharesec",
 
168
       "rpc.samba3.spoolss", "rpc.samba3.wkssvc", "rpc.samba3.winreg",
 
169
       "rpc.samba3.getaliasmembership-0",
 
170
       "rpc.samba3.netlogon", "rpc.samba3.sessionkey", "rpc.samba3.getusername",
 
171
       "rpc.svcctl", "rpc.ntsvcs", "rpc.winreg", "rpc.eventlog",
 
172
       "rpc.spoolss.printserver", "rpc.spoolss.win", "rpc.spoolss.notify", "rpc.spoolss.printer",
 
173
       "rpc.spoolss.driver",
 
174
       "rpc.lsa-getuser", "rpc.lsa.lookupsids", "rpc.lsa.lookupnames",
 
175
       "rpc.lsa.privileges", 
 
176
       "rpc.samr", "rpc.samr.users", "rpc.samr.users.privileges", "rpc.samr.passwords",
 
177
       "rpc.samr.passwords.pwdlastset", "rpc.samr.large-dc", "rpc.samr.machine.auth",
 
178
       "rpc.netlogon.admin",
 
179
       "rpc.schannel", "rpc.schannel2", "rpc.bench-schannel1", "rpc.join", "rpc.bind", "rpc.epmapper"]
 
180
 
 
181
local = ["local.nss-wrapper", "local.ndr"]
 
182
 
 
183
winbind = ["winbind.struct", "winbind.wbclient"]
 
184
 
 
185
rap = ["rap.basic", "rap.rpc", "rap.printing", "rap.sam"]
 
186
 
 
187
unix = ["unix.info2", "unix.whoami"]
 
188
 
 
189
nbt = ["nbt.dgram" ]
 
190
 
 
191
tests= base + raw + smb2 + rpc + unix + local + winbind + rap + nbt
 
192
 
 
193
sub = subprocess.Popen("%s --version 2> /dev/null" % smb4torture, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
 
194
sub.communicate("")
 
195
 
 
196
if sub.returncode == 0:
 
197
    for t in tests:
 
198
        if t == "base.delaywrite":
 
199
            plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --maximum-runtime=900')
 
200
        elif t == "unix.whoami":
 
201
            plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmpguest -U$USERNAME%$PASSWORD')
 
202
        elif t == "raw.samba3posixtimedlock":
 
203
            plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmpguest -U$USERNAME%$PASSWORD --option=torture:localdir=$SELFTEST_PREFIX/dc/share')
 
204
        else:
 
205
            plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
 
206
 
 
207
        if t == "raw.chkpath":
 
208
            plansmbtorturetestsuite(t, "s3dc", '//$SERVER_IP/tmpcase -U$USERNAME%$PASSWORD')
 
209
 
 
210
    test = 'rpc.lsa.lookupsids'
 
211
    auth_options = ["", "ntlm", "spnego" ]
 
212
    signseal_options = ["", ",connect", ",sign", ",seal"]
 
213
    smb_options = ["", ",smb2"]
 
214
    endianness_options = ["", ",bigendian"]
 
215
    for z in smb_options:
 
216
        for e in endianness_options:
 
217
            for a in auth_options:
 
218
                for s in signseal_options:
 
219
                    binding_string = "ncacn_np:$SERVER_IP[%s%s%s%s]" % (a, s, z, e)
 
220
                    options = binding_string + " -U$USERNAME%$PASSWORD"
 
221
                    plansmbtorturetestsuite(test, "s3dc", options, 'over ncacn_np with [%s%s%s%s] ' % (a, s, z, e))
 
222
    for e in endianness_options:
 
223
        for a in auth_options:
 
224
            for s in signseal_options:
 
225
                binding_string = "ncacn_ip_tcp:$SERVER_IP[%s%s%s]" % (a, s, e)
 
226
                options = binding_string + " -U$USERNAME%$PASSWORD"
 
227
                plansmbtorturetestsuite(test, "s3dc", options, 'over ncacn_ip_tcp with [%s%s%s] ' % (a, s, e))