mirror of https://github.com/ARMmbed/mbed-os.git
Capable of testing export only to IDEs that do not have build functions
parent
f91bfe3df1
commit
d55e739c66
|
@ -19,7 +19,8 @@ from tools.targets import TARGET_MAP
|
||||||
from tools.export import EXPORTERS
|
from tools.export import EXPORTERS
|
||||||
|
|
||||||
SUPPORTED_TOOLCHAINS = ["ARM", "IAR", "GCC_ARM"]
|
SUPPORTED_TOOLCHAINS = ["ARM", "IAR", "GCC_ARM"]
|
||||||
SUPPORTED_IDES = ["iar", "uvision", "make_gcc_arm", "make_iar", "make_armc5"]
|
SUPPORTED_IDES = [exp for exp in EXPORTERS.keys() if exp != "cmsis" and exp != "zip"]
|
||||||
|
|
||||||
|
|
||||||
def print_list(lst):
|
def print_list(lst):
|
||||||
"""Prints to screen the contents of a list
|
"""Prints to screen the contents of a list
|
||||||
|
@ -32,6 +33,21 @@ def print_list(lst):
|
||||||
for thing in lst:
|
for thing in lst:
|
||||||
print("# %s" % thing)
|
print("# %s" % thing)
|
||||||
|
|
||||||
|
|
||||||
|
def print_category(results, index, message):
|
||||||
|
summary = [example for key, summ in results.iteritems()
|
||||||
|
for example in summ[index]]
|
||||||
|
if all(len(s) == 0 for s in summary):
|
||||||
|
return
|
||||||
|
print("#")
|
||||||
|
print("#" * 80)
|
||||||
|
print("# %s" % message)
|
||||||
|
print("#" * 80)
|
||||||
|
split_summ = [s.rsplit(" ", 1) for s in summary]
|
||||||
|
|
||||||
|
print_list(summary)
|
||||||
|
|
||||||
|
|
||||||
def print_summary(results, export=False):
|
def print_summary(results, export=False):
|
||||||
"""Prints to screen the results of compiling/exporting combinations of example programs,
|
"""Prints to screen the results of compiling/exporting combinations of example programs,
|
||||||
targets and compile toolchains/IDEs.
|
targets and compile toolchains/IDEs.
|
||||||
|
@ -45,27 +61,17 @@ def print_summary(results, export=False):
|
||||||
print("#"*80)
|
print("#"*80)
|
||||||
print("# Examples compilation summary")
|
print("# Examples compilation summary")
|
||||||
print("#"*80)
|
print("#"*80)
|
||||||
print("#")
|
|
||||||
print("# Passed example combinations")
|
print_category(results, 2, "Passed example combinations")
|
||||||
print("#")
|
|
||||||
for key, val in results.iteritems():
|
|
||||||
print_list(val[2])
|
|
||||||
|
|
||||||
second_result = "Failed example combinations" if not export else \
|
second_result = "Failed example combinations" if not export else \
|
||||||
"Failed export example combinations"
|
"Failed export example combinations"
|
||||||
|
|
||||||
print("#")
|
print_category(results, 3, second_result)
|
||||||
print("# %s"%second_result)
|
|
||||||
print("#")
|
|
||||||
for key, val in results.iteritems():
|
|
||||||
print_list(val[3])
|
|
||||||
|
|
||||||
if export:
|
if export:
|
||||||
print("#")
|
print_category(results, 4, "Failed build combinations")
|
||||||
print("# Failed build example combinations")
|
print_category(results, 5, "Skipped build combinations")
|
||||||
print("#")
|
|
||||||
for key, val in results.iteritems():
|
|
||||||
print_list(val[4])
|
|
||||||
|
|
||||||
print("#")
|
print("#")
|
||||||
print("#"*80)
|
print("#"*80)
|
||||||
|
@ -141,6 +147,7 @@ def get_repo_list(example):
|
||||||
repos.append(example['github'])
|
repos.append(example['github'])
|
||||||
return repos
|
return repos
|
||||||
|
|
||||||
|
|
||||||
def source_repos(config):
|
def source_repos(config):
|
||||||
""" Clones each of the repos associated with the specific examples name from the
|
""" Clones each of the repos associated with the specific examples name from the
|
||||||
json config file. Note if there is already a clone of the repo then it will first
|
json config file. Note if there is already a clone of the repo then it will first
|
||||||
|
@ -159,6 +166,7 @@ def source_repos(config):
|
||||||
|
|
||||||
subprocess.call(["mbed-cli", "import", repo])
|
subprocess.call(["mbed-cli", "import", repo])
|
||||||
|
|
||||||
|
|
||||||
def get_num_failures(results, export=False):
|
def get_num_failures(results, export=False):
|
||||||
""" Returns the number of failed compilations from the results summary
|
""" Returns the number of failed compilations from the results summary
|
||||||
Args:
|
Args:
|
||||||
|
@ -178,15 +186,36 @@ def get_num_failures(results, export=False):
|
||||||
|
|
||||||
|
|
||||||
def export_repos(config, ides):
|
def export_repos(config, ides):
|
||||||
def print_message(message, name):
|
"""Exports and builds combinations of example programs, targets and IDEs.
|
||||||
print(message+ " %s"%name)
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
|
The results are returned in a [key: value] dictionary format:
|
||||||
|
Where key = The example name from the json config file
|
||||||
|
value = a list containing: pass_status, successes, export failures, build_failures,
|
||||||
|
and build_skips
|
||||||
|
|
||||||
|
where pass_status = The overall pass status for the export of the full
|
||||||
|
set of example programs comprising the example suite.
|
||||||
|
(IE they must build and export)
|
||||||
|
True if all examples pass, false otherwise
|
||||||
|
successes = list of examples that exported and built (if possible)
|
||||||
|
If the exporter has no build functionality, then it is a pass
|
||||||
|
if exported
|
||||||
|
export_failures = list of examples that failed to export.
|
||||||
|
build_failures = list of examples that failed to build
|
||||||
|
build_skips = list of examples that cannot build
|
||||||
|
|
||||||
|
Both successes and failures contain the example name, target and IDE
|
||||||
|
|
||||||
|
Args:
|
||||||
|
config - the json object imported from the file.
|
||||||
|
ides - List of IDES to export to
|
||||||
|
"""
|
||||||
results = {}
|
results = {}
|
||||||
print("\nExporting example repos....\n")
|
print("\nExporting example repos....\n")
|
||||||
for example in config['examples']:
|
for example in config['examples']:
|
||||||
export_failures = []
|
export_failures = []
|
||||||
build_failures = []
|
build_failures = []
|
||||||
|
build_skips = []
|
||||||
successes = []
|
successes = []
|
||||||
exported = True
|
exported = True
|
||||||
pass_status = True
|
pass_status = True
|
||||||
|
@ -215,12 +244,16 @@ def export_repos(config, ides):
|
||||||
else:
|
else:
|
||||||
status("SUCCESS exporting")
|
status("SUCCESS exporting")
|
||||||
status("Building")
|
status("Building")
|
||||||
|
try:
|
||||||
if EXPORTERS[ide].build(example_project_name):
|
if EXPORTERS[ide].build(example_project_name):
|
||||||
status("FAILURE building")
|
status("FAILURE building")
|
||||||
build_failures.append(example_name)
|
build_failures.append(example_name)
|
||||||
else:
|
else:
|
||||||
status("SUCCESS building")
|
status("SUCCESS building")
|
||||||
successes.append(example_name)
|
successes.append(example_name)
|
||||||
|
except TypeError:
|
||||||
|
successes.append(example_name)
|
||||||
|
build_skips.append(example_name)
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
|
|
||||||
if len(build_failures+export_failures) > 0:
|
if len(build_failures+export_failures) > 0:
|
||||||
|
@ -228,7 +261,8 @@ def export_repos(config, ides):
|
||||||
else:
|
else:
|
||||||
exported = False
|
exported = False
|
||||||
|
|
||||||
results[example['name']] = [exported, pass_status, successes, export_failures, build_failures]
|
results[example['name']] = [exported, pass_status, successes,
|
||||||
|
export_failures, build_failures, build_skips]
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue