1import os 2 3import infra.basetest 4 5 6class TestCoreMark(infra.basetest.BRTest): 7 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ 8 """ 9 BR2_PACKAGE_COREMARK=y 10 BR2_TARGET_ROOTFS_CPIO=y 11 # BR2_TARGET_ROOTFS_TAR is not set 12 """ 13 14 def test_run(self): 15 cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") 16 self.emulator.boot(arch="armv5", 17 kernel="builtin", 18 options=["-initrd", cpio_file]) 19 self.emulator.login() 20 21 log_file = "run1.log" 22 23 # Run a CoreMark benchmark. 24 self.assertRunOk(f"coremark > {log_file}", timeout=60) 25 26 # Print the log file on console, for debugging. 27 self.assertRunOk(f"cat {log_file}") 28 29 # The "coremark" program return code is always 0 (success). 30 # So the correct execution is validated from the run log. 31 valid_msg = "Correct operation validated." 32 cmd = f"grep -F '{valid_msg}' {log_file}" 33 self.assertRunOk(cmd) 34