aboutsummaryrefslogtreecommitdiff
path: root/test/py/tests/test_fs/test_unlink.py
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2019-02-13 12:15:23 +0100
committerTom Rini <trini@konsulko.com>2019-04-09 15:34:15 -0400
commit290100583dc70185e76ddaa00c1a50abd162a5ad (patch)
tree9abc2399098d9de259d79da0b439fac58b206722 /test/py/tests/test_fs/test_unlink.py
parent5cfc73e6e29f37a3a8daf5fd28bc4d5d015f778c (diff)
test: fs: Add filesystem integrity checks
We need to make sure that file writes,file creation, etc. are properly performed and do not corrupt the filesystem. To help with this, introduce the assert_fs_integrity() function that executes the appropriate fsck tool. It should be called at the end of any test that modify the content/organization of the filesystem. Currently only supports FATs and EXT4. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'test/py/tests/test_fs/test_unlink.py')
-rw-r--r--test/py/tests/test_fs/test_unlink.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/py/tests/test_fs/test_unlink.py b/test/py/tests/test_fs/test_unlink.py
index 2b817468ed..97aafc63bb 100644
--- a/test/py/tests/test_fs/test_unlink.py
+++ b/test/py/tests/test_fs/test_unlink.py
@@ -10,6 +10,7 @@ on file system.
"""
import pytest
+from fstest_helpers import assert_fs_integrity
@pytest.mark.boardspec('sandbox')
@pytest.mark.slow
@@ -30,6 +31,7 @@ class TestUnlink(object):
'%sls host 0:0 dir1/' % fs_type)
assert(not 'file1' in output)
assert('file2' in output)
+ assert_fs_integrity(fs_type, fs_img)
def test_unlink2(self, u_boot_console, fs_obj_unlink):
"""
@@ -48,6 +50,7 @@ class TestUnlink(object):
output = u_boot_console.run_command(
'%sls host 0:0 dir2' % fs_type)
assert('0 file(s), 2 dir(s)' in output)
+ assert_fs_integrity(fs_type, fs_img)
def test_unlink3(self, u_boot_console, fs_obj_unlink):
"""
@@ -59,6 +62,7 @@ class TestUnlink(object):
'host bind 0 %s' % fs_img,
'%srm host 0:0 dir1/nofile' % fs_type])
assert('nofile: doesn\'t exist' in ''.join(output))
+ assert_fs_integrity(fs_type, fs_img)
def test_unlink4(self, u_boot_console, fs_obj_unlink):
"""
@@ -71,9 +75,10 @@ class TestUnlink(object):
'%srm host 0:0 dir4' % fs_type])
assert('' == ''.join(output))
- output = u_boot_console.run_command(
- '%sls host 0:0 /' % fs_type)
- assert(not 'dir4' in output)
+ output = u_boot_console.run_command(
+ '%sls host 0:0 /' % fs_type)
+ assert(not 'dir4' in output)
+ assert_fs_integrity(fs_type, fs_img)
def test_unlink5(self, u_boot_console, fs_obj_unlink):
"""
@@ -86,6 +91,7 @@ class TestUnlink(object):
'host bind 0 %s' % fs_img,
'%srm host 0:0 dir5' % fs_type])
assert('directory is not empty' in ''.join(output))
+ assert_fs_integrity(fs_type, fs_img)
def test_unlink6(self, u_boot_console, fs_obj_unlink):
"""
@@ -97,6 +103,7 @@ class TestUnlink(object):
'host bind 0 %s' % fs_img,
'%srm host 0:0 dir5/.' % fs_type])
assert('directory is not empty' in ''.join(output))
+ assert_fs_integrity(fs_type, fs_img)
def test_unlink7(self, u_boot_console, fs_obj_unlink):
"""
@@ -108,3 +115,4 @@ class TestUnlink(object):
'host bind 0 %s' % fs_img,
'%srm host 0:0 dir5/..' % fs_type])
assert('directory is not empty' in ''.join(output))
+ assert_fs_integrity(fs_type, fs_img)