Skip to content

Commit e6ea6aa

Browse files
Olli-Pekka Puolitaivaladbridge
authored andcommitted
Make able to define build jobs amount when building examples
1 parent 2a6b2f7 commit e6ea6aa

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

tools/test/examples/examples.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ def main():
7777
help=("build profile file"),
7878
metavar="profile")
7979

80+
compile_cmd.add_argument("-j", "--jobs",
81+
dest='jobs',
82+
metavar="NUMBER",
83+
type=int,
84+
default=0,
85+
help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")
86+
8087
compile_cmd.add_argument("-v", "--verbose",
8188
action="store_true",
8289
dest="verbose",
@@ -136,8 +143,7 @@ def do_deploy(_, config, examples):
136143

137144
def do_compile(args, config, examples):
138145
"""Do the compile step"""
139-
results = {}
140-
results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, args.verbose, examples)
146+
results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, args.verbose, examples, args.jobs)
141147
lib.print_summary(results)
142148
failures = lib.get_num_failures(results)
143149
print("Number of failures = %d" % failures)

tools/test/examples/examples_lib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def status(message):
349349
return results
350350

351351

352-
def compile_repos(config, toolchains, targets, profile, verbose, examples):
352+
def compile_repos(config, toolchains, targets, profile, verbose, examples, jobs=0):
353353
"""Compiles combinations of example programs, targets and compile chains.
354354
355355
The results are returned in a [key: value] dictionary format:
@@ -398,7 +398,7 @@ def compile_repos(config, toolchains, targets, profile, verbose, examples):
398398
valid_choices(example['toolchains'], toolchains),
399399
example['features']):
400400

401-
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target] + (['-vv'] if verbose else [])
401+
build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target, "-j", str(jobs)] + (['-vv'] if verbose else [])
402402
if profile:
403403
build_command.append("--profile")
404404
build_command.append(profile)

0 commit comments

Comments
 (0)