1import os 2 3import infra.basetest 4 5 6class TestBats(infra.basetest.BRTest): 7 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ 8 """ 9 BR2_ENABLE_LOCALE_WHITELIST="" 10 BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y 11 BR2_PACKAGE_BASH=y 12 BR2_PACKAGE_BATS_CORE=y 13 BR2_PACKAGE_BATS_ASSERT=y 14 BR2_PACKAGE_BATS_FILE=y 15 BR2_ROOTFS_OVERLAY="{}" 16 BR2_TARGET_ROOTFS_CPIO=y 17 # BR2_TARGET_ROOTFS_TAR is not set 18 """.format( 19 # overlay to add a bats test suite 20 infra.filepath("tests/package/test_bats/rootfs-overlay")) 21 22 def test_run(self): 23 cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") 24 self.emulator.boot(arch="armv5", 25 kernel="builtin", 26 options=["-initrd", cpio_file]) 27 self.emulator.login() 28 29 self.assertRunOk("bats --version") 30 31 self.assertRunOk("bats /root/test-bats-core.bats", timeout=5) 32 self.assertRunOk("bats /root/test-bats-assert.bats", timeout=5) 33 self.assertRunOk("bats /root/test-bats-file.bats", timeout=5) 34