test_dust.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import os
  2. import infra.basetest
  3. class TestDust(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_PACKAGE_DUST=y
  7. BR2_TARGET_ROOTFS_CPIO=y
  8. # BR2_TARGET_ROOTFS_TAR is not set
  9. """
  10. def test_run(self):
  11. cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
  12. self.emulator.boot(arch="armv7",
  13. kernel="builtin",
  14. options=["-initrd", cpio_file])
  15. self.emulator.login()
  16. # Check that dust is installed and can be executed
  17. self.assertRunOk("dust --version")
  18. # Create a test directory structure with some files
  19. self.assertRunOk("mkdir -p testdir/subdir")
  20. self.assertRunOk("dd if=/dev/zero of=testdir/a bs=1K count=10")
  21. self.assertRunOk("dd if=/dev/zero of=testdir/subdir/b bs=1K count=5")
  22. # Run dust on the test directory and capture the output
  23. output, exit_code = self.emulator.run("dust testdir", timeout=10)
  24. self.assertEqual(exit_code, 0)
  25. self.assertIn("testdir", "\n".join(output))
  26. self.assertIn("subdir", "\n".join(output))