test/py: Add tests for the SquashFS commands
[platform/kernel/u-boot.git] / test / py / tests / test_fs / test_squashfs / test_sqfs_ls.py
1 # SPDX-License-Identifier: GPL-2.0
2 # Copyright (C) 2020 Bootlin
3 # Author: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
4
5 import os
6 import pytest
7 from sqfs_common import *
8
9 @pytest.mark.boardspec('sandbox')
10 @pytest.mark.buildconfigspec('cmd_fs_generic')
11 @pytest.mark.buildconfigspec('cmd_squashfs')
12 @pytest.mark.buildconfigspec('fs_squashfs')
13 @pytest.mark.requiredtool('mksquashfs')
14 def test_sqfs_ls(u_boot_console):
15     sqfs_generate_image()
16     path = "test/py/tests/test_fs/test_squashfs/sqfs"
17     try:
18         output = u_boot_console.run_command("host bind 0 " + path)
19         output = u_boot_console.run_command("sqfsls host 0")
20         assert "4 file(s), 0 dir(s)" in output
21         assert "<SYM>   sym" in output
22         output = u_boot_console.run_command("sqfsls host 0 xxx")
23         assert "** Cannot find directory. **" in output
24     except:
25         sqfs_clean()
26     sqfs_clean()