test_coremark.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import os
  2. import infra.basetest
  3. class TestCoreMark(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_PACKAGE_COREMARK=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="armv5",
  13. kernel="builtin",
  14. options=["-initrd", cpio_file])
  15. self.emulator.login()
  16. log_file = "run1.log"
  17. # Run a CoreMark benchmark.
  18. self.assertRunOk(f"coremark > {log_file}", timeout=60)
  19. # Print the log file on console, for debugging.
  20. self.assertRunOk(f"cat {log_file}")
  21. # The "coremark" program return code is always 0 (success).
  22. # So the correct execution is validated from the run log.
  23. valid_msg = "Correct operation validated."
  24. cmd = f"grep -F '{valid_msg}' {log_file}"
  25. self.assertRunOk(cmd)