Skip to content

Commit d4a1b5a

Browse files
authored
Merge pull request #14064 from saheerb/example_applications_build_data
examples:create build_data after example application build
2 parents d2bf235 + 34f5efa commit d4a1b5a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tools/test/examples/examples_lib.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@
5353
SUPPORTED_IDES = [exp for exp in list(EXPORTERS) + list(EXPORTER_ALIASES)
5454
if exp != "cmsis" and exp != "zip"]
5555

56+
def get_table_from_pretty_table(pretty_table):
57+
rows = []
58+
for pretty_row in pretty_table:
59+
row = {}
60+
for key in pretty_table.field_names:
61+
pretty_row.border = False
62+
pretty_row.header = False
63+
row[key] = pretty_row.get_string(fields=[key]).strip()
64+
rows.append(row)
65+
return rows
5666

5767
def get_build_summary(results):
5868
"""Prints to screen the complication results of example programs.
@@ -80,6 +90,10 @@ def get_build_summary(results):
8090
print("\n\nFailed Example Compilation:")
8191
print(fail_table)
8292
print("Number of failures = %d" % failure_counter)
93+
# output build information to json file
94+
rows = get_table_from_pretty_table(pass_table) + get_table_from_pretty_table(fail_table)
95+
with open("build_data.json", "w") as write_file:
96+
json.dump(rows, write_file, indent=4, sort_keys=True)
8397
return failure_counter
8498

8599
def get_export_summary(results):

0 commit comments

Comments
 (0)