1 # Unix SMB/CIFS implementation.
2 # Copyright Volker Lendecke <vl@samba.org> 2012
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 """Tests for samba.samba3.libsmb_samba_internal."""
20 from samba
.samba3
import libsmb_samba_internal
21 from samba
.dcerpc
import security
22 from samba
.samba3
import param
as s3param
23 from samba
import credentials
30 class LibsmbTestCase(samba
.tests
.TestCase
):
32 class OpenClose(threading
.Thread
):
34 def __init__(self
, conn
, filename
, num_ops
):
35 threading
.Thread
.__init
__(self
)
37 self
.filename
= filename
38 self
.num_ops
= num_ops
44 for i
in range(self
.num_ops
):
45 f
= c
.create(self
.filename
, CreateDisposition
=3,
46 DesiredAccess
=security
.SEC_STD_DELETE
)
47 c
.delete_on_close(f
, True)
50 self
.exc
= sys
.exc_info()
52 def test_OpenClose(self
):
54 lp
= s3param
.get_context()
55 lp
.load(os
.getenv("SMB_CONF_PATH"))
57 creds
= credentials
.Credentials()
59 creds
.set_username(os
.getenv("USERNAME"))
60 creds
.set_password(os
.getenv("PASSWORD"))
62 c
= libsmb_samba_internal
.Conn(os
.getenv("SERVER_IP"), "tmp",
63 creds
, multi_threaded
=True)
68 t
= LibsmbTestCase
.OpenClose(c
, "test" + str(i
), 10)
77 raise t
.exc
[0](t
.exc
[1])
80 if __name__
== "__main__":