aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2018-11-18 17:11:13 +0000
committerNikolaus Rath <Nikolaus@rath.org>2018-11-24 20:51:34 +0000
commit68f177d238ca8dd7412b0ce30d86d03dfcdd78cf (patch)
tree1f27e43cf1d9af9e8ecd250fb2fafd7782e20c5e /test
parent0c73b8389aaea156e7544d984be95515b9743033 (diff)
downloadlibfuse-68f177d238ca8dd7412b0ce30d86d03dfcdd78cf.tar.gz
Kill filesystem process on test cleanup.
Diffstat (limited to 'test')
-rw-r--r--test/test_ctests.py2
-rwxr-xr-xtest/test_examples.py12
-rw-r--r--test/util.py7
3 files changed, 13 insertions, 8 deletions
diff --git a/test/test_ctests.py b/test/test_ctests.py
index fff2427..d2f8582 100644
--- a/test/test_ctests.py
+++ b/test/test_ctests.py
@@ -64,7 +64,7 @@ def test_notify1(tmpdir, name, notify):
else:
assert read1 == read2
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
diff --git a/test/test_examples.py b/test/test_examples.py
index caf5a08..de5a118 100755
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -76,7 +76,7 @@ def test_hello(tmpdir, name, options, cmdline_builder):
open(filename + 'does-not-exist', 'r+')
assert exc_info.value.errno == errno.ENOENT
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
@@ -147,7 +147,7 @@ def test_passthrough(tmpdir, name, debug, capfd, writeback):
syscall_test_cmd.append('-52')
subprocess.check_call(syscall_test_cmd)
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
@@ -177,7 +177,7 @@ def test_ioctl(tmpdir):
with open(testfile, 'rb') as fh:
assert fh.read()== b'foo'
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
@@ -193,7 +193,7 @@ def test_poll(tmpdir):
[ pjoin(basename, 'example', 'poll_client') ]
subprocess.check_call(cmdline, cwd=mnt_dir)
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
@@ -217,7 +217,7 @@ def test_null(tmpdir):
with open(mnt_file, 'wb') as fh:
fh.write(b'whatever')
except:
- cleanup(mnt_file)
+ cleanup(mount_process, mnt_file)
raise
else:
umount(mount_process, mnt_file)
@@ -253,7 +253,7 @@ def test_notify_inval_entry(tmpdir, notify):
with pytest.raises(FileNotFoundError):
os.stat(fname)
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
diff --git a/test/util.py b/test/util.py
index ba02b9f..8bef265 100644
--- a/test/util.py
+++ b/test/util.py
@@ -44,7 +44,7 @@ def wait_for_mount(mount_process, mnt_dir,
elapsed += 0.1
pytest.fail("mountpoint failed to come up")
-def cleanup(mnt_dir):
+def cleanup(mount_process, mnt_dir):
# Don't bother trying Valgrind if things already went wrong
if 'bsd' in sys.platform or 'dragonfly' in sys.platform:
@@ -54,6 +54,11 @@ def cleanup(mnt_dir):
'-z', '-u', mnt_dir]
subprocess.call(cmd, stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT)
+ mount_process.terminate()
+ try:
+ mount_process.wait(1)
+ except subprocess.TimeoutExpired:
+ mount_process.kill()
def umount(mount_process, mnt_dir):