2
1

test_rust.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import os
  2. import tempfile
  3. import subprocess
  4. import shutil
  5. import infra.basetest
  6. class TestRustBase(infra.basetest.BRTest):
  7. def login(self):
  8. img = os.path.join(self.builddir, "images", "rootfs.cpio")
  9. self.emulator.boot(arch="armv7",
  10. kernel="builtin",
  11. options=["-initrd", img])
  12. self.emulator.login()
  13. class TestRustBin(TestRustBase):
  14. config = \
  15. """
  16. BR2_arm=y
  17. BR2_cortex_a9=y
  18. BR2_ARM_ENABLE_NEON=y
  19. BR2_ARM_ENABLE_VFP=y
  20. BR2_TOOLCHAIN_EXTERNAL=y
  21. BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
  22. BR2_SYSTEM_DHCP="eth0"
  23. BR2_TARGET_ROOTFS_CPIO=y
  24. # BR2_TARGET_ROOTFS_TAR is not set
  25. BR2_PACKAGE_HOST_RUSTC=y
  26. BR2_PACKAGE_RIPGREP=y
  27. """
  28. def test_run(self):
  29. self.login()
  30. self.assertRunOk("rg Buildroot /etc/issue")
  31. class TestRust(TestRustBase):
  32. config = \
  33. """
  34. BR2_arm=y
  35. BR2_cortex_a9=y
  36. BR2_ARM_ENABLE_NEON=y
  37. BR2_ARM_ENABLE_VFP=y
  38. BR2_TOOLCHAIN_EXTERNAL=y
  39. BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
  40. BR2_SYSTEM_DHCP="eth0"
  41. BR2_TARGET_ROOTFS_CPIO=y
  42. # BR2_TARGET_ROOTFS_TAR is not set
  43. BR2_PACKAGE_HOST_RUSTC=y
  44. BR2_PACKAGE_HOST_RUST=y
  45. BR2_PACKAGE_RIPGREP=y
  46. """
  47. def test_run(self):
  48. self.login()
  49. self.assertRunOk("rg Buildroot /etc/issue")