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)
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")
@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)
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)
@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")
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)