mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-13 20:12:26 +00:00
--quit-after-boot: fix for gem5, update path to gem5.sh Improve the printing of results and errors: - remove newlines from IDs at the end for ./test-boot - remove newlines from progress for __call__ commands and don't print executed commands at all, otherwise there are too many lines per test and it is hard to tell what is going on - print backtraces for any exception in the threads (bugs while developing this code) Tests across different archs and emulators are still not running in parallel, which is a huge loss. TODO. thread_pool: introduce with API. This was motivate by test-boot, I've had enough of doing separate error handling for each loop type! Greatly dries up the code, awesome. common: make --all-emulators work properly with native hopefully for the last time, ./test-baremetal was still failing. gem5: don't pass --command-line for baremetal. Maybe later we can use it to actually pass command line arguments to main()? To be seen.
74 lines
2.8 KiB
Python
Executable File
74 lines
2.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import threading
|
|
import os
|
|
|
|
import common
|
|
import lkmc.import_path
|
|
|
|
class Main(common.TestCliFunction):
|
|
def __init__(self):
|
|
super().__init__(
|
|
description='''\
|
|
https://github.com/cirosantilli/linux-kernel-module-cheat#test-gdb
|
|
'''
|
|
)
|
|
self.add_argument(
|
|
'tests',
|
|
nargs='*',
|
|
help='''\
|
|
If given, run only the given tests. Otherwise, run all tests,
|
|
found by searching for the Python test files.
|
|
'''
|
|
)
|
|
|
|
def timed_main(self):
|
|
run = lkmc.import_path.import_path_main('run')
|
|
run_gdb = lkmc.import_path.import_path_main('run-gdb')
|
|
if self.env['arch'] in self.env['crosstool_ng_supported_archs']:
|
|
test_sources = []
|
|
if self.env['tests'] == []:
|
|
source_paths = []
|
|
for filename in sorted(os.listdir(self.env['baremetal_source_dir'])):
|
|
base, ext = os.path.splitext(filename)
|
|
if ext in self.env['build_in_exts']:
|
|
test_sources.append(
|
|
os.path.join(
|
|
self.env['baremetal_source_dir'],
|
|
filename
|
|
)
|
|
)
|
|
for root, dirnames, filenames in os.walk(
|
|
os.path.join(
|
|
self.env['baremetal_source_dir'],
|
|
'arch',
|
|
self.env['arch']
|
|
)
|
|
):
|
|
for filename in filenames:
|
|
base, ext = os.path.splitext(filename)
|
|
if ext in self.env['build_in_exts']:
|
|
test_sources.append(os.path.join(root, filename))
|
|
else:
|
|
test_sources = self.env['tests']
|
|
for test_source_full in test_sources:
|
|
base, ext = os.path.splitext(test_source_full)
|
|
if os.path.exists(base + '.py'):
|
|
test_source_base = os.path.relpath(base, self.env['root_dir'])
|
|
common_args = self.get_common_args()
|
|
common_args['baremetal'] = test_source_base + ext
|
|
run_args = common_args.copy()
|
|
run_args['gdb_wait'] = True
|
|
run_args['background'] = True
|
|
test_id_string = self.test_setup(run_args, test_source_base)
|
|
run_thread = threading.Thread(target=lambda: run(**run_args))
|
|
run_thread.start()
|
|
gdb_args = common_args.copy()
|
|
gdb_args['test'] = True
|
|
run_gdb(**gdb_args)
|
|
run_thread.join()
|
|
self.test_teardown(run, 0, test_id_string)
|
|
|
|
if __name__ == '__main__':
|
|
Main().cli()
|