Skip to content

Commit 299af97

Browse files
Merge pull request #5247 from kegilbert/example-build-profile-arg
Add profile argument to mbed-os example build tools
2 parents d3d7e0c + f8fa902 commit 299af97

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("--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
@@ -314,7 +314,7 @@ def status(message):
314314
return results
315315

316316

317-
def compile_repos(config, toolchains, targets, examples):
317+
def compile_repos(config, toolchains, targets, profile, examples):
318318
"""Compiles combinations of example programs, targets and compile chains.
319319
320320
The results are returned in a [key: value] dictionary format:
@@ -358,8 +358,14 @@ def compile_repos(config, toolchains, targets, examples):
358358
valid_choices(example['toolchains'], toolchains),
359359
example['features']):
360360
print("Compiling %s for %s, %s" % (name, target, toolchain))
361-
proc = subprocess.Popen(["mbed-cli", "compile", "-t", toolchain,
362-
"-m", target, "-v"])
361+
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target, "-v"]
362+
363+
if profile:
364+
build_command.append("--profile")
365+
build_command.append(profile)
366+
367+
proc = subprocess.Popen(build_command)
368+
363369
proc.wait()
364370
example_summary = "{} {} {}".format(name, target, toolchain)
365371
if proc.returncode:

0 commit comments

Comments
 (0)