Skip to content

Commit 310f833

Browse files
committed
Add profile argument to mbed-os example build tools to allow non-default build profiles to be passed in
1 parent 003dd7c commit 310f833

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

tools/test/examples/examples.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ def main():
5454
argparse_force_uppercase_type(
5555
official_target_names, "MCU")),
5656
default=official_target_names)
57+
58+
compile_cmd.add_argument("-p", "--profile",
59+
help=("build profile file"),
60+
metavar="profile")
61+
5762
export_cmd = subparsers.add_parser("export")
5863
export_cmd.set_defaults(fn=do_export),
5964
export_cmd.add_argument(
@@ -111,7 +116,7 @@ def do_deploy(_, config, examples):
111116
def do_compile(args, config, examples):
112117
"""Do the compile step"""
113118
results = {}
114-
results = lib.compile_repos(config, args.toolchains, args.mcu, examples)
119+
results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, examples)
115120

116121
lib.print_summary(results)
117122
failures = lib.get_num_failures(results)

tools/test/examples/examples_lib.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def status(message):
311311
return results
312312

313313

314-
def compile_repos(config, toolchains, targets, examples):
314+
def compile_repos(config, toolchains, targets, profile, examples):
315315
"""Compiles combinations of example programs, targets and compile chains.
316316
317317
The results are returned in a [key: value] dictionary format:
@@ -355,8 +355,14 @@ def compile_repos(config, toolchains, targets, examples):
355355
valid_choices(example['toolchains'], toolchains),
356356
example['features']):
357357
print("Compiling %s for %s, %s" % (name, target, toolchain))
358-
proc = subprocess.Popen(["mbed-cli", "compile", "-t", toolchain,
359-
"-m", target, "-v"])
358+
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target, "-v"]
359+
360+
if profile:
361+
build_command.append("--profile")
362+
build_command.append(profile)
363+
364+
proc = subprocess.Popen(build_command)
365+
360366
proc.wait()
361367
example_summary = "{} {} {}".format(name, target, toolchain)
362368
if proc.returncode:

0 commit comments

Comments
 (0)