Get rid of imp, started giving deprecation warning every time in Python 3.7 in Ubuntu 19.04.

Please python stop torturing me with refactors.

Make ./run -u blow up if executable not found, otherwise I go crazy.

Get ./test-gdb back to life after the ./run relative path refactor, forgot to test this.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-11 00:00:01 +00:00
parent 300671cd39
commit 3cc1b793cb
19 changed files with 108 additions and 113 deletions

View File

@@ -22,38 +22,51 @@ found by searching for the Python test files.
)
def timed_main(self):
run = self.import_path_main('run')
run_gdb = self.import_path_main('run-gdb')
run = common.import_path_main('run')
run_gdb = common.import_path_main('run-gdb')
if self.env['arch'] in self.env['crosstool_ng_supported_archs']:
test_sources = []
if self.env['tests'] == []:
test_scripts_noext = []
source_paths = []
for filename in sorted(os.listdir(self.env['baremetal_source_dir'])):
base, ext = os.path.splitext(filename)
if ext == '.py':
test_scripts_noext.append(base)
for root, dirnames, filenames in os.walk(os.path.join(self.env['baremetal_source_dir'], 'arch', self.env['arch'])):
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 == '.py':
full_path = os.path.join(root, base)
relpath = os.path.relpath(full_path, self.env['baremetal_source_dir'])
test_scripts_noext.append(relpath)
if ext in self.env['build_in_exts']:
test_sources.append(os.path.join(root, filename))
else:
test_scripts_noext = self.env['tests']
for test_script_noext in test_scripts_noext:
common_args = self.get_common_args()
common_args['baremetal'] = test_script_noext
test_id_string = self.test_setup(test_script_noext)
run_args = common_args.copy()
run_args['gdb_wait'] = True
run_args['background'] = True
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)
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
test_id_string = self.test_setup(test_source_base)
run_args = common_args.copy()
run_args['gdb_wait'] = True
run_args['background'] = True
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()