2
1

test_bat.py 893 B

123456789101112131415161718192021222324252627
  1. import os
  2. import infra.basetest
  3. class TestBat(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_PACKAGE_BAT=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 the programs can execute
  17. self.assertRunOk("bat --version")
  18. self.assertRunOk("echo 'hello test' > test.txt")
  19. # Run bat and capture output
  20. output, exit_code = self.emulator.run("bat test.txt", timeout=10)
  21. self.assertEqual(exit_code, 0)
  22. self.assertIn("hello test", "\n".join(output))