test_ruby.py 969 B

12345678910111213141516171819202122232425262728293031323334
  1. import os
  2. import infra.basetest
  3. class TestRuby(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_TARGET_ROOTFS_CPIO=y
  7. # BR2_TARGET_ROOTFS_TAR is not set
  8. BR2_PACKAGE_RUBY=y
  9. BR2_PACKAGE_ZLIB=y
  10. """
  11. def version_test(self):
  12. cmd = "ruby -v"
  13. output, exit_code = self.emulator.run(cmd)
  14. self.assertEqual(exit_code, 0)
  15. def zlib_test(self, timeout=-1):
  16. cmd = "ruby -e 'require \"zlib\"'"
  17. _, exit_code = self.emulator.run(cmd, timeout)
  18. self.assertEqual(exit_code, 0)
  19. def login(self):
  20. cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
  21. self.emulator.boot(arch="armv5",
  22. kernel="builtin",
  23. options=["-initrd", cpio_file])
  24. self.emulator.login()
  25. def test_run(self):
  26. self.login()
  27. self.version_test()
  28. self.zlib_test()