1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

test/py: fix SquashFS tests

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>
This commit is contained in:
Joao Marcos Costa
2020-08-10 14:37:27 +02:00
committed by Tom Rini
parent 7d08077334
commit 74795f1e35
3 changed files with 16 additions and 14 deletions

View File

@@ -20,9 +20,9 @@ def sqfs_generate_file(path, size):
file.close() file.close()
# generate image with three files and a symbolic link # generate image with three files and a symbolic link
def sqfs_generate_image(): def sqfs_generate_image(cons):
src = "test/py/tests/test_fs/test_squashfs/sqfs_src/" src = os.path.join(cons.config.build_dir, "sqfs_src/")
dest = "test/py/tests/test_fs/test_squashfs/sqfs" dest = os.path.join(cons.config.build_dir, "sqfs")
os.mkdir(src) os.mkdir(src)
sqfs_generate_file(src + "frag_only", 100) sqfs_generate_file(src + "frag_only", 100)
sqfs_generate_file(src + "blks_frag", 5100) 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") os.system("mksquashfs " + src + " " + dest + " -b 4096 -always-use-fragments")
# removes all files created by sqfs_generate_image() # removes all files created by sqfs_generate_image()
def sqfs_clean(): def sqfs_clean(cons):
src = "test/py/tests/test_fs/test_squashfs/sqfs_src/" src = os.path.join(cons.config.build_dir, "sqfs_src/")
dest = "test/py/tests/test_fs/test_squashfs/sqfs" dest = os.path.join(cons.config.build_dir, "sqfs")
os.remove(src + "frag_only") os.remove(src + "frag_only")
os.remove(src + "blks_frag") os.remove(src + "blks_frag")
os.remove(src + "blks_only") os.remove(src + "blks_only")

View File

@@ -12,9 +12,10 @@ from sqfs_common import *
@pytest.mark.buildconfigspec('fs_squashfs') @pytest.mark.buildconfigspec('fs_squashfs')
@pytest.mark.requiredtool('mksquashfs') @pytest.mark.requiredtool('mksquashfs')
def test_sqfs_load(u_boot_console): 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 " 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: try:
output = u_boot_console.run_command("host bind 0 " + path) 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") output = u_boot_console.run_command(command + "sym")
assert "100 bytes read in" in output assert "100 bytes read in" in output
except: except:
sqfs_clean() sqfs_clean(cons)
sqfs_clean() sqfs_clean(cons)

View File

@@ -12,8 +12,9 @@ from sqfs_common import *
@pytest.mark.buildconfigspec('fs_squashfs') @pytest.mark.buildconfigspec('fs_squashfs')
@pytest.mark.requiredtool('mksquashfs') @pytest.mark.requiredtool('mksquashfs')
def test_sqfs_ls(u_boot_console): def test_sqfs_ls(u_boot_console):
sqfs_generate_image() cons = u_boot_console
path = "test/py/tests/test_fs/test_squashfs/sqfs" sqfs_generate_image(cons)
path = os.path.join(cons.config.build_dir, "sqfs")
try: try:
output = u_boot_console.run_command("host bind 0 " + path) output = u_boot_console.run_command("host bind 0 " + path)
output = u_boot_console.run_command("sqfsls host 0") 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") output = u_boot_console.run_command("sqfsls host 0 xxx")
assert "** Cannot find directory. **" in output assert "** Cannot find directory. **" in output
except: except:
sqfs_clean() sqfs_clean(cons)
sqfs_clean() sqfs_clean(cons)