summaryrefslogtreecommitdiffstats
path: root/test/functional/libgfapi-python-tests.py
diff options
context:
space:
mode:
authorThiago da Silva <thiago@redhat.com>2015-09-02 07:08:17 -0700
committerGerrit Code Review <review@dev.gluster.org>2015-09-02 07:08:18 -0700
commitf3acbc844a105d342a3133789f01eaf713a981d1 (patch)
treec36e9bcb31f36232b453131f7494dbb7d19b76d8 /test/functional/libgfapi-python-tests.py
parentc9fedc64081e1504a1bbf88be5a5dcfb9fff3652 (diff)
parentca456a770e835f829281dac85bd8c4f00b8624ff (diff)
Merge "Fix open/fopen in thread other than main"
Diffstat (limited to 'test/functional/libgfapi-python-tests.py')
-rw-r--r--test/functional/libgfapi-python-tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/libgfapi-python-tests.py b/test/functional/libgfapi-python-tests.py
index 13ae54d..87dbfe0 100644
--- a/test/functional/libgfapi-python-tests.py
+++ b/test/functional/libgfapi-python-tests.py
@@ -13,6 +13,7 @@ import unittest
import os
import types
import errno
+import threading
from gluster.gfapi import File, Volume
from gluster.exceptions import LibgfapiException
@@ -197,6 +198,17 @@ class FileOpsTest(unittest.TestCase):
f.lseek(0, os.SEEK_SET)
self.assertEqual(f.read(), data + "hello world")
+ def test_fopen_in_thread(self):
+ def gluster_fopen():
+ name = uuid4().hex
+ with self.vol.fopen(name, 'w') as f:
+ f.write('hello world')
+
+ # the following caused segfault before the fix
+ thread = threading.Thread(target=gluster_fopen)
+ thread.start()
+ thread.join()
+
def test_create_file_already_exists(self):
try:
f = File(self.vol.open("newfile", os.O_CREAT))