Merge pull request #2102 from mbedmicro/fix_tests_with_config

Fix tests with config
pull/2112/head
Bogdan Marinescu 2016-07-06 11:09:20 +03:00 committed by GitHub
commit b8c64cd275
3 changed files with 15 additions and 6 deletions

View File

@ -282,6 +282,16 @@ def build_library(src_paths, build_path, target, toolchain_name,
# We will use default project name based on project folder name # We will use default project name based on project folder name
name = project_name name = project_name
# If the configuration object was not yet created, create it now
config = Config(target, src_paths)
# If the 'target' argument is a string, convert it to a target instance
if isinstance(target, str):
try:
target = TARGET_MAP[target]
except KeyError:
raise KeyError("Target '%s' not found" % target)
if report != None: if report != None:
start = time() start = time()
@ -355,9 +365,6 @@ def build_library(src_paths, build_path, target, toolchain_name,
else: else:
tmp_path = build_path tmp_path = build_path
# Handle configuration
config = Config(target)
# Load resources into the config system which might expand/modify resources based on config data # Load resources into the config system which might expand/modify resources based on config data
resources = config.load_resources(resources) resources = config.load_resources(resources)

View File

@ -132,7 +132,7 @@ if __name__ == '__main__':
base_source_paths = ['.'] base_source_paths = ['.']
target = TARGET_MAP[options.mcu] target = options.mcu
build_report = {} build_report = {}
build_properties = {} build_properties = {}

View File

@ -2030,9 +2030,11 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
execution_directory = "." execution_directory = "."
base_path = norm_relative_path(build_path, execution_directory) base_path = norm_relative_path(build_path, execution_directory)
target_name = target if isinstance(target, str) else target.name
test_build = { test_build = {
"platform": target.name, "platform": target_name,
"toolchain": toolchain_name, "toolchain": toolchain_name,
"base_path": base_path, "base_path": base_path,
"baud_rate": 9600, "baud_rate": 9600,
@ -2086,7 +2088,7 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
print 'Image: %s'% bin_file print 'Image: %s'% bin_file
test_builds = {} test_builds = {}
test_builds["%s-%s" % (target.name, toolchain_name)] = test_build test_builds["%s-%s" % (target_name, toolchain_name)] = test_build
return result, test_builds return result, test_builds