Skip to content

Commit f983292

Browse files
committed
Separate the import and compile steps for better integration with Jenkins
1 parent ac5c685 commit f983292

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

tools/test/examples/examples.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,33 @@ def target_cross_toolchain(allowed_toolchains,
5252
yield target, toolchain
5353

5454

55-
5655
def main():
5756
"""Entry point"""
5857
parser = ArgumentParser()
59-
parser.add_argument(
58+
subparsers = parser.add_subparsers()
59+
import_cmd = subparsers.add_parser("import")
60+
import_cmd.set_defaults(fn=do_import)
61+
compile_cmd = subparsers.add_parser("compile")
62+
compile_cmd.set_defaults(fn=do_compile)
63+
compile_cmd.add_argument(
6064
"toolchains", nargs="*", default=SUPPORTED_TOOLCHAINS,
6165
type=argparse_force_uppercase_type(SUPPORTED_TOOLCHAINS,
6266
"toolchain"))
6367
args = parser.parse_args()
68+
args.fn(args)
69+
70+
71+
def do_import(_):
72+
"""Do the import step of this process"""
73+
for example, _ in EXAMPLES.iteritems():
74+
subprocess.call(["mbed-cli", "import", example])
75+
6476

77+
def do_compile(args):
78+
"""Do the compile step"""
6579
failures = []
6680
sucesses = []
6781
for example, requirements in EXAMPLES.iteritems():
68-
subprocess.call(["mbed-cli", "import", example])
6982
os.chdir(basename(example))
7083
for target, toolchain in target_cross_toolchain(args.toolchains,
7184
**requirements):

0 commit comments

Comments
 (0)