test_ltp_testsuite.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import os
  2. import infra.basetest
  3. class TestLtpTestsuite(infra.basetest.BRTest):
  4. config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
  5. """
  6. BR2_PACKAGE_LTP_TESTSUITE=y
  7. BR2_TARGET_ROOTFS_EXT2=y
  8. BR2_TARGET_ROOTFS_EXT2_4=y
  9. BR2_TARGET_ROOTFS_EXT2_SIZE="600M"
  10. # BR2_TARGET_ROOTFS_TAR is not set
  11. """
  12. def test_run(self):
  13. drive = os.path.join(self.builddir, "images", "rootfs.ext4")
  14. self.emulator.boot(arch="armv5",
  15. kernel="builtin",
  16. kernel_cmdline=["rootwait", "root=/dev/sda"],
  17. options=["-drive", f"file={drive},if=scsi,format=raw"])
  18. self.emulator.login()
  19. # We run a reduced number of tests (read syscall tests) for a
  20. # fast execution. See "runltp --help" for option details.
  21. cmd = "/usr/lib/ltp-testsuite/runltp"
  22. cmd += " -p -q"
  23. cmd += " -s ^read0[0-9]*"
  24. cmd += " -l /tmp/ltp.log"
  25. cmd += " -o /tmp/ltp.output"
  26. cmd += " -C /tmp/ltp.failed"
  27. cmd += " -T /tmp/ltp.tconf"
  28. self.assertRunOk(cmd)
  29. # We print the LTP run log and check there was zero failure in
  30. # our test selection.
  31. out, ret = self.emulator.run("cat /tmp/ltp.log")
  32. self.assertEqual(ret, 0)
  33. self.assertIn("Total Failures: 0", out)