aboutsummaryrefslogtreecommitdiff
path: root/test/py/tests
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-05-27 07:41:25 -0400
committerTom Rini <trini@konsulko.com>2021-05-27 07:41:25 -0400
commita0ecfa568d3309bb21869622bfc7147665c4260d (patch)
tree977aa2f50c7cbc50ddf7dc4384e6126b38e293c1 /test/py/tests
parentf4b2786b80583c8b48245ac5f90fda47328f3a6c (diff)
parentcb6c9c83e2f1cb5b96851445dbf3dea8541cb212 (diff)
Merge branch '2021-05-26-assorted-bugfixes'
Diffstat (limited to 'test/py/tests')
-rw-r--r--test/py/tests/test_fs/conftest.py48
1 files changed, 36 insertions, 12 deletions
diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
index 50af9efcf7..410a675b97 100644
--- a/test/py/tests/test_fs/conftest.py
+++ b/test/py/tests/test_fs/conftest.py
@@ -278,14 +278,19 @@ def fs_obj_basic(request, u_boot_config):
check_call('mkdir -p %s' % mount_dir, shell=True)
except CalledProcessError as err:
pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))
- return
- finally:
call('rm -f %s' % fs_img, shell=True)
+ return
try:
# Mount the image so we can populate it.
mount_fs(fs_type, fs_img, mount_dir)
+ except CalledProcessError as err:
+ pytest.skip('Mounting to folder failed for filesystem: ' + fs_type + '. {}'.format(err))
+ call('rmdir %s' % mount_dir, shell=True)
+ call('rm -f %s' % fs_img, shell=True)
+ return
+ try:
# Create a subdirectory.
check_call('mkdir %s/SUBDIR' % mount_dir, shell=True)
@@ -348,11 +353,12 @@ def fs_obj_basic(request, u_boot_config):
except CalledProcessError as err:
pytest.skip('Setup failed for filesystem: ' + fs_type + '. {}'.format(err))
+ umount_fs(mount_dir)
return
else:
+ umount_fs(mount_dir)
yield [fs_ubtype, fs_img, md5val]
finally:
- umount_fs(mount_dir)
call('rmdir %s' % mount_dir, shell=True)
call('rm -f %s' % fs_img, shell=True)
@@ -394,14 +400,19 @@ def fs_obj_ext(request, u_boot_config):
check_call('mkdir -p %s' % mount_dir, shell=True)
except CalledProcessError as err:
pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))
- return
- finally:
call('rm -f %s' % fs_img, shell=True)
+ return
try:
# Mount the image so we can populate it.
mount_fs(fs_type, fs_img, mount_dir)
+ except CalledProcessError as err:
+ pytest.skip('Mounting to folder failed for filesystem: ' + fs_type + '. {}'.format(err))
+ call('rmdir %s' % mount_dir, shell=True)
+ call('rm -f %s' % fs_img, shell=True)
+ return
+ try:
# Create a test directory
check_call('mkdir %s/dir1' % mount_dir, shell=True)
@@ -443,11 +454,12 @@ def fs_obj_ext(request, u_boot_config):
check_call('rm %s' % tmp_file, shell=True)
except CalledProcessError:
pytest.skip('Setup failed for filesystem: ' + fs_type)
+ umount_fs(mount_dir)
return
else:
+ umount_fs(mount_dir)
yield [fs_ubtype, fs_img, md5val]
finally:
- umount_fs(mount_dir)
call('rmdir %s' % mount_dir, shell=True)
call('rm -f %s' % fs_img, shell=True)
@@ -517,14 +529,19 @@ def fs_obj_unlink(request, u_boot_config):
check_call('mkdir -p %s' % mount_dir, shell=True)
except CalledProcessError as err:
pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))
- return
- finally:
call('rm -f %s' % fs_img, shell=True)
+ return
try:
# Mount the image so we can populate it.
mount_fs(fs_type, fs_img, mount_dir)
+ except CalledProcessError as err:
+ pytest.skip('Mounting to folder failed for filesystem: ' + fs_type + '. {}'.format(err))
+ call('rmdir %s' % mount_dir, shell=True)
+ call('rm -f %s' % fs_img, shell=True)
+ return
+ try:
# Test Case 1 & 3
check_call('mkdir %s/dir1' % mount_dir, shell=True)
check_call('dd if=/dev/urandom of=%s/dir1/file1 bs=1K count=1'
@@ -548,11 +565,12 @@ def fs_obj_unlink(request, u_boot_config):
except CalledProcessError:
pytest.skip('Setup failed for filesystem: ' + fs_type)
+ umount_fs(mount_dir)
return
else:
+ umount_fs(mount_dir)
yield [fs_ubtype, fs_img]
finally:
- umount_fs(mount_dir)
call('rmdir %s' % mount_dir, shell=True)
call('rm -f %s' % fs_img, shell=True)
@@ -594,14 +612,19 @@ def fs_obj_symlink(request, u_boot_config):
check_call('mkdir -p %s' % mount_dir, shell=True)
except CalledProcessError as err:
pytest.skip('Preparing mount folder failed for filesystem: ' + fs_type + '. {}'.format(err))
- return
- finally:
call('rm -f %s' % fs_img, shell=True)
+ return
try:
# Mount the image so we can populate it.
mount_fs(fs_type, fs_img, mount_dir)
+ except CalledProcessError as err:
+ pytest.skip('Mounting to folder failed for filesystem: ' + fs_type + '. {}'.format(err))
+ call('rmdir %s' % mount_dir, shell=True)
+ call('rm -f %s' % fs_img, shell=True)
+ return
+ try:
# Create a subdirectory.
check_call('mkdir %s/SUBDIR' % mount_dir, shell=True)
@@ -625,10 +648,11 @@ def fs_obj_symlink(request, u_boot_config):
except CalledProcessError:
pytest.skip('Setup failed for filesystem: ' + fs_type)
+ umount_fs(mount_dir)
return
else:
+ umount_fs(mount_dir)
yield [fs_ubtype, fs_img, md5val]
finally:
- umount_fs(mount_dir)
call('rmdir %s' % mount_dir, shell=True)
call('rm -f %s' % fs_img, shell=True)