summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKirill Smelkov <kirr@mns.spb.ru>2009-10-21 21:18:57 +0400
committerKarolin Seeger <kseeger@samba.org>2009-12-21 10:55:13 +0100
commit37aa2b958cacba19d9149541765124708de8db03 (patch)
treea1f0a3e9d8a7180b1cf975845514109c4aafd562 /lib
parentbf980ca74b2b51322af266d74dd17c51d21521d9 (diff)
downloadsamba-37aa2b958cacba19d9149541765124708de8db03.tar.gz
tdb: add tests for double .close() in pytdb
The reason I do it is that when using older python-tdb as shipped in Debian Lenny, python interpreter crashes on this test: (gdb) bt #0 0xb7f8c424 in __kernel_vsyscall () #1 0xb7df5640 in raise () from /lib/i686/cmov/libc.so.6 #2 0xb7df7018 in abort () from /lib/i686/cmov/libc.so.6 #3 0xb7e3234d in __libc_message () from /lib/i686/cmov/libc.so.6 #4 0xb7e38624 in malloc_printerr () from /lib/i686/cmov/libc.so.6 #5 0xb7e3a826 in free () from /lib/i686/cmov/libc.so.6 #6 0xb7b39c84 in tdb_close () from /usr/lib/libtdb.so.1 #7 0xb7b43e14 in ?? () from /var/lib/python-support/python2.5/_tdb.so #8 0x0a038d08 in ?? () #9 0x00000000 in ?? () master's pytdb does not (we have a check for self->closed in obj_close()), but still... Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cherry picked from commit 71a21393dd1bb61bded82b1581ac6d5bd3b0153c) Signed-off-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit c739d4c1f56dd8e137123468d13c05f52eeab8b9)
Diffstat (limited to 'lib')
-rw-r--r--lib/tdb/python/tests/simple.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/tdb/python/tests/simple.py b/lib/tdb/python/tests/simple.py
index d242e665beb..c7443c0d433 100644
--- a/lib/tdb/python/tests/simple.py
+++ b/lib/tdb/python/tests/simple.py
@@ -15,6 +15,15 @@ class OpenTdbTests(TestCase):
def test_nonexistant_read(self):
self.assertRaises(IOError, tdb.Tdb, "/some/nonexistant/file", 0, tdb.DEFAULT, os.O_RDWR)
+class CloseTdbTests(TestCase):
+ def test_double_close(self):
+ self.tdb = tdb.Tdb(tempfile.mkstemp()[1], 0, tdb.DEFAULT, os.O_CREAT|os.O_RDWR)
+ self.assertNotEqual(None, self.tdb)
+
+ # ensure that double close does not crash python
+ self.tdb.close()
+ self.tdb.close()
+
class SimpleTdbTests(TestCase):
def setUp(self):