diff --git a/tools/test/examples/examples.py b/tools/test/examples/examples.py index 5974633630..f8f7e69b50 100644 --- a/tools/test/examples/examples.py +++ b/tools/test/examples/examples.py @@ -77,6 +77,13 @@ def main(): help=("build profile file"), metavar="profile") + compile_cmd.add_argument("-j", "--jobs", + dest='jobs', + metavar="NUMBER", + type=int, + default=0, + help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)") + compile_cmd.add_argument("-v", "--verbose", action="store_true", dest="verbose", @@ -136,8 +143,7 @@ def do_deploy(_, config, examples): def do_compile(args, config, examples): """Do the compile step""" - results = {} - results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, args.verbose, examples) + results = lib.compile_repos(config, args.toolchains, args.mcu, args.profile, args.verbose, examples, args.jobs) lib.print_summary(results) failures = lib.get_num_failures(results) print("Number of failures = %d" % failures) diff --git a/tools/test/examples/examples_lib.py b/tools/test/examples/examples_lib.py index df54d9a8e3..4d57cdc1d8 100644 --- a/tools/test/examples/examples_lib.py +++ b/tools/test/examples/examples_lib.py @@ -349,7 +349,7 @@ def export_repos(config, ides, targets, examples): return results -def compile_repos(config, toolchains, targets, profile, verbose, examples): +def compile_repos(config, toolchains, targets, profile, verbose, examples, jobs=0): """Compiles combinations of example programs, targets and compile chains. The results are returned in a [key: value] dictionary format: @@ -398,7 +398,7 @@ def compile_repos(config, toolchains, targets, profile, verbose, examples): valid_choices(example['toolchains'], toolchains), example['features']): - build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target] + (['-vv'] if verbose else []) + build_command = ["mbed-cli", "compile", "-t", toolchain, "-m", target, "-j", str(jobs)] + (['-vv'] if verbose else []) if profile: build_command.append("--profile") build_command.append(profile)