From 4ae7d54830286328373afb7318ac9597c64a5936 Mon Sep 17 00:00:00 2001 From: Brian Daniels Date: Tue, 10 May 2016 12:05:48 +0100 Subject: [PATCH] Fixing build issues for tests. Build artifacts from previous builds were polluting the current build. Now shared sources are built as a library, then tests are built into their own folder. --- tools/test.py | 11 +++++++++-- tools/test_api.py | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/test.py b/tools/test.py index 136a55fda6f..e79c1dc6ac1 100644 --- a/tools/test.py +++ b/tools/test.py @@ -27,7 +27,7 @@ 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 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 44a6b6aed64..812d5667d3a 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)