userland: try to make userland executable selection saner

Only allow existing files to be built, stop extension expansion madness.

cli_function: get_cli print booleans properly, was printing without --no-
for negations.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-05 00:00:00 +00:00
parent f1c3b64a55
commit eba97f9cef
11 changed files with 570 additions and 459 deletions

View File

@@ -27,6 +27,12 @@ If given, run only the given tests. Otherwise, run all tests.
'''
)
def setup_one(self):
self.env['tests'] = self.resolve_targets(
self.env['userland_source_dir'],
self.env['tests']
)
def timed_main(self):
run_args = self.get_common_args()
run_args['ctrl_c_host'] = True
@@ -35,37 +41,36 @@ If given, run only the given tests. Otherwise, run all tests.
if self.env['emulator'] == 'gem5':
run_args['userland_build_id'] = 'static'
had_failure = False
rootdir_abs_len = len(self.env['userland_source_dir'])
rootdir_abs_len = len(self.env['root_dir'])
with ThreadPool(
self.run_test,
nthreads=self.env['nproc'],
thread_id_arg='thread_id',
) as thread_pool:
try:
for path, in_dirnames, in_filenames in self.walk_source_targets(
self.env['tests'],
self.env['userland_in_exts']
):
path_abs = os.path.abspath(path)
dirpath_relative_root = path_abs[rootdir_abs_len + 1:]
for in_filename in in_filenames:
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['arch']):
cur_run_args = run_args.copy()
cur_run_args.update({
'background': True,
'userland': path_relative_root,
})
error = thread_pool.submit({
'expected_exit_status': my_path_properties['exit_status'],
'run_args': cur_run_args,
'run_obj': self.import_path_main('run'),
'test_id': path_relative_root,
})
if error is not None:
if self.env['quit_on_fail']:
raise common.ExitLoop()
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['userland_in_exts']:
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['arch']):
cur_run_args = run_args.copy()
cur_run_args.update({
'background': True,
'userland': os.path.relpath(os.path.join(path_abs, in_filename), os.getcwd()),
})
error = thread_pool.submit({
'expected_exit_status': my_path_properties['exit_status'],
'run_args': cur_run_args,
'run_obj': self.import_path_main('run'),
'test_id': path_relative_root,
})
if error is not None:
if self.env['quit_on_fail']:
raise common.ExitLoop()
except common.ExitLoop:
pass
error = thread_pool.get_error()