Skip to content

Commit e0b0ad0

Browse files
committed
Adding build profiles configuration to build_release.py and singletest.py
1 parent 7252dae commit e0b0ad0

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

tools/build_release.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from tools.build_api import build_mbed_libs
3030
from tools.build_api import write_build_report
3131
from tools.build_api import get_mbed_official_release
32+
from tools.options import extract_profile
3233
from tools.targets import TARGET_MAP, TARGET_NAMES
3334
from tools.test_exporters import ReportExporter, ResultExporterType
3435
from tools.test_api import SingleTestRunner
@@ -48,6 +49,8 @@
4849
default=False, help="Verbose diagnostic output")
4950
parser.add_option("-t", "--toolchains", dest="toolchains", help="Use toolchains names separated by comma")
5051

52+
parser.add_option("--profile", dest="profile", action="append", default=[])
53+
5154
parser.add_option("-p", "--platforms", dest="platforms", default="", help="Build only for the platform namesseparated by comma")
5255

5356
parser.add_option("-L", "--list-config", action="store_true", dest="list_config",
@@ -127,6 +130,8 @@
127130
test_spec["targets"][target_name] = toolchains
128131

129132
single_test = SingleTestRunner(_muts=mut,
133+
_parser=parser,
134+
_opts=options,
130135
_opts_report_build_file_name=options.report_build_file_name,
131136
_test_spec=test_spec,
132137
_opts_test_by_names=",".join(test_names),
@@ -162,8 +167,16 @@
162167
for toolchain in toolchains:
163168
id = "%s::%s" % (target_name, toolchain)
164169

170+
profile = extract_profile(parser, options, toolchain)
171+
165172
try:
166-
built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], toolchain, verbose=options.verbose, jobs=options.jobs, report=build_report, properties=build_properties)
173+
built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name],
174+
toolchain,
175+
verbose=options.verbose,
176+
jobs=options.jobs,
177+
report=build_report,
178+
properties=build_properties,
179+
build_profile=profile)
167180

168181
except Exception, e:
169182
print str(e)

tools/singletest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ def get_version():
225225
_test_loops_list=opts.test_loops_list,
226226
_muts=MUTs,
227227
_clean=opts.clean,
228+
_parser=parser,
229+
_opts=opts,
228230
_opts_db_url=opts.db_url,
229231
_opts_log_file_name=opts.log_file_name,
230232
_opts_report_html_file_name=opts.report_html_file_name,

tools/test_api.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
from tools.build_api import prepare_toolchain
6161
from tools.build_api import scan_resources
6262
from tools.libraries import LIBRARIES, LIBRARY_MAP
63+
from tools.options import extract_profile
6364
from tools.toolchains import TOOLCHAIN_PATHS
6465
from tools.toolchains import TOOLCHAINS
6566
from tools.test_exporters import ReportExporter, ResultExporterType
@@ -170,6 +171,8 @@ def __init__(self,
170171
_test_loops_list=None,
171172
_muts={},
172173
_clean=False,
174+
_parser=None,
175+
_opts=None,
173176
_opts_db_url=None,
174177
_opts_log_file_name=None,
175178
_opts_report_html_file_name=None,
@@ -258,6 +261,8 @@ def __init__(self,
258261
self.opts_consolidate_waterfall_test = _opts_consolidate_waterfall_test
259262
self.opts_extend_test_timeout = _opts_extend_test_timeout
260263
self.opts_clean = _clean
264+
self.opts_parser = _parser
265+
self.opts = _opts
261266
self.opts_auto_detect = _opts_auto_detect
262267
self.opts_include_non_automated = _opts_include_non_automated
263268

@@ -357,6 +362,8 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
357362

358363
clean_mbed_libs_options = True if self.opts_goanna_for_mbed_sdk or clean or self.opts_clean else None
359364

365+
profile = extract_profile(self.opts_parser, self.opts, toolchain)
366+
360367

361368
try:
362369
build_mbed_libs_result = build_mbed_libs(T,
@@ -365,7 +372,8 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
365372
verbose=self.opts_verbose,
366373
jobs=self.opts_jobs,
367374
report=build_report,
368-
properties=build_properties)
375+
properties=build_properties,
376+
build_profile=profile)
369377

370378
if not build_mbed_libs_result:
371379
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 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
433441
clean=clean_mbed_libs_options,
434442
jobs=self.opts_jobs,
435443
report=build_report,
436-
properties=build_properties)
444+
properties=build_properties,
445+
build_profile=profile)
437446

438447
except ToolException:
439448
print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building library %s'% (lib_id))
@@ -484,7 +493,8 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
484493
report=build_report,
485494
properties=build_properties,
486495
project_id=test_id,
487-
project_description=test.get_description())
496+
project_description=test.get_description(),
497+
build_profile=profile)
488498

489499
except Exception, e:
490500
project_name_str = project_name if project_name is not None else test_id
@@ -1784,6 +1794,10 @@ def get_default_test_options_parser():
17841794
action="store_true",
17851795
help='Test only peripheral declared for MUT and skip common tests')
17861796

1797+
parser.add_argument("--profile", dest="profile", action="append",
1798+
type=argparse_filestring_type,
1799+
default=[])
1800+
17871801
parser.add_argument('-C', '--only-commons',
17881802
dest='test_only_common',
17891803
default=False,

0 commit comments

Comments
 (0)