aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlper Nebi Yasak2021-06-04 22:04:45 +0300
committerTom Rini2021-07-05 15:28:32 -0400
commit8f5f5d3a4593f26f0a755f5ecfaa7299e42edeeb (patch)
tree428e91a1b55637b4e69985c64d2a2fa4743788e8 /test
parentf1eb346e336fee7c14ed289dc854da4556c29a44 (diff)
test/py: Use loop mounts if guestmount fails in filesystem tests
If guestmount isn't available on the system, filesystem test setup falls back to using loop mounts to prepare its disk images. If guestmount is available but fails to work, the tests are immediately skipped. Instead of giving up on a guestmount failure, try using loop mounts as an attempt to keep tests running. Also stop checking if guestmount is in PATH, as trying to run a missing guestmount can now follow the same failure codepath and fall back to loop mounts anyway. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_fs/conftest.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
index 7325486cdb1..0189298f914 100644
--- a/test/py/tests/test_fs/conftest.py
+++ b/test/py/tests/test_fs/conftest.py
@@ -209,24 +209,23 @@ def mount_fs(fs_type, device, mount_point):
"""
global fuse_mounted
- fuse_mounted = False
try:
- if tool_is_in_path('guestmount'):
- fuse_mounted = True
- check_call('guestmount -a %s -m /dev/sda %s'
- % (device, mount_point), shell=True)
- else:
- mount_opt = 'loop,rw'
- if re.match('fat', fs_type):
- mount_opt += ',umask=0000'
-
- check_call('sudo mount -o %s %s %s'
- % (mount_opt, device, mount_point), shell=True)
-
- # may not be effective for some file systems
- check_call('sudo chmod a+rw %s' % mount_point, shell=True)
+ check_call('guestmount -a %s -m /dev/sda %s'
+ % (device, mount_point), shell=True)
+ fuse_mounted = True
+ return
except CalledProcessError:
- raise
+ fuse_mounted = False
+
+ mount_opt = 'loop,rw'
+ if re.match('fat', fs_type):
+ mount_opt += ',umask=0000'
+
+ check_call('sudo mount -o %s %s %s'
+ % (mount_opt, device, mount_point), shell=True)
+
+ # may not be effective for some file systems
+ check_call('sudo chmod a+rw %s' % mount_point, shell=True)
def umount_fs(mount_point):
"""Unmount a volume.