Merge pull request #2877 from bridadan/build-profiles-release-singletest

Adding build profiles to build_release.py and singletest.py
pull/2243/merge
Sam Grove 2016-09-30 18:29:26 -05:00 committed by GitHub
commit ff2d8df77c
7 changed files with 61 additions and 37 deletions

View File

@ -29,6 +29,7 @@ sys.path.insert(0, ROOT)
from tools.build_api import build_mbed_libs
from tools.build_api import write_build_report
from tools.build_api import get_mbed_official_release
from tools.options import extract_profile
from tools.targets import TARGET_MAP, TARGET_NAMES
from tools.test_exporters import ReportExporter, ResultExporterType
from tools.test_api import SingleTestRunner
@ -48,6 +49,8 @@ if __name__ == '__main__':
default=False, help="Verbose diagnostic output")
parser.add_option("-t", "--toolchains", dest="toolchains", help="Use toolchains names separated by comma")
parser.add_option("--profile", dest="profile", action="append", default=[])
parser.add_option("-p", "--platforms", dest="platforms", default="", help="Build only for the platform namesseparated by comma")
parser.add_option("-L", "--list-config", action="store_true", dest="list_config",
@ -127,6 +130,8 @@ if __name__ == '__main__':
test_spec["targets"][target_name] = toolchains
single_test = SingleTestRunner(_muts=mut,
_parser=parser,
_opts=options,
_opts_report_build_file_name=options.report_build_file_name,
_test_spec=test_spec,
_opts_test_by_names=",".join(test_names),
@ -162,8 +167,16 @@ if __name__ == '__main__':
for toolchain in toolchains:
id = "%s::%s" % (target_name, toolchain)
profile = extract_profile(parser, options, toolchain)
try:
built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], toolchain, verbose=options.verbose, jobs=options.jobs, report=build_report, properties=build_properties)
built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name],
toolchain,
verbose=options.verbose,
jobs=options.jobs,
report=build_report,
properties=build_properties,
build_profile=profile)
except Exception, e:
print str(e)

View File

@ -22,6 +22,16 @@
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
"ld": []
},
"uARM": {
"common": ["-c", "--gnu", "-Otime", "--split_sections",
"--apcs=interwork", "--brief_diagnostics", "--restrict",
"--multibyte_chars", "-O0", "-D__MICROLIB", "-g"
"--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD"],
"asm": [],
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
"ld": ["--library_type=microlib"]
},
"IAR": {
"common": [
"--no_wrap_diagnostics", "non-native end of line sequence", "-e",

View File

@ -22,6 +22,16 @@
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
"ld": []
},
"uARM": {
"common": ["-c", "--gnu", "-Otime", "--split_sections",
"--apcs=interwork", "--brief_diagnostics", "--restrict",
"--multibyte_chars", "-O3", "-D__MICROLIB",
"--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD"],
"asm": [],
"c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
"ld": ["--library_type=microlib"]
},
"IAR": {
"common": [
"--no_wrap_diagnostics", "-e",

View File

@ -12,5 +12,12 @@
"c": [],
"cxx": [],
"ld": []
},
"uARM": {
"common": ["--asm", "--interleave"],
"asm": [],
"c": [],
"cxx": [],
"ld": []
}
}

View File

@ -225,6 +225,8 @@ if __name__ == '__main__':
_test_loops_list=opts.test_loops_list,
_muts=MUTs,
_clean=opts.clean,
_parser=parser,
_opts=opts,
_opts_db_url=opts.db_url,
_opts_log_file_name=opts.log_file_name,
_opts_report_html_file_name=opts.report_html_file_name,

View File

@ -60,6 +60,7 @@ from tools.build_api import add_result_to_report
from tools.build_api import prepare_toolchain
from tools.build_api import scan_resources
from tools.libraries import LIBRARIES, LIBRARY_MAP
from tools.options import extract_profile
from tools.toolchains import TOOLCHAIN_PATHS
from tools.toolchains import TOOLCHAINS
from tools.test_exporters import ReportExporter, ResultExporterType
@ -170,6 +171,8 @@ class SingleTestRunner(object):
_test_loops_list=None,
_muts={},
_clean=False,
_parser=None,
_opts=None,
_opts_db_url=None,
_opts_log_file_name=None,
_opts_report_html_file_name=None,
@ -258,6 +261,8 @@ class SingleTestRunner(object):
self.opts_consolidate_waterfall_test = _opts_consolidate_waterfall_test
self.opts_extend_test_timeout = _opts_extend_test_timeout
self.opts_clean = _clean
self.opts_parser = _parser
self.opts = _opts
self.opts_auto_detect = _opts_auto_detect
self.opts_include_non_automated = _opts_include_non_automated
@ -357,6 +362,8 @@ class SingleTestRunner(object):
clean_mbed_libs_options = True if self.opts_goanna_for_mbed_sdk or clean or self.opts_clean else None
profile = extract_profile(self.opts_parser, self.opts, toolchain)
try:
build_mbed_libs_result = build_mbed_libs(T,
@ -365,7 +372,8 @@ class SingleTestRunner(object):
verbose=self.opts_verbose,
jobs=self.opts_jobs,
report=build_report,
properties=build_properties)
properties=build_properties,
build_profile=profile)
if not build_mbed_libs_result:
print self.logger.log_line(self.logger.LogType.NOTIF, 'Skipped tests for %s target. Toolchain %s is not yet supported for this target'% (T.name, toolchain))
@ -433,7 +441,8 @@ class SingleTestRunner(object):
clean=clean_mbed_libs_options,
jobs=self.opts_jobs,
report=build_report,
properties=build_properties)
properties=build_properties,
build_profile=profile)
except ToolException:
print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building library %s'% (lib_id))
@ -484,7 +493,8 @@ class SingleTestRunner(object):
report=build_report,
properties=build_properties,
project_id=test_id,
project_description=test.get_description())
project_description=test.get_description(),
build_profile=profile)
except Exception, e:
project_name_str = project_name if project_name is not None else test_id
@ -1784,6 +1794,10 @@ def get_default_test_options_parser():
action="store_true",
help='Test only peripheral declared for MUT and skip common tests')
parser.add_argument("--profile", dest="profile", action="append",
type=argparse_filestring_type,
default=[])
parser.add_argument('-C', '--only-commons',
dest='test_only_common',
default=False,

View File

@ -240,37 +240,5 @@ class ARM_MICRO(ARM):
ARM.__init__(self, target, notify, macros, silent,
extra_verbose=extra_verbose, build_profile=build_profile)
# Extend flags
self.flags['common'].extend(["-D__MICROLIB"])
self.flags['c'].extend(["--library_type=microlib"])
self.flags['ld'].extend(["--library_type=microlib"])
# Run-time values
self.asm += ["-D__MICROLIB"]
self.cc += ["-D__MICROLIB", "--library_type=microlib"]
self.cppc += ["-D__MICROLIB", "--library_type=microlib"]
self.ld += ["--library_type=microlib"]
# Only allow a single thread
self.cc += ["-DMBED_RTOS_SINGLE_THREAD"]
self.cppc += ["-DMBED_RTOS_SINGLE_THREAD"]
# We had to patch microlib to add C++ support
# In later releases this patch should have entered mainline
if ARM_MICRO.PATCHED_LIBRARY:
# Run-time values
self.flags['ld'].extend(["--noscanlib"])
# Run-time values
self.ld += ["--noscanlib"]
# System Libraries
self.sys_libs.extend([join(TOOLCHAIN_PATHS['ARM'], "lib", "microlib", lib+".l") for lib in ["mc_p", "mf_p", "m_ps"]])
if target.core == "Cortex-M3":
self.sys_libs.extend([join(TOOLCHAIN_PATHS['ARM'], "lib", "cpplib", lib+".l") for lib in ["cpp_ws", "cpprt_w"]])
elif target.core in ["Cortex-M0", "Cortex-M0+"]:
self.sys_libs.extend([join(TOOLCHAIN_PATHS['ARM'], "lib", "cpplib", lib+".l") for lib in ["cpp_ps", "cpprt_p"]])
else:
# Run-time values
self.ld.extend(["--libpath", join(TOOLCHAIN_PATHS['ARM'], "lib")])
self.ld.extend(["--libpath", join(TOOLCHAIN_PATHS['ARM'], "lib")])