Adding build profiles configuration to build_release.py and singletest.py

pull/2877/head
Brian Daniels 2016-09-30 16:54:34 -05:00
parent 7252dae5f4
commit e0b0ad05cb
3 changed files with 33 additions and 4 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 build_mbed_libs
from tools.build_api import write_build_report from tools.build_api import write_build_report
from tools.build_api import get_mbed_official_release 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.targets import TARGET_MAP, TARGET_NAMES
from tools.test_exporters import ReportExporter, ResultExporterType from tools.test_exporters import ReportExporter, ResultExporterType
from tools.test_api import SingleTestRunner from tools.test_api import SingleTestRunner
@ -48,6 +49,8 @@ if __name__ == '__main__':
default=False, help="Verbose diagnostic output") default=False, help="Verbose diagnostic output")
parser.add_option("-t", "--toolchains", dest="toolchains", help="Use toolchains names separated by comma") 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("-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", 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 test_spec["targets"][target_name] = toolchains
single_test = SingleTestRunner(_muts=mut, single_test = SingleTestRunner(_muts=mut,
_parser=parser,
_opts=options,
_opts_report_build_file_name=options.report_build_file_name, _opts_report_build_file_name=options.report_build_file_name,
_test_spec=test_spec, _test_spec=test_spec,
_opts_test_by_names=",".join(test_names), _opts_test_by_names=",".join(test_names),
@ -162,8 +167,16 @@ if __name__ == '__main__':
for toolchain in toolchains: for toolchain in toolchains:
id = "%s::%s" % (target_name, toolchain) id = "%s::%s" % (target_name, toolchain)
profile = extract_profile(parser, options, toolchain)
try: 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: except Exception, e:
print str(e) print str(e)

View File

@ -225,6 +225,8 @@ if __name__ == '__main__':
_test_loops_list=opts.test_loops_list, _test_loops_list=opts.test_loops_list,
_muts=MUTs, _muts=MUTs,
_clean=opts.clean, _clean=opts.clean,
_parser=parser,
_opts=opts,
_opts_db_url=opts.db_url, _opts_db_url=opts.db_url,
_opts_log_file_name=opts.log_file_name, _opts_log_file_name=opts.log_file_name,
_opts_report_html_file_name=opts.report_html_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 prepare_toolchain
from tools.build_api import scan_resources from tools.build_api import scan_resources
from tools.libraries import LIBRARIES, LIBRARY_MAP from tools.libraries import LIBRARIES, LIBRARY_MAP
from tools.options import extract_profile
from tools.toolchains import TOOLCHAIN_PATHS from tools.toolchains import TOOLCHAIN_PATHS
from tools.toolchains import TOOLCHAINS from tools.toolchains import TOOLCHAINS
from tools.test_exporters import ReportExporter, ResultExporterType from tools.test_exporters import ReportExporter, ResultExporterType
@ -170,6 +171,8 @@ class SingleTestRunner(object):
_test_loops_list=None, _test_loops_list=None,
_muts={}, _muts={},
_clean=False, _clean=False,
_parser=None,
_opts=None,
_opts_db_url=None, _opts_db_url=None,
_opts_log_file_name=None, _opts_log_file_name=None,
_opts_report_html_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_consolidate_waterfall_test = _opts_consolidate_waterfall_test
self.opts_extend_test_timeout = _opts_extend_test_timeout self.opts_extend_test_timeout = _opts_extend_test_timeout
self.opts_clean = _clean self.opts_clean = _clean
self.opts_parser = _parser
self.opts = _opts
self.opts_auto_detect = _opts_auto_detect self.opts_auto_detect = _opts_auto_detect
self.opts_include_non_automated = _opts_include_non_automated 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 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: try:
build_mbed_libs_result = build_mbed_libs(T, build_mbed_libs_result = build_mbed_libs(T,
@ -365,7 +372,8 @@ class SingleTestRunner(object):
verbose=self.opts_verbose, verbose=self.opts_verbose,
jobs=self.opts_jobs, jobs=self.opts_jobs,
report=build_report, report=build_report,
properties=build_properties) properties=build_properties,
build_profile=profile)
if not build_mbed_libs_result: 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)) 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, clean=clean_mbed_libs_options,
jobs=self.opts_jobs, jobs=self.opts_jobs,
report=build_report, report=build_report,
properties=build_properties) properties=build_properties,
build_profile=profile)
except ToolException: except ToolException:
print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building library %s'% (lib_id)) 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, report=build_report,
properties=build_properties, properties=build_properties,
project_id=test_id, project_id=test_id,
project_description=test.get_description()) project_description=test.get_description(),
build_profile=profile)
except Exception, e: except Exception, e:
project_name_str = project_name if project_name is not None else test_id 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", action="store_true",
help='Test only peripheral declared for MUT and skip common tests') 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', parser.add_argument('-C', '--only-commons',
dest='test_only_common', dest='test_only_common',
default=False, default=False,