mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-18 21:33:39 -09:00
Add a runtime test for the 'dust' package to verify that the binary executes correctly in a minimal buildroot rootfs. The test checks that: - 'dust --version' runs without error - 'dust' can analyze a directory structure with files - The output includes the expected directory names Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr> Signed-off-by: Julien Olivain <ju.o@free.fr>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import os
|
|
import infra.basetest
|
|
|
|
|
|
class TestDust(infra.basetest.BRTest):
|
|
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
|
"""
|
|
BR2_PACKAGE_DUST=y
|
|
BR2_TARGET_ROOTFS_CPIO=y
|
|
# BR2_TARGET_ROOTFS_TAR is not set
|
|
"""
|
|
|
|
def test_run(self):
|
|
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
|
self.emulator.boot(arch="armv7",
|
|
kernel="builtin",
|
|
options=["-initrd", cpio_file])
|
|
self.emulator.login()
|
|
|
|
# Check that dust is installed and can be executed
|
|
self.assertRunOk("dust --version")
|
|
|
|
# Create a test directory structure with some files
|
|
self.assertRunOk("mkdir -p testdir/subdir")
|
|
self.assertRunOk("dd if=/dev/zero of=testdir/a bs=1K count=10")
|
|
self.assertRunOk("dd if=/dev/zero of=testdir/subdir/b bs=1K count=5")
|
|
|
|
# Run dust on the test directory and capture the output
|
|
output, exit_code = self.emulator.run("dust testdir", timeout=10)
|
|
self.assertEqual(exit_code, 0)
|
|
self.assertIn("testdir", "\n".join(output))
|
|
self.assertIn("subdir", "\n".join(output))
|