test_s6_portable_utils.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import os
  2. import infra.basetest
  3. class TestS6PortableUtils(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_PACKAGE_S6_PORTABLE_UTILS=y
  7. BR2_TARGET_ROOTFS_CPIO=y
  8. # BR2_TARGET_ROOTFS_TAR is not set
  9. """
  10. def test_run(self):
  11. img = os.path.join(self.builddir, "images", "rootfs.cpio")
  12. self.emulator.boot(arch="armv5",
  13. kernel="builtin",
  14. options=["-initrd", img])
  15. self.emulator.login()
  16. output, exit_code = self.emulator.run("s6-basename /sbin/init")
  17. self.assertEqual(exit_code, 0)
  18. self.assertEqual(output[0].strip(), "init")
  19. output, exit_code = self.emulator.run("s6-echo hello world | s6-cut -d' ' -f2")
  20. self.assertEqual(exit_code, 0)
  21. self.assertEqual(output[0].strip(), "world")
  22. _, exit_code = self.emulator.run("s6-mkfifo testpipe")
  23. self.assertEqual(exit_code, 0)
  24. _, exit_code = self.emulator.run("s6-test -p testpipe")
  25. self.assertEqual(exit_code, 0)