Fix import_path circular dependency by splitting it out.

Use import thread_pool instead from, from is evil.

Fix poweroff.out path for ./trace-boot.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-12 00:00:02 +00:00
parent 7cf3c20a40
commit 1ab7fbf607
26 changed files with 149 additions and 93 deletions

View File

@@ -4,8 +4,9 @@ import os
import sys
import common
import lkmc.import_path
import path_properties
from thread_pool import ThreadPool
import thread_pool
class Main(common.TestCliFunction):
def __init__(self, *args, **kwargs):
@@ -16,8 +17,6 @@ TODO: expose all userland relevant ./run args here as well somehow.
'''
if not 'defaults' in kwargs:
kwargs['defaults'] = {}
if not 'userland' in kwargs['defaults']:
kwargs['defaults']['userland'] = ''
super().__init__(*args, **kwargs)
self.add_argument(
'tests',
@@ -39,11 +38,11 @@ If given, run only the given tests. Otherwise, run all tests.
run_args['userland_build_id'] = 'static'
had_failure = False
rootdir_abs_len = len(self.env['root_dir'])
with ThreadPool(
with thread_pool.ThreadPool(
self.run_test,
nthreads=self.env['nproc'],
thread_id_arg='thread_id',
) as thread_pool:
) as my_thread_pool:
try:
for test in self.env['tests']:
for path, in_dirnames, in_filenames in self.sh.walk(test):
@@ -62,18 +61,18 @@ If given, run only the given tests. Otherwise, run all tests.
run_test_args = {
'expected_exit_status': my_path_properties['exit_status'],
'run_args': cur_run_args,
'run_obj': common.import_path_main('run'),
'run_obj': lkmc.import_path.import_path_main('run'),
'test_id': path_relative_root,
}
if my_path_properties['receives_signal']:
run_test_args['expected_exit_status'] = 128 - my_path_properties['exit_status']
error = thread_pool.submit(run_test_args)
error = my_thread_pool.submit(run_test_args)
if error is not None:
if self.env['quit_on_fail']:
raise common.ExitLoop()
except common.ExitLoop:
pass
error = thread_pool.get_error()
error = my_thread_pool.get_error()
if error is not None:
print(error)
return 1