Skip to content

Commit 95ee4f6

Browse files
committed
Use json for the example to target mapping and print failures
1 parent eb11561 commit 95ee4f6

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

tools/test/examples.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"https://developer.mbed.org/teams/mbed/code/mbed_blinky" : ["K64F"],
3+
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-Beacon" : ["NRF51_DK"],
4+
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-HeartRate" : ["NRF51_DK"],
5+
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal" :["K64F"],
6+
"https://github.com/ARMmbed/mbed-os-example-client" : ["K64F"],
7+
"https://github.com/ARMmbed/mbed-os-example-sockets" : ["K64F", "VK_RZ_A1H", "LPC1768"]
8+
}

tools/test/examples.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,42 @@
22

33
import os
44
import os.path
5+
import sys
56
import subprocess
7+
import json
68

79

8-
EXAMPLES = [
9-
"https://developer.mbed.org/teams/mbed/code/mbed_blinky"
10-
]
10+
EXAMPLES = json.load(open(os.path.join(os.path.dirname(__file__),
11+
"examples.json")))
1112

1213
BUILD_TOOLCHAINS = [
1314
"ARM",
1415
"GCC_ARM",
1516
"IAR",
1617
]
1718

18-
BUILD_TARGETS = [
19-
"K64F"
20-
]
21-
2219
def main():
2320
"""Entry point"""
24-
for example in EXAMPLES:
21+
failures = []
22+
for example, build_targets in EXAMPLES.iteritems():
2523
subprocess.call(["mbed-cli", "import", example])
2624
os.chdir(os.path.basename(example))
2725
for toolchain in BUILD_TOOLCHAINS:
28-
for target in BUILD_TARGETS:
29-
subprocess.Popen(["mbed-cli", "compile", "-t", toolchain, "-m",
30-
target]).wait()
26+
for target in build_targets:
27+
proc = subprocess.Popen(["mbed-cli", "compile", "-t",
28+
toolchain, "-m", target])
29+
proc.wait()
30+
if proc.returncode:
31+
failures.append("{} {} {}".format(example, target,
32+
toolchain))
3133
os.chdir("..")
34+
if failures:
35+
print("#"*80)
36+
print("# Failed example combinations")
37+
print("#")
38+
for fail in failures:
39+
print(fail)
40+
return len(failures)
3241

3342
if __name__ == "__main__":
34-
main()
43+
sys.exit(main())

0 commit comments

Comments
 (0)