19
19
from tools .export import EXPORTERS
20
20
21
21
SUPPORTED_TOOLCHAINS = ["ARM" , "IAR" , "GCC_ARM" ]
22
- SUPPORTED_IDES = ["iar" , "uvision" , "make_gcc_arm" , "make_iar" , "make_armc5" ]
22
+ SUPPORTED_IDES = [exp for exp in EXPORTERS .keys () if exp != "cmsis" and exp != "zip" ]
23
+
23
24
24
25
def print_list (lst ):
25
26
"""Prints to screen the contents of a list
@@ -32,6 +33,21 @@ def print_list(lst):
32
33
for thing in lst :
33
34
print ("# %s" % thing )
34
35
36
+
37
+ def print_category (results , index , message ):
38
+ summary = [example for key , summ in results .iteritems ()
39
+ for example in summ [index ]]
40
+ if all (len (s ) == 0 for s in summary ):
41
+ return
42
+ print ("#" )
43
+ print ("#" * 80 )
44
+ print ("# %s" % message )
45
+ print ("#" * 80 )
46
+ split_summ = [s .rsplit (" " , 1 ) for s in summary ]
47
+
48
+ print_list (summary )
49
+
50
+
35
51
def print_summary (results , export = False ):
36
52
"""Prints to screen the results of compiling/exporting combinations of example programs,
37
53
targets and compile toolchains/IDEs.
@@ -45,27 +61,17 @@ def print_summary(results, export=False):
45
61
print ("#" * 80 )
46
62
print ("# Examples compilation summary" )
47
63
print ("#" * 80 )
48
- print ("#" )
49
- print ("# Passed example combinations" )
50
- print ("#" )
51
- for key , val in results .iteritems ():
52
- print_list (val [2 ])
64
+
65
+ print_category (results , 2 , "Passed example combinations" )
53
66
54
67
second_result = "Failed example combinations" if not export else \
55
68
"Failed export example combinations"
56
-
57
- print ("#" )
58
- print ("# %s" % second_result )
59
- print ("#" )
60
- for key , val in results .iteritems ():
61
- print_list (val [3 ])
69
+
70
+ print_category (results , 3 , second_result )
62
71
63
72
if export :
64
- print ("#" )
65
- print ("# Failed build example combinations" )
66
- print ("#" )
67
- for key , val in results .iteritems ():
68
- print_list (val [4 ])
73
+ print_category (results , 4 , "Failed build combinations" )
74
+ print_category (results , 5 , "Skipped build combinations" )
69
75
70
76
print ("#" )
71
77
print ("#" * 80 )
@@ -141,6 +147,7 @@ def get_repo_list(example):
141
147
repos .append (example ['github' ])
142
148
return repos
143
149
150
+
144
151
def source_repos (config ):
145
152
""" Clones each of the repos associated with the specific examples name from the
146
153
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):
159
166
160
167
subprocess .call (["mbed-cli" , "import" , repo ])
161
168
169
+
162
170
def get_num_failures (results , export = False ):
163
171
""" Returns the number of failed compilations from the results summary
164
172
Args:
@@ -178,15 +186,36 @@ def get_num_failures(results, export=False):
178
186
179
187
180
188
def export_repos (config , ides ):
181
- def print_message (message , name ):
182
- print (message + " %s" % name )
183
- sys .stdout .flush ()
184
-
189
+ """Exports and builds combinations of example programs, targets and IDEs.
190
+
191
+ The results are returned in a [key: value] dictionary format:
192
+ Where key = The example name from the json config file
193
+ value = a list containing: pass_status, successes, export failures, build_failures,
194
+ and build_skips
195
+
196
+ where pass_status = The overall pass status for the export of the full
197
+ set of example programs comprising the example suite.
198
+ (IE they must build and export)
199
+ True if all examples pass, false otherwise
200
+ successes = list of examples that exported and built (if possible)
201
+ If the exporter has no build functionality, then it is a pass
202
+ if exported
203
+ export_failures = list of examples that failed to export.
204
+ build_failures = list of examples that failed to build
205
+ build_skips = list of examples that cannot build
206
+
207
+ Both successes and failures contain the example name, target and IDE
208
+
209
+ Args:
210
+ config - the json object imported from the file.
211
+ ides - List of IDES to export to
212
+ """
185
213
results = {}
186
214
print ("\n Exporting example repos....\n " )
187
215
for example in config ['examples' ]:
188
216
export_failures = []
189
217
build_failures = []
218
+ build_skips = []
190
219
successes = []
191
220
exported = True
192
221
pass_status = True
@@ -215,20 +244,25 @@ def status(message):
215
244
else :
216
245
status ("SUCCESS exporting" )
217
246
status ("Building" )
218
- if EXPORTERS [ide ].build (example_project_name ):
219
- status ("FAILURE building" )
220
- build_failures .append (example_name )
221
- else :
222
- status ("SUCCESS building" )
247
+ try :
248
+ if EXPORTERS [ide ].build (example_project_name ):
249
+ status ("FAILURE building" )
250
+ build_failures .append (example_name )
251
+ else :
252
+ status ("SUCCESS building" )
253
+ successes .append (example_name )
254
+ except TypeError :
223
255
successes .append (example_name )
256
+ build_skips .append (example_name )
224
257
os .chdir (".." )
225
258
226
259
if len (build_failures + export_failures ) > 0 :
227
260
pass_status = False
228
261
else :
229
262
exported = False
230
263
231
- results [example ['name' ]] = [exported , pass_status , successes , export_failures , build_failures ]
264
+ results [example ['name' ]] = [exported , pass_status , successes ,
265
+ export_failures , build_failures , build_skips ]
232
266
233
267
return results
234
268
0 commit comments