diff --git a/tools/test.py b/tools/test.py index 136a55fda6..e79c1dc6ac 100644 --- a/tools/test.py +++ b/tools/test.py @@ -27,7 +27,7 @@ sys.path.insert(0, ROOT) from tools.test_api import test_path_to_name, find_tests, print_tests, build_tests, test_spec_from_test_build from tools.options import get_default_options_parser -from tools.build_api import build_project +from tools.build_api import build_project, build_library from tools.targets import TARGET_MAP from tools.utils import mkdir @@ -115,10 +115,17 @@ if __name__ == '__main__': if not base_source_paths: base_source_paths = ['.'] + target = TARGET_MAP[options.mcu] + lib_build_res = build_library(base_source_paths, options.build_dir, target, options.tool, + options=options.options, + jobs=options.jobs, + clean=options.clean, + archive=False) + # Build all the tests - test_build = build_tests(tests, base_source_paths, options.build_dir, target, options.tool, + test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool, options=options.options, clean=options.clean, jobs=options.jobs) diff --git a/tools/test_api.py b/tools/test_api.py index 44a6b6aed6..812d5667d3 100644 --- a/tools/test_api.py +++ b/tools/test_api.py @@ -2041,13 +2041,13 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name, } for test_name, test_path in tests.iteritems(): + test_build_path = os.path.join(build_path, test_path) src_path = base_source_paths + [test_path] - artifact_name = os.path.join(test_path, test_name) - bin_file = build_project(src_path, build_path, target, toolchain_name, + bin_file = build_project(src_path, test_build_path, target, toolchain_name, options=options, jobs=jobs, clean=clean, - name=artifact_name, + name=test_name, report=report, properties=properties, verbose=verbose)