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-07-30 16:33:52 +0300
committerTom Rini <trini@konsulko.com>2020-08-08 05:31:32 +0300
commitf428e33b6bd7d01dc488534f59f56c4907c76b2f (patch)
tree568d560ea8778c1584699b47569111cf9b566163 /test/py/tests/test_fs/test_squashfs/test_sqfs_load.py
parent02c366b5d5f7022e573732fbe7b80c199e934d4f (diff)
downloadu-boot-f428e33b6bd7d01dc488534f59f56c4907c76b2f.tar.xz
test/py: Add tests for the SquashFS commands
Add Python scripts to test 'ls' and 'load' commands. The scripts generate a SquashFS image and clean the directory after the assertions, or if an exception is raised. 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.py33
1 files changed, 33 insertions, 0 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
new file mode 100644
index 0000000000..9b828fdf04
--- /dev/null
+++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2020 Bootlin
+# Author: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
+
+import os
+import pytest
+from sqfs_common import *
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_fs_generic')
+@pytest.mark.buildconfigspec('cmd_squashfs')
+@pytest.mark.buildconfigspec('fs_squashfs')
+@pytest.mark.requiredtool('mksquashfs')
+def test_sqfs_load(u_boot_console):
+ sqfs_generate_image()
+ command = "sqfsload host 0 $kernel_addr_r "
+ path = "test/py/tests/test_fs/test_squashfs/sqfs"
+
+ try:
+ 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
+ output = u_boot_console.run_command(command + "sym")
+ assert "100 bytes read in" in output
+ except:
+ sqfs_clean()
+ sqfs_clean()