Skip to content

Commit cd9f933

Browse files
sg-0xc0170
authored andcommitted
Updates for CI (#1760)
* Dont exclude tests from magical lists * update default toolchain locations for windows pointing to latest supported versions * Fixing build loop in build_release.py * Fixing incorrect target name in release script, preventing traceback in this case * Breaking up the uploading of build/test results. It defaults to 1000 'projectRuns' per POST call, though this can be modified via the '-l' parameter when invoking 'add-project-runs'. * remove default path to GCC. Setting takes priority to PATH so this breaks linux and Mac * revert is_supported chages in favor of alternative command line option
1 parent ffa9d17 commit cd9f933

File tree

3 files changed

+104
-41
lines changed

3 files changed

+104
-41
lines changed

workspace_tools/build_release.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
from workspace_tools.build_api import build_mbed_libs
2929
from workspace_tools.build_api import write_build_report
30-
from workspace_tools.targets import TARGET_MAP
30+
from workspace_tools.targets import TARGET_MAP, TARGET_NAMES
3131
from workspace_tools.test_exporters import ReportExporter, ResultExporterType
3232
from workspace_tools.test_api import SingleTestRunner
3333
from workspace_tools.test_api import singletest_in_cli_mode
@@ -126,7 +126,7 @@
126126
('ARM_MPS2_M3' , ('ARM',)),
127127
('ARM_MPS2_M4' , ('ARM',)),
128128
('ARM_MPS2_M7' , ('ARM',)),
129-
('ARM_MPS2_BEID' , ('ARM',)),
129+
('ARM_IOTSS_BEID' , ('ARM',)),
130130

131131
('RZ_A1H' , ('ARM', 'GCC_ARM')),
132132

@@ -209,19 +209,25 @@
209209
"targets": {}
210210
}
211211

212+
if options.toolchains:
213+
print "Only building using the following toolchains: %s" % (options.toolchains)
214+
212215
for target_name, toolchain_list in OFFICIAL_MBED_LIBRARY_BUILD:
213216
toolchains = None
214217
if platforms is not None and not target_name in platforms:
215218
print("Excluding %s from release" % target_name)
216219
continue
220+
221+
if target_name not in TARGET_NAMES:
222+
print "Target '%s' is not a valid target. Excluding from release"
223+
continue
217224

218225
if options.official_only:
219226
toolchains = (getattr(TARGET_MAP[target_name], 'default_toolchain', 'ARM'),)
220227
else:
221228
toolchains = toolchain_list
222229

223230
if options.toolchains:
224-
print "Only building using the following toolchains: %s" % (options.toolchains)
225231
toolchainSet = set(toolchains)
226232
toolchains = toolchainSet.intersection(set((options.toolchains).split(',')))
227233

@@ -233,24 +239,28 @@
233239

234240
test_spec["targets"][target_name] = toolchains
235241

236-
single_test = SingleTestRunner(_muts=mut,
237-
_opts_report_build_file_name=options.report_build_file_name,
238-
_test_spec=test_spec,
239-
_opts_test_by_names=",".join(test_names),
240-
_opts_verbose=options.verbose,
241-
_opts_only_build_tests=True,
242-
_opts_suppress_summary=True,
243-
_opts_jobs=options.jobs,
244-
_opts_include_non_automated=True,
245-
_opts_build_report=build_report,
246-
_opts_build_properties=build_properties)
247-
# Runs test suite in CLI mode
248-
test_summary, shuffle_seed, test_summary_ext, test_suite_properties_ext, new_build_report, new_build_properties = single_test.execute()
242+
single_test = SingleTestRunner(_muts=mut,
243+
_opts_report_build_file_name=options.report_build_file_name,
244+
_test_spec=test_spec,
245+
_opts_test_by_names=",".join(test_names),
246+
_opts_verbose=options.verbose,
247+
_opts_only_build_tests=True,
248+
_opts_suppress_summary=True,
249+
_opts_jobs=options.jobs,
250+
_opts_include_non_automated=True,
251+
_opts_build_report=build_report,
252+
_opts_build_properties=build_properties)
253+
# Runs test suite in CLI mode
254+
test_summary, shuffle_seed, test_summary_ext, test_suite_properties_ext, new_build_report, new_build_properties = single_test.execute()
249255
else:
250256
for target_name, toolchain_list in OFFICIAL_MBED_LIBRARY_BUILD:
251257
if platforms is not None and not target_name in platforms:
252258
print("Excluding %s from release" % target_name)
253259
continue
260+
261+
if target_name not in TARGET_NAMES:
262+
print "Target '%s' is not a valid target. Excluding from release"
263+
continue
254264

255265
if options.official_only:
256266
toolchains = (getattr(TARGET_MAP[target_name], 'default_toolchain', 'ARM'),)

workspace_tools/settings.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
armcc = "standalone" # "keil", or "standalone", or "ds-5"
3131

3232
if armcc == "keil":
33-
ARM_PATH = "C:/Keil_4_54/ARM"
34-
ARM_BIN = join(ARM_PATH, "BIN40")
35-
ARM_INC = join(ARM_PATH, "RV31", "INC")
36-
ARM_LIB = join(ARM_PATH, "RV31", "LIB")
33+
ARM_PATH = "C:/Keil_v5/ARM/ARMCC"
34+
ARM_BIN = join(ARM_PATH, "bin")
35+
ARM_INC = join(ARM_PATH, "incldue")
36+
ARM_LIB = join(ARM_PATH, "lib")
3737

3838
elif armcc == "standalone":
39-
ARM_PATH = "C:/Program Files/ARM/armcc_4.1_791"
39+
ARM_PATH = "C:/Program Files (x86)/ARM_Compiler_5.06u1"
4040
ARM_BIN = join(ARM_PATH, "bin")
4141
ARM_INC = join(ARM_PATH, "include")
4242
ARM_LIB = join(ARM_PATH, "lib")
@@ -57,7 +57,7 @@
5757
GCC_CR_PATH = "C:/code_red/RedSuite_4.2.0_349/redsuite/Tools/bin"
5858

5959
# IAR
60-
IAR_PATH = "C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm"
60+
IAR_PATH = "C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.3/arm"
6161

6262
# Goanna static analyser. Please overload it in private_settings.py
6363
GOANNA_PATH = "c:/Program Files (x86)/RedLizards/Goanna Central 3.2.3/bin"

workspace_tools/upload_results.py

Lines changed: 72 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,32 +125,84 @@ def add_project_runs(args):
125125
project_run_data['hostOses_set'] = set()
126126
project_run_data['hostOses_set'].add(args.host_os)
127127

128-
add_report(project_run_data, args.build_report, True, args.build_id, args.host_os)
128+
if args.build_report:
129+
add_report(project_run_data, args.build_report, True, args.build_id, args.host_os)
129130

130-
if (args.test_report):
131+
if args.test_report:
131132
add_report(project_run_data, args.test_report, False, args.build_id, args.host_os)
132133

133-
ts_data = format_project_run_data(project_run_data)
134-
r = requests.post(urlparse.urljoin(args.url, "api/projectRuns"), headers=create_headers(args), json=ts_data)
135-
finish_command('add-project-runs', r)
134+
ts_data = format_project_run_data(project_run_data, args.limit)
135+
total_result = True
136+
137+
total_parts = len(ts_data)
138+
print "Uploading project runs in %d parts" % total_parts
139+
140+
for index, data in enumerate(ts_data):
141+
r = requests.post(urlparse.urljoin(args.url, "api/projectRuns"), headers=create_headers(args), json=data)
142+
print("add-project-runs part %d/%d" % (index + 1, total_parts), r.status_code, r.reason)
143+
print(r.text)
144+
145+
if r.status_code >= 400:
146+
total_result = False
147+
148+
if total_result:
149+
print "'add-project-runs' completed successfully"
150+
sys.exit(0)
151+
else:
152+
print "'add-project-runs' failed"
153+
sys.exit(2)
136154

137-
def format_project_run_data(project_run_data):
155+
def prep_ts_data():
138156
ts_data = {}
139157
ts_data['projectRuns'] = []
158+
ts_data['platforms'] = set()
159+
ts_data['vendors'] = set()
160+
ts_data['toolchains'] = set()
161+
ts_data['names'] = set()
162+
ts_data['hostOses'] = set()
163+
return ts_data
140164

141-
for hostOs in project_run_data['projectRuns'].values():
142-
for platform in hostOs.values():
143-
for toolchain in platform.values():
144-
for project in toolchain.values():
145-
ts_data['projectRuns'].append(project)
146-
147-
ts_data['platforms'] = list(project_run_data['platforms_set'])
165+
def finish_ts_data(ts_data, project_run_data):
166+
ts_data['platforms'] = list(ts_data['platforms'])
167+
ts_data['vendors'] = list(ts_data['vendors'])
168+
ts_data['toolchains'] = list(ts_data['toolchains'])
169+
ts_data['names'] = list(ts_data['names'])
170+
ts_data['hostOses'] = list(ts_data['hostOses'])
171+
172+
# Add all vendors to every projectRun submission
173+
# TODO Either add "vendor" to the "project_run_data"
174+
# or remove "vendor" entirely from the viewer
148175
ts_data['vendors'] = list(project_run_data['vendors_set'])
149-
ts_data['toolchains'] = list(project_run_data['toolchains_set'])
150-
ts_data['names'] = list(project_run_data['names_set'])
151-
ts_data['hostOses'] = list(project_run_data['hostOses_set'])
176+
177+
def format_project_run_data(project_run_data, limit):
178+
all_ts_data = []
179+
current_limit_count = 0
180+
181+
ts_data = prep_ts_data()
182+
ts_data['projectRuns'] = []
152183

153-
return ts_data
184+
for hostOs_name, hostOs in project_run_data['projectRuns'].iteritems():
185+
for platform_name, platform in hostOs.iteritems():
186+
for toolchain_name, toolchain in platform.iteritems():
187+
for project_name, project in toolchain.iteritems():
188+
if current_limit_count >= limit:
189+
finish_ts_data(ts_data, project_run_data)
190+
all_ts_data.append(ts_data)
191+
ts_data = prep_ts_data()
192+
current_limit_count = 0
193+
194+
ts_data['projectRuns'].append(project)
195+
ts_data['platforms'].add(platform_name)
196+
ts_data['toolchains'].add(toolchain_name)
197+
ts_data['names'].add(project_name)
198+
ts_data['hostOses'].add(hostOs_name)
199+
current_limit_count += 1
200+
201+
if current_limit_count > 0:
202+
finish_ts_data(ts_data, project_run_data)
203+
all_ts_data.append(ts_data)
204+
205+
return all_ts_data
154206

155207
def find_project_run(projectRuns, project):
156208
keys = ['hostOs', 'platform', 'toolchain', 'project']
@@ -308,13 +360,14 @@ def main(arguments):
308360

309361
add_project_runs_parser = subparsers.add_parser('add-project-runs', help='add project runs to a build')
310362
add_project_runs_parser.add_argument('-b', '--build-id', required=True, help='build id')
311-
add_project_runs_parser.add_argument('-r', '--build-report', required=True, help='path to junit xml build report')
363+
add_project_runs_parser.add_argument('-r', '--build-report', required=False, help='path to junit xml build report')
312364
add_project_runs_parser.add_argument('-t', '--test-report', required=False, help='path to junit xml test report')
313365
add_project_runs_parser.add_argument('-o', '--host-os', required=True, help='host os on which test was run')
366+
add_project_runs_parser.add_argument('-l', '--limit', required=False, type=int, default=1000, help='Limit the number of project runs sent at a time to avoid HTTP errors (default is 1000)')
314367
add_project_runs_parser.set_defaults(func=add_project_runs)
315368

316369
args = parser.parse_args(arguments)
317370
args.func(args)
318371

319372
if __name__ == '__main__':
320-
main(sys.argv[1:])
373+
main(sys.argv[1:])

0 commit comments

Comments
 (0)