test-boot: run in parallel

--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.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-21 00:00:00 +00:00
parent 75fd708099
commit 01984c2201
12 changed files with 640 additions and 318 deletions

View File

@@ -32,43 +32,32 @@ If given, run only the given tests. Otherwise, run all tests.
rootdir_abs_len = len(self.env['root_dir'])
with thread_pool.ThreadPool(
self.run_test,
handle_output=self.handle_output_function,
nthreads=self.env['nproc'],
thread_id_arg='thread_id',
submit_raise_exit=self.env['quit_on_fail'],
) as my_thread_pool:
try:
for test in self.env['tests']:
for path, in_dirnames, in_filenames in self.sh.walk(test):
path_abs = os.path.abspath(path)
dirpath_relative_root = path_abs[rootdir_abs_len + 1:]
for in_filename in in_filenames:
if os.path.splitext(in_filename)[1] in (self.env['c_ext'], self.env['asm_ext']):
path_relative_root = os.path.join(dirpath_relative_root, in_filename)
my_path_properties = path_properties.get(path_relative_root)
if my_path_properties.should_be_tested(self.env):
cur_run_args = run_args.copy()
cur_run_args.update({
'baremetal': os.path.relpath(os.path.join(path_abs, in_filename), os.getcwd()),
})
cur_run_args.update(my_path_properties['test_run_args'])
test_args = {
'expected_exit_status': my_path_properties['exit_status'],
'run_args': cur_run_args,
'run_obj': lkmc.import_path.import_path_main('run'),
'test_id': path_relative_root,
}
error = my_thread_pool.submit(test_args)
if error is not None:
if self.env['quit_on_fail']:
raise common.ExitLoop()
except common.ExitLoop:
pass
error = my_thread_pool.get_error()
if error is not None:
print(error)
return 1
else:
return 0
for test in self.env['tests']:
for path, in_dirnames, in_filenames in self.sh.walk(test):
path_abs = os.path.abspath(path)
dirpath_relative_root = path_abs[rootdir_abs_len + 1:]
for in_filename in in_filenames:
if os.path.splitext(in_filename)[1] in (self.env['c_ext'], self.env['asm_ext']):
path_relative_root = os.path.join(dirpath_relative_root, in_filename)
my_path_properties = path_properties.get(path_relative_root)
if my_path_properties.should_be_tested(self.env):
cur_run_args = run_args.copy()
cur_run_args.update({
'baremetal': os.path.relpath(os.path.join(path_abs, in_filename), os.getcwd()),
})
cur_run_args.update(my_path_properties['test_run_args'])
my_thread_pool.submit({
'expected_exit_status': my_path_properties['exit_status'],
'run_args': cur_run_args,
'run_obj': lkmc.import_path.import_path_main('run'),
'test_id': path_relative_root,
})
return self._handle_thread_pool_errors(my_thread_pool)
if __name__ == '__main__':
Main().cli()