test 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env python3
  2. import common
  3. import lkmc.import_path
  4. from shell_helpers import LF
  5. class Main(common.TestCliFunction):
  6. def __init__(self):
  7. super().__init__(
  8. description='''\
  9. https://cirosantilli.com/linux-kernel-module-cheat#automated-tests
  10. '''
  11. )
  12. self.add_argument(
  13. '--size',
  14. default=1,
  15. type=int,
  16. help='''\
  17. Size of the tests to run. Scale:
  18. * 1: a few seconds and important
  19. * 2: < 5 minutes and important or a few seconds and not too important
  20. * 3: all
  21. '''
  22. )
  23. def timed_main(self):
  24. run_args = self.get_common_args()
  25. test_boot_args = run_args.copy()
  26. test_boot_args['size'] = self.env['size']
  27. self.run_test(lkmc.import_path.import_path_main('test-boot'), test_boot_args, 'test-boot')
  28. self.run_test(lkmc.import_path.import_path_main('test-userland-full-system'), run_args, 'test-userland')
  29. self.run_test(lkmc.import_path.import_path_main('test-executables'), {**run_args, **{'mode': 'baremetal'}}, 'test-executables-baremetal')
  30. self.run_test(lkmc.import_path.import_path_main('test-executables'), run_args, 'test-executables-userland')
  31. self.run_test(lkmc.import_path.import_path_main('test-gdb'), run_args, 'test-gdb')
  32. if self.env['emulator'] == 'gem5':
  33. gem5_unit_test_args = run_args.copy()
  34. gem5_unit_test_args['unit_tests'] = True
  35. self.run_test(lkmc.import_path.import_path_main('build-gem5'), gem5_unit_test_args, 'gem5-unit-tests')
  36. if __name__ == '__main__':
  37. Main().cli()