Use json for the example to target mapping and print failures

pull/2576/head
Jimmy Brisson 2016-08-29 13:46:39 -05:00
parent eb11561c1f
commit 95ee4f6370
2 changed files with 29 additions and 12 deletions

8
tools/test/examples.json Normal file
View File

@ -0,0 +1,8 @@
{
"https://developer.mbed.org/teams/mbed/code/mbed_blinky" : ["K64F"],
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-Beacon" : ["NRF51_DK"],
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-ble-HeartRate" : ["NRF51_DK"],
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal" :["K64F"],
"https://github.com/ARMmbed/mbed-os-example-client" : ["K64F"],
"https://github.com/ARMmbed/mbed-os-example-sockets" : ["K64F", "VK_RZ_A1H", "LPC1768"]
}

View File

@ -2,12 +2,13 @@
import os
import os.path
import sys
import subprocess
import json
EXAMPLES = [
"https://developer.mbed.org/teams/mbed/code/mbed_blinky"
]
EXAMPLES = json.load(open(os.path.join(os.path.dirname(__file__),
"examples.json")))
BUILD_TOOLCHAINS = [
"ARM",
@ -15,20 +16,28 @@ BUILD_TOOLCHAINS = [
"IAR",
]
BUILD_TARGETS = [
"K64F"
]
def main():
"""Entry point"""
for example in EXAMPLES:
failures = []
for example, build_targets in EXAMPLES.iteritems():
subprocess.call(["mbed-cli", "import", example])
os.chdir(os.path.basename(example))
for toolchain in BUILD_TOOLCHAINS:
for target in BUILD_TARGETS:
subprocess.Popen(["mbed-cli", "compile", "-t", toolchain, "-m",
target]).wait()
for target in build_targets:
proc = subprocess.Popen(["mbed-cli", "compile", "-t",
toolchain, "-m", target])
proc.wait()
if proc.returncode:
failures.append("{} {} {}".format(example, target,
toolchain))
os.chdir("..")
if failures:
print("#"*80)
print("# Failed example combinations")
print("#")
for fail in failures:
print(fail)
return len(failures)
if __name__ == "__main__":
main()
sys.exit(main())