-
Notifications
You must be signed in to change notification settings - Fork 3k
[Exporter tests] Export only #3205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
from tools.export import EXPORTERS | ||
|
||
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): | ||
"""Prints to screen the contents of a list | ||
|
@@ -32,6 +33,21 @@ def print_list(lst): | |
for thing in lst: | ||
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): | ||
"""Prints to screen the results of compiling/exporting combinations of example programs, | ||
targets and compile toolchains/IDEs. | ||
|
@@ -45,27 +61,17 @@ def print_summary(results, export=False): | |
print("#"*80) | ||
print("# Examples compilation summary") | ||
print("#"*80) | ||
print("#") | ||
print("# Passed example combinations") | ||
print("#") | ||
for key, val in results.iteritems(): | ||
print_list(val[2]) | ||
|
||
print_category(results, 2, "Passed example combinations") | ||
|
||
second_result = "Failed example combinations" if not export else \ | ||
"Failed export example combinations" | ||
|
||
print("#") | ||
print("# %s"%second_result) | ||
print("#") | ||
for key, val in results.iteritems(): | ||
print_list(val[3]) | ||
|
||
print_category(results, 3, second_result) | ||
|
||
if export: | ||
print("#") | ||
print("# Failed build example combinations") | ||
print("#") | ||
for key, val in results.iteritems(): | ||
print_list(val[4]) | ||
print_category(results, 4, "Failed build combinations") | ||
print_category(results, 5, "Skipped build combinations") | ||
|
||
print("#") | ||
print("#"*80) | ||
|
@@ -141,6 +147,7 @@ def get_repo_list(example): | |
repos.append(example['github']) | ||
return repos | ||
|
||
|
||
def source_repos(config): | ||
""" 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 | ||
|
@@ -159,6 +166,7 @@ def source_repos(config): | |
|
||
subprocess.call(["mbed-cli", "import", repo]) | ||
|
||
|
||
def get_num_failures(results, export=False): | ||
""" Returns the number of failed compilations from the results summary | ||
Args: | ||
|
@@ -178,15 +186,36 @@ def get_num_failures(results, export=False): | |
|
||
|
||
def export_repos(config, ides): | ||
def print_message(message, name): | ||
print(message+ " %s"%name) | ||
sys.stdout.flush() | ||
|
||
"""Exports and builds combinations of example programs, targets and IDEs. | ||
|
||
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 | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yay for docs! 😄 |
||
results = {} | ||
print("\nExporting example repos....\n") | ||
for example in config['examples']: | ||
export_failures = [] | ||
build_failures = [] | ||
build_skips = [] | ||
successes = [] | ||
exported = True | ||
pass_status = True | ||
|
@@ -215,20 +244,25 @@ def status(message): | |
else: | ||
status("SUCCESS exporting") | ||
status("Building") | ||
if EXPORTERS[ide].build(example_project_name): | ||
status("FAILURE building") | ||
build_failures.append(example_name) | ||
else: | ||
status("SUCCESS building") | ||
try: | ||
if EXPORTERS[ide].build(example_project_name): | ||
status("FAILURE building") | ||
build_failures.append(example_name) | ||
else: | ||
status("SUCCESS building") | ||
successes.append(example_name) | ||
except TypeError: | ||
successes.append(example_name) | ||
build_skips.append(example_name) | ||
os.chdir("..") | ||
|
||
if len(build_failures+export_failures) > 0: | ||
pass_status= False | ||
else: | ||
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 | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why "cmsis" and "zip" exporters aren't being listed in the
supported_ides
? Do they lack build steps?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we introspect the class then to see if there's a build function and filter based on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further, their generate functions are just bizarre. Zip returns True and CMSIS exports a useless .cpdsc (this one is ust experimental right now).
If we did that, then those others that don't have a build (kds, etc) wouldn't be allowed to do the just exporting part (which is the point of this pr).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So CMSIS is being excluded now because its experimental, and it sounds like Zip may need to be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zip just does weird stuff for the online IDE, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it sounds like these two exporters truly are just strange. In that case the way it's implemented now isn't an issue. 👍