Move to feature filter for target and toolchain detection; print passed tests

pull/2576/head
Jimmy Brisson 2016-08-29 14:38:16 -05:00
parent 78028a9ceb
commit f7a1d1f749
2 changed files with 36 additions and 23 deletions

View File

@ -1,8 +1,8 @@
{ {
"https://developer.mbed.org/teams/mbed/code/mbed_blinky" : ["K64F"], "https://developer.mbed.org/teams/mbed/code/mbed_blinky" : [],
"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-Beacon" : ["BLE"],
"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-ble-HeartRate" : ["BLE"],
"https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal" :["K64F"], "https://developer.mbed.org/teams/mbed-os-examples/code/mbed-os-example-mesh-minimal" :["IPV4"],
"https://github.com/ARMmbed/mbed-os-example-client" : ["K64F"], "https://github.com/ARMmbed/mbed-os-example-client" : ["IPV4"],
"https://github.com/ARMmbed/mbed-os-example-sockets" : ["K64F", "VK_RZ_A1H", "LPC1768"] "https://github.com/ARMmbed/mbed-os-example-sockets" : ["IPV4"]
} }

View File

@ -1,42 +1,55 @@
""" import and bulid a bunch of example programs """ """ import and bulid a bunch of example programs """
import os import os
from os.path import dirname, abspath, basename
import os.path import os.path
import sys import sys
import subprocess import subprocess
import json import json
ROOT = abspath(dirname(dirname(dirname(dirname(__file__)))))
sys.path.insert(0, ROOT)
from tools.build_api import get_mbed_official_release
from tools.targets import TARGET_MAP
EXAMPLES = json.load(open(os.path.join(os.path.dirname(__file__), EXAMPLES = json.load(open(os.path.join(os.path.dirname(__file__),
"examples.json"))) "examples.json")))
BUILD_TOOLCHAINS = [ def print_stuff(name, lst):
"ARM", if list:
"GCC_ARM", print("#"*80)
"IAR", print("# {} example combinations".format(name))
] print("#")
for thing in lst:
print(thing)
def main(): def main():
"""Entry point""" """Entry point"""
failures = [] failures = []
for example, build_targets in EXAMPLES.iteritems(): sucesses = []
for example, build_features in EXAMPLES.iteritems():
subprocess.call(["mbed-cli", "import", example]) subprocess.call(["mbed-cli", "import", example])
os.chdir(os.path.basename(example)) os.chdir(basename(example))
for toolchain in BUILD_TOOLCHAINS: for target, toolchains in [(target, toolchains) for target, toolchains
for target in build_targets: in get_mbed_official_release("5") if
all(feature in TARGET_MAP[target].features
for feature in build_features)]:
for toolchain in toolchains:
proc = subprocess.Popen(["mbed-cli", "compile", "-t", proc = subprocess.Popen(["mbed-cli", "compile", "-t",
toolchain, "-m", target]) toolchain, "-m", target])
proc.wait() proc.wait()
example_name = "{} {} {}".format(basename(example), target,
toolchain)
if proc.returncode: if proc.returncode:
failures.append("{} {} {}".format(example, target, failures.append(example_name)
toolchain)) else:
sucesses.append(example_name)
os.chdir("..") os.chdir("..")
if failures: print_stuff("Passed", sucesses)
print("#"*80) print_stuff("Failed", failures)
print("# Failed example combinations")
print("#")
for fail in failures:
print(fail)
return len(failures) return len(failures)
if __name__ == "__main__": if __name__ == "__main__":