summaryrefslogtreecommitdiff
path: root/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py
diff options
context:
space:
mode:
authorJoao Marcos Costa <joaomarcos.costa@bootlin.com>2020-08-18 18:17:25 +0300
committerTom Rini <trini@konsulko.com>2020-08-24 21:11:31 +0300
commit91f6c1ca2e4400f30b5faee04f1dd9001abd326f (patch)
tree4eb99641e923960e99f096b64ddc5614222c6594 /test/py/tests/test_fs/test_squashfs/test_sqfs_load.py
parent6dfed163bd842bf98fd17875067bf8643819a879 (diff)
downloadu-boot-91f6c1ca2e4400f30b5faee04f1dd9001abd326f.tar.xz
test/py: Add tests for LZO and ZSTD
Improve SquashFS tests architecture. Add 'Compression' class. LZO algorithm may crash if the file is fragmented, so the fragments are disabled when testing LZO. Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
Diffstat (limited to 'test/py/tests/test_fs/test_squashfs/test_sqfs_load.py')
-rw-r--r--test/py/tests/test_fs/test_squashfs/test_sqfs_load.py40
1 files changed, 26 insertions, 14 deletions
diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py
index eb1baae5c5..9e90062384 100644
--- a/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py
+++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py
@@ -12,23 +12,35 @@ from sqfs_common import *
@pytest.mark.buildconfigspec('fs_squashfs')
@pytest.mark.requiredtool('mksquashfs')
def test_sqfs_load(u_boot_console):
- cons = u_boot_console
- sqfs_generate_image(cons)
+ build_dir = u_boot_console.config.build_dir
command = "sqfsload host 0 $kernel_addr_r "
- path = os.path.join(cons.config.build_dir, "sqfs")
- try:
+ for opt in comp_opts:
+ # generate and load the squashfs image
+ try:
+ opt.gen_image(build_dir)
+ except RuntimeError:
+ opt.clean_source(build_dir)
+ # skip unsupported compression types
+ continue
+
+ path = os.path.join(build_dir, "sqfs-" + opt.name)
output = u_boot_console.run_command("host bind 0 " + path)
+
output = u_boot_console.run_command(command + "xxx")
assert "File not found." in output
- output = u_boot_console.run_command(command + "frag_only")
- assert "100 bytes read in" in output
- output = u_boot_console.run_command(command + "blks_frag")
- assert "5100 bytes read in" in output
- output = u_boot_console.run_command(command + "blks_only")
- assert "4096 bytes read in" in output
+
+ for (f, s) in zip(opt.files, opt.sizes):
+ try:
+ output = u_boot_console.run_command(command + f)
+ assert str(s) in output
+ except:
+ assert False
+ opt.cleanup(build_dir)
+
+ # test symbolic link
output = u_boot_console.run_command(command + "sym")
- assert "100 bytes read in" in output
- except:
- sqfs_clean(cons)
- sqfs_clean(cons)
+ assert str(opt.sizes[0]) in output
+
+ # remove generated files
+ opt.cleanup(build_dir)