summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoao Marcos Costa <joaomarcos.costa@bootlin.com>2020-08-10 14:37:27 +0200
committerTom Rini <trini@konsulko.com>2020-08-10 10:37:50 -0400
commit74795f1e35b624cdba451aeaea0af2f1211e4a91 (patch)
tree55aa5afb723e1d75c135a9ba9703047f3f881a6b
parent7d080773347c1f6e0e896d9284134a2a411155d6 (diff)
downloadu-boot-WIP/10Aug2020.tar.gz
test/py: fix SquashFS testsWIP/10Aug2020
Use "cons.config.build_dir" instead of writing to the source directory (read-only). This will fix the test failures in Azure. Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
-rw-r--r--test/py/tests/test_fs/test_squashfs/sqfs_common.py12
-rw-r--r--test/py/tests/test_fs/test_squashfs/test_sqfs_load.py9
-rw-r--r--test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py9
3 files changed, 16 insertions, 14 deletions
diff --git a/test/py/tests/test_fs/test_squashfs/sqfs_common.py b/test/py/tests/test_fs/test_squashfs/sqfs_common.py
index 9ef7b19ad9..2dc344d1b2 100644
--- a/test/py/tests/test_fs/test_squashfs/sqfs_common.py
+++ b/test/py/tests/test_fs/test_squashfs/sqfs_common.py
@@ -20,9 +20,9 @@ def sqfs_generate_file(path, size):
file.close()
# generate image with three files and a symbolic link
-def sqfs_generate_image():
- src = "test/py/tests/test_fs/test_squashfs/sqfs_src/"
- dest = "test/py/tests/test_fs/test_squashfs/sqfs"
+def sqfs_generate_image(cons):
+ src = os.path.join(cons.config.build_dir, "sqfs_src/")
+ dest = os.path.join(cons.config.build_dir, "sqfs")
os.mkdir(src)
sqfs_generate_file(src + "frag_only", 100)
sqfs_generate_file(src + "blks_frag", 5100)
@@ -31,9 +31,9 @@ def sqfs_generate_image():
os.system("mksquashfs " + src + " " + dest + " -b 4096 -always-use-fragments")
# removes all files created by sqfs_generate_image()
-def sqfs_clean():
- src = "test/py/tests/test_fs/test_squashfs/sqfs_src/"
- dest = "test/py/tests/test_fs/test_squashfs/sqfs"
+def sqfs_clean(cons):
+ src = os.path.join(cons.config.build_dir, "sqfs_src/")
+ dest = os.path.join(cons.config.build_dir, "sqfs")
os.remove(src + "frag_only")
os.remove(src + "blks_frag")
os.remove(src + "blks_only")
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 9b828fdf04..eb1baae5c5 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,9 +12,10 @@ from sqfs_common import *
@pytest.mark.buildconfigspec('fs_squashfs')
@pytest.mark.requiredtool('mksquashfs')
def test_sqfs_load(u_boot_console):
- sqfs_generate_image()
+ cons = u_boot_console
+ sqfs_generate_image(cons)
command = "sqfsload host 0 $kernel_addr_r "
- path = "test/py/tests/test_fs/test_squashfs/sqfs"
+ path = os.path.join(cons.config.build_dir, "sqfs")
try:
output = u_boot_console.run_command("host bind 0 " + path)
@@ -29,5 +30,5 @@ def test_sqfs_load(u_boot_console):
output = u_boot_console.run_command(command + "sym")
assert "100 bytes read in" in output
except:
- sqfs_clean()
- sqfs_clean()
+ sqfs_clean(cons)
+ sqfs_clean(cons)
diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py
index dc31f1a50e..3a7b75c778 100644
--- a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py
+++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py
@@ -12,8 +12,9 @@ from sqfs_common import *
@pytest.mark.buildconfigspec('fs_squashfs')
@pytest.mark.requiredtool('mksquashfs')
def test_sqfs_ls(u_boot_console):
- sqfs_generate_image()
- path = "test/py/tests/test_fs/test_squashfs/sqfs"
+ cons = u_boot_console
+ sqfs_generate_image(cons)
+ path = os.path.join(cons.config.build_dir, "sqfs")
try:
output = u_boot_console.run_command("host bind 0 " + path)
output = u_boot_console.run_command("sqfsls host 0")
@@ -22,5 +23,5 @@ def test_sqfs_ls(u_boot_console):
output = u_boot_console.run_command("sqfsls host 0 xxx")
assert "** Cannot find directory. **" in output
except:
- sqfs_clean()
- sqfs_clean()
+ sqfs_clean(cons)
+ sqfs_clean(cons)