Maxim mbed development library

Dependents:   sensomed

Committer:
switches
Date:
Tue Nov 08 18:27:11 2016 +0000
Revision:
0:0e018d759a2a
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:0e018d759a2a 1 """
switches 0:0e018d759a2a 2 mbed SDK
switches 0:0e018d759a2a 3 Copyright (c) 2011-2013 ARM Limited
switches 0:0e018d759a2a 4
switches 0:0e018d759a2a 5 Licensed under the Apache License, Version 2.0 (the "License");
switches 0:0e018d759a2a 6 you may not use this file except in compliance with the License.
switches 0:0e018d759a2a 7 You may obtain a copy of the License at
switches 0:0e018d759a2a 8
switches 0:0e018d759a2a 9 http://www.apache.org/licenses/LICENSE-2.0
switches 0:0e018d759a2a 10
switches 0:0e018d759a2a 11 Unless required by applicable law or agreed to in writing, software
switches 0:0e018d759a2a 12 distributed under the License is distributed on an "AS IS" BASIS,
switches 0:0e018d759a2a 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:0e018d759a2a 14 See the License for the specific language governing permissions and
switches 0:0e018d759a2a 15 limitations under the License.
switches 0:0e018d759a2a 16 """
switches 0:0e018d759a2a 17 import sys
switches 0:0e018d759a2a 18 import argparse
switches 0:0e018d759a2a 19 import xml.etree.ElementTree as ET
switches 0:0e018d759a2a 20 import requests
switches 0:0e018d759a2a 21 import urlparse
switches 0:0e018d759a2a 22
switches 0:0e018d759a2a 23 def create_headers(args):
switches 0:0e018d759a2a 24 return { 'X-Api-Key': args.api_key }
switches 0:0e018d759a2a 25
switches 0:0e018d759a2a 26 def finish_command(command, response):
switches 0:0e018d759a2a 27 print(command, response.status_code, response.reason)
switches 0:0e018d759a2a 28 print(response.text)
switches 0:0e018d759a2a 29
switches 0:0e018d759a2a 30 if response.status_code < 400:
switches 0:0e018d759a2a 31 sys.exit(0)
switches 0:0e018d759a2a 32 else:
switches 0:0e018d759a2a 33 sys.exit(2)
switches 0:0e018d759a2a 34
switches 0:0e018d759a2a 35 def create_build(args):
switches 0:0e018d759a2a 36 build = {}
switches 0:0e018d759a2a 37 build['buildType'] = args.build_type
switches 0:0e018d759a2a 38 build['number'] = args.build_number
switches 0:0e018d759a2a 39 build['source'] = args.build_source
switches 0:0e018d759a2a 40 build['status'] = 'running'
switches 0:0e018d759a2a 41
switches 0:0e018d759a2a 42 r = requests.post(urlparse.urljoin(args.url, "api/builds"), headers=create_headers(args), json=build)
switches 0:0e018d759a2a 43
switches 0:0e018d759a2a 44 if r.status_code < 400:
switches 0:0e018d759a2a 45 if args.property_file_format:
switches 0:0e018d759a2a 46 print("MBED_BUILD_ID=" + r.text)
switches 0:0e018d759a2a 47 else:
switches 0:0e018d759a2a 48 print(r.text)
switches 0:0e018d759a2a 49
switches 0:0e018d759a2a 50 sys.exit(0)
switches 0:0e018d759a2a 51 else:
switches 0:0e018d759a2a 52 sys.exit(2)
switches 0:0e018d759a2a 53
switches 0:0e018d759a2a 54 def finish_build(args):
switches 0:0e018d759a2a 55 data = {}
switches 0:0e018d759a2a 56 data['status'] = 'completed'
switches 0:0e018d759a2a 57
switches 0:0e018d759a2a 58 r = requests.put(urlparse.urljoin(args.url, "api/builds/" + args.build_id), headers=create_headers(args), json=data)
switches 0:0e018d759a2a 59 finish_command('finish-build', r)
switches 0:0e018d759a2a 60
switches 0:0e018d759a2a 61 def promote_build(args):
switches 0:0e018d759a2a 62 data = {}
switches 0:0e018d759a2a 63 data['buildType'] = 'Release'
switches 0:0e018d759a2a 64
switches 0:0e018d759a2a 65 r = requests.put(urlparse.urljoin(args.url, "api/builds/" + args.build_id), headers=create_headers(args), json=data)
switches 0:0e018d759a2a 66 finish_command('promote-build', r)
switches 0:0e018d759a2a 67
switches 0:0e018d759a2a 68 def abort_build(args):
switches 0:0e018d759a2a 69 data = {}
switches 0:0e018d759a2a 70 data['status'] = 'aborted'
switches 0:0e018d759a2a 71
switches 0:0e018d759a2a 72 r = requests.put(urlparse.urljoin(args.url, "api/builds/" + args.build_id), headers=create_headers(args), json=data)
switches 0:0e018d759a2a 73 finish_command('abort-build', r)
switches 0:0e018d759a2a 74
switches 0:0e018d759a2a 75 def add_project_runs(args):
switches 0:0e018d759a2a 76 '''
switches 0:0e018d759a2a 77 -------------------------------------
switches 0:0e018d759a2a 78 Notes on 'project_run_data' structure:
switches 0:0e018d759a2a 79 --------------------------------------
switches 0:0e018d759a2a 80 'projectRuns' - Tree structure used to keep track of what projects have
switches 0:0e018d759a2a 81 been logged in different report files. The tree is organized as follows:
switches 0:0e018d759a2a 82
switches 0:0e018d759a2a 83 'projectRuns': { - Root element of tree
switches 0:0e018d759a2a 84
switches 0:0e018d759a2a 85 'hostOs': { - Host OS on which project was built/tested
switches 0:0e018d759a2a 86 - ex. windows, linux, or mac
switches 0:0e018d759a2a 87
switches 0:0e018d759a2a 88 'platform': { - Platform for which project was built/tested
switches 0:0e018d759a2a 89 (Corresponds to platform names in targets.py)
switches 0:0e018d759a2a 90 - ex. K64F, LPC1768, NRF51822, etc.
switches 0:0e018d759a2a 91
switches 0:0e018d759a2a 92 'toolchain': { - Toolchain with which project was built/tested
switches 0:0e018d759a2a 93 (Corresponds to TOOLCHAIN_CLASSES names in toolchains/__init__.py)
switches 0:0e018d759a2a 94 - ex. ARM, uARM, GCC_ARM, etc.
switches 0:0e018d759a2a 95
switches 0:0e018d759a2a 96 'project': { - Project that was build/tested
switches 0:0e018d759a2a 97 (Corresponds to test id in tests.py or library id in libraries.py)
switches 0:0e018d759a2a 98 - For tests, ex. MBED_A1, MBED_11, DTCT_1 etc.
switches 0:0e018d759a2a 99 - For libraries, ex. MBED, RTX, RTOS, etc.
switches 0:0e018d759a2a 100
switches 0:0e018d759a2a 101 },
switches 0:0e018d759a2a 102 ...
switches 0:0e018d759a2a 103 },
switches 0:0e018d759a2a 104 ...
switches 0:0e018d759a2a 105 },
switches 0:0e018d759a2a 106 ...
switches 0:0e018d759a2a 107 }
switches 0:0e018d759a2a 108 }
switches 0:0e018d759a2a 109
switches 0:0e018d759a2a 110 'platforms_set' - Set of all the platform names mentioned in the given report files
switches 0:0e018d759a2a 111
switches 0:0e018d759a2a 112 'toolchains_set' - Set of all the toolchain names mentioned in the given report files
switches 0:0e018d759a2a 113
switches 0:0e018d759a2a 114 'names_set' - Set of all the project names mentioned in the given report files
switches 0:0e018d759a2a 115
switches 0:0e018d759a2a 116 'hostOses_set' - Set of all the host names given (only given by the command line arguments)
switches 0:0e018d759a2a 117 '''
switches 0:0e018d759a2a 118
switches 0:0e018d759a2a 119 project_run_data = {}
switches 0:0e018d759a2a 120 project_run_data['projectRuns'] = {}
switches 0:0e018d759a2a 121 project_run_data['platforms_set'] = set()
switches 0:0e018d759a2a 122 project_run_data['vendors_set'] = set()
switches 0:0e018d759a2a 123 project_run_data['toolchains_set'] = set()
switches 0:0e018d759a2a 124 project_run_data['names_set'] = set()
switches 0:0e018d759a2a 125 project_run_data['hostOses_set'] = set()
switches 0:0e018d759a2a 126 project_run_data['hostOses_set'].add(args.host_os)
switches 0:0e018d759a2a 127
switches 0:0e018d759a2a 128 if args.build_report:
switches 0:0e018d759a2a 129 add_report(project_run_data, args.build_report, True, args.build_id, args.host_os)
switches 0:0e018d759a2a 130
switches 0:0e018d759a2a 131 if args.test_report:
switches 0:0e018d759a2a 132 add_report(project_run_data, args.test_report, False, args.build_id, args.host_os)
switches 0:0e018d759a2a 133
switches 0:0e018d759a2a 134 ts_data = format_project_run_data(project_run_data, args.limit)
switches 0:0e018d759a2a 135 total_result = True
switches 0:0e018d759a2a 136
switches 0:0e018d759a2a 137 total_parts = len(ts_data)
switches 0:0e018d759a2a 138 print "Uploading project runs in %d parts" % total_parts
switches 0:0e018d759a2a 139
switches 0:0e018d759a2a 140 for index, data in enumerate(ts_data):
switches 0:0e018d759a2a 141 r = requests.post(urlparse.urljoin(args.url, "api/projectRuns"), headers=create_headers(args), json=data)
switches 0:0e018d759a2a 142 print("add-project-runs part %d/%d" % (index + 1, total_parts), r.status_code, r.reason)
switches 0:0e018d759a2a 143 print(r.text)
switches 0:0e018d759a2a 144
switches 0:0e018d759a2a 145 if r.status_code >= 400:
switches 0:0e018d759a2a 146 total_result = False
switches 0:0e018d759a2a 147
switches 0:0e018d759a2a 148 if total_result:
switches 0:0e018d759a2a 149 print "'add-project-runs' completed successfully"
switches 0:0e018d759a2a 150 sys.exit(0)
switches 0:0e018d759a2a 151 else:
switches 0:0e018d759a2a 152 print "'add-project-runs' failed"
switches 0:0e018d759a2a 153 sys.exit(2)
switches 0:0e018d759a2a 154
switches 0:0e018d759a2a 155 def prep_ts_data():
switches 0:0e018d759a2a 156 ts_data = {}
switches 0:0e018d759a2a 157 ts_data['projectRuns'] = []
switches 0:0e018d759a2a 158 ts_data['platforms'] = set()
switches 0:0e018d759a2a 159 ts_data['vendors'] = set()
switches 0:0e018d759a2a 160 ts_data['toolchains'] = set()
switches 0:0e018d759a2a 161 ts_data['names'] = set()
switches 0:0e018d759a2a 162 ts_data['hostOses'] = set()
switches 0:0e018d759a2a 163 return ts_data
switches 0:0e018d759a2a 164
switches 0:0e018d759a2a 165 def finish_ts_data(ts_data, project_run_data):
switches 0:0e018d759a2a 166 ts_data['platforms'] = list(ts_data['platforms'])
switches 0:0e018d759a2a 167 ts_data['vendors'] = list(ts_data['vendors'])
switches 0:0e018d759a2a 168 ts_data['toolchains'] = list(ts_data['toolchains'])
switches 0:0e018d759a2a 169 ts_data['names'] = list(ts_data['names'])
switches 0:0e018d759a2a 170 ts_data['hostOses'] = list(ts_data['hostOses'])
switches 0:0e018d759a2a 171
switches 0:0e018d759a2a 172 # Add all vendors to every projectRun submission
switches 0:0e018d759a2a 173 # TODO Either add "vendor" to the "project_run_data"
switches 0:0e018d759a2a 174 # or remove "vendor" entirely from the viewer
switches 0:0e018d759a2a 175 ts_data['vendors'] = list(project_run_data['vendors_set'])
switches 0:0e018d759a2a 176
switches 0:0e018d759a2a 177 def format_project_run_data(project_run_data, limit):
switches 0:0e018d759a2a 178 all_ts_data = []
switches 0:0e018d759a2a 179 current_limit_count = 0
switches 0:0e018d759a2a 180
switches 0:0e018d759a2a 181 ts_data = prep_ts_data()
switches 0:0e018d759a2a 182 ts_data['projectRuns'] = []
switches 0:0e018d759a2a 183
switches 0:0e018d759a2a 184 for hostOs_name, hostOs in project_run_data['projectRuns'].iteritems():
switches 0:0e018d759a2a 185 for platform_name, platform in hostOs.iteritems():
switches 0:0e018d759a2a 186 for toolchain_name, toolchain in platform.iteritems():
switches 0:0e018d759a2a 187 for project_name, project in toolchain.iteritems():
switches 0:0e018d759a2a 188 if current_limit_count >= limit:
switches 0:0e018d759a2a 189 finish_ts_data(ts_data, project_run_data)
switches 0:0e018d759a2a 190 all_ts_data.append(ts_data)
switches 0:0e018d759a2a 191 ts_data = prep_ts_data()
switches 0:0e018d759a2a 192 current_limit_count = 0
switches 0:0e018d759a2a 193
switches 0:0e018d759a2a 194 ts_data['projectRuns'].append(project)
switches 0:0e018d759a2a 195 ts_data['platforms'].add(platform_name)
switches 0:0e018d759a2a 196 ts_data['toolchains'].add(toolchain_name)
switches 0:0e018d759a2a 197 ts_data['names'].add(project_name)
switches 0:0e018d759a2a 198 ts_data['hostOses'].add(hostOs_name)
switches 0:0e018d759a2a 199 current_limit_count += 1
switches 0:0e018d759a2a 200
switches 0:0e018d759a2a 201 if current_limit_count > 0:
switches 0:0e018d759a2a 202 finish_ts_data(ts_data, project_run_data)
switches 0:0e018d759a2a 203 all_ts_data.append(ts_data)
switches 0:0e018d759a2a 204
switches 0:0e018d759a2a 205 return all_ts_data
switches 0:0e018d759a2a 206
switches 0:0e018d759a2a 207 def find_project_run(projectRuns, project):
switches 0:0e018d759a2a 208 keys = ['hostOs', 'platform', 'toolchain', 'project']
switches 0:0e018d759a2a 209
switches 0:0e018d759a2a 210 elem = projectRuns
switches 0:0e018d759a2a 211
switches 0:0e018d759a2a 212 for key in keys:
switches 0:0e018d759a2a 213 if not project[key] in elem:
switches 0:0e018d759a2a 214 return None
switches 0:0e018d759a2a 215
switches 0:0e018d759a2a 216 elem = elem[project[key]]
switches 0:0e018d759a2a 217
switches 0:0e018d759a2a 218 return elem
switches 0:0e018d759a2a 219
switches 0:0e018d759a2a 220 def add_project_run(projectRuns, project):
switches 0:0e018d759a2a 221 keys = ['hostOs', 'platform', 'toolchain']
switches 0:0e018d759a2a 222
switches 0:0e018d759a2a 223 elem = projectRuns
switches 0:0e018d759a2a 224
switches 0:0e018d759a2a 225 for key in keys:
switches 0:0e018d759a2a 226 if not project[key] in elem:
switches 0:0e018d759a2a 227 elem[project[key]] = {}
switches 0:0e018d759a2a 228
switches 0:0e018d759a2a 229 elem = elem[project[key]]
switches 0:0e018d759a2a 230
switches 0:0e018d759a2a 231 elem[project['project']] = project
switches 0:0e018d759a2a 232
switches 0:0e018d759a2a 233 def update_project_run_results(project_to_update, project, is_build):
switches 0:0e018d759a2a 234 if is_build:
switches 0:0e018d759a2a 235 project_to_update['buildPass'] = project['buildPass']
switches 0:0e018d759a2a 236 project_to_update['buildResult'] = project['buildResult']
switches 0:0e018d759a2a 237 project_to_update['buildOutput'] = project['buildOutput']
switches 0:0e018d759a2a 238 else:
switches 0:0e018d759a2a 239 project_to_update['testPass'] = project['testPass']
switches 0:0e018d759a2a 240 project_to_update['testResult'] = project['testResult']
switches 0:0e018d759a2a 241 project_to_update['testOutput'] = project['testOutput']
switches 0:0e018d759a2a 242
switches 0:0e018d759a2a 243 def update_project_run(projectRuns, project, is_build):
switches 0:0e018d759a2a 244 found_project = find_project_run(projectRuns, project)
switches 0:0e018d759a2a 245 if found_project:
switches 0:0e018d759a2a 246 update_project_run_results(found_project, project, is_build)
switches 0:0e018d759a2a 247 else:
switches 0:0e018d759a2a 248 add_project_run(projectRuns, project)
switches 0:0e018d759a2a 249
switches 0:0e018d759a2a 250 def add_report(project_run_data, report_file, is_build, build_id, host_os):
switches 0:0e018d759a2a 251 tree = None
switches 0:0e018d759a2a 252
switches 0:0e018d759a2a 253 try:
switches 0:0e018d759a2a 254 tree = ET.parse(report_file)
switches 0:0e018d759a2a 255 except:
switches 0:0e018d759a2a 256 print(sys.exc_info()[0])
switches 0:0e018d759a2a 257 print('Invalid path to report: %s', report_file)
switches 0:0e018d759a2a 258 sys.exit(1)
switches 0:0e018d759a2a 259
switches 0:0e018d759a2a 260 test_suites = tree.getroot()
switches 0:0e018d759a2a 261
switches 0:0e018d759a2a 262 for test_suite in test_suites:
switches 0:0e018d759a2a 263 platform = ""
switches 0:0e018d759a2a 264 toolchain = ""
switches 0:0e018d759a2a 265 vendor = ""
switches 0:0e018d759a2a 266 for properties in test_suite.findall('properties'):
switches 0:0e018d759a2a 267 for property in properties.findall('property'):
switches 0:0e018d759a2a 268 if property.attrib['name'] == 'target':
switches 0:0e018d759a2a 269 platform = property.attrib['value']
switches 0:0e018d759a2a 270 project_run_data['platforms_set'].add(platform)
switches 0:0e018d759a2a 271 elif property.attrib['name'] == 'toolchain':
switches 0:0e018d759a2a 272 toolchain = property.attrib['value']
switches 0:0e018d759a2a 273 project_run_data['toolchains_set'].add(toolchain)
switches 0:0e018d759a2a 274 elif property.attrib['name'] == 'vendor':
switches 0:0e018d759a2a 275 vendor = property.attrib['value']
switches 0:0e018d759a2a 276 project_run_data['vendors_set'].add(vendor)
switches 0:0e018d759a2a 277
switches 0:0e018d759a2a 278 for test_case in test_suite.findall('testcase'):
switches 0:0e018d759a2a 279 projectRun = {}
switches 0:0e018d759a2a 280 projectRun['build'] = build_id
switches 0:0e018d759a2a 281 projectRun['hostOs'] = host_os
switches 0:0e018d759a2a 282 projectRun['platform'] = platform
switches 0:0e018d759a2a 283 projectRun['toolchain'] = toolchain
switches 0:0e018d759a2a 284 projectRun['project'] = test_case.attrib['classname'].split('.')[-1]
switches 0:0e018d759a2a 285 projectRun['vendor'] = vendor
switches 0:0e018d759a2a 286
switches 0:0e018d759a2a 287 project_run_data['names_set'].add(projectRun['project'])
switches 0:0e018d759a2a 288
switches 0:0e018d759a2a 289 should_skip = False
switches 0:0e018d759a2a 290 skips = test_case.findall('skipped')
switches 0:0e018d759a2a 291
switches 0:0e018d759a2a 292 if skips:
switches 0:0e018d759a2a 293 should_skip = skips[0].attrib['message'] == 'SKIP'
switches 0:0e018d759a2a 294
switches 0:0e018d759a2a 295 if not should_skip:
switches 0:0e018d759a2a 296 system_outs = test_case.findall('system-out')
switches 0:0e018d759a2a 297
switches 0:0e018d759a2a 298 output = ""
switches 0:0e018d759a2a 299 if system_outs:
switches 0:0e018d759a2a 300 output = system_outs[0].text
switches 0:0e018d759a2a 301
switches 0:0e018d759a2a 302 if is_build:
switches 0:0e018d759a2a 303 projectRun['buildOutput'] = output
switches 0:0e018d759a2a 304 else:
switches 0:0e018d759a2a 305 projectRun['testOutput'] = output
switches 0:0e018d759a2a 306
switches 0:0e018d759a2a 307 errors = test_case.findall('error')
switches 0:0e018d759a2a 308 failures = test_case.findall('failure')
switches 0:0e018d759a2a 309 projectRunPass = None
switches 0:0e018d759a2a 310 result = None
switches 0:0e018d759a2a 311
switches 0:0e018d759a2a 312 if errors:
switches 0:0e018d759a2a 313 projectRunPass = False
switches 0:0e018d759a2a 314 result = errors[0].attrib['message']
switches 0:0e018d759a2a 315 elif failures:
switches 0:0e018d759a2a 316 projectRunPass = False
switches 0:0e018d759a2a 317 result = failures[0].attrib['message']
switches 0:0e018d759a2a 318 elif skips:
switches 0:0e018d759a2a 319 projectRunPass = True
switches 0:0e018d759a2a 320 result = skips[0].attrib['message']
switches 0:0e018d759a2a 321 else:
switches 0:0e018d759a2a 322 projectRunPass = True
switches 0:0e018d759a2a 323 result = 'OK'
switches 0:0e018d759a2a 324
switches 0:0e018d759a2a 325 if is_build:
switches 0:0e018d759a2a 326 projectRun['buildPass'] = projectRunPass
switches 0:0e018d759a2a 327 projectRun['buildResult'] = result
switches 0:0e018d759a2a 328 else:
switches 0:0e018d759a2a 329 projectRun['testPass'] = projectRunPass
switches 0:0e018d759a2a 330 projectRun['testResult'] = result
switches 0:0e018d759a2a 331
switches 0:0e018d759a2a 332 update_project_run(project_run_data['projectRuns'], projectRun, is_build)
switches 0:0e018d759a2a 333
switches 0:0e018d759a2a 334 def main(arguments):
switches 0:0e018d759a2a 335 # Register and parse command line arguments
switches 0:0e018d759a2a 336 parser = argparse.ArgumentParser()
switches 0:0e018d759a2a 337 parser.add_argument('-u', '--url', required=True, help='url to ci site')
switches 0:0e018d759a2a 338 parser.add_argument('-k', '--api-key', required=True, help='api-key for posting data')
switches 0:0e018d759a2a 339
switches 0:0e018d759a2a 340 subparsers = parser.add_subparsers(help='subcommand help')
switches 0:0e018d759a2a 341
switches 0:0e018d759a2a 342 create_build_parser = subparsers.add_parser('create-build', help='create a new build')
switches 0:0e018d759a2a 343 create_build_parser.add_argument('-b', '--build-number', required=True, help='build number')
switches 0:0e018d759a2a 344 create_build_parser.add_argument('-T', '--build-type', choices=['Nightly', 'Limited', 'Pull_Request', 'Release_Candidate'], required=True, help='type of build')
switches 0:0e018d759a2a 345 create_build_parser.add_argument('-s', '--build-source', required=True, help='url to source of build')
switches 0:0e018d759a2a 346 create_build_parser.add_argument('-p', '--property-file-format', action='store_true', help='print result in the property file format')
switches 0:0e018d759a2a 347 create_build_parser.set_defaults(func=create_build)
switches 0:0e018d759a2a 348
switches 0:0e018d759a2a 349 finish_build_parser = subparsers.add_parser('finish-build', help='finish a running build')
switches 0:0e018d759a2a 350 finish_build_parser.add_argument('-b', '--build-id', required=True, help='build id')
switches 0:0e018d759a2a 351 finish_build_parser.set_defaults(func=finish_build)
switches 0:0e018d759a2a 352
switches 0:0e018d759a2a 353 finish_build_parser = subparsers.add_parser('promote-build', help='promote a build to a release')
switches 0:0e018d759a2a 354 finish_build_parser.add_argument('-b', '--build-id', required=True, help='build id')
switches 0:0e018d759a2a 355 finish_build_parser.set_defaults(func=promote_build)
switches 0:0e018d759a2a 356
switches 0:0e018d759a2a 357 abort_build_parser = subparsers.add_parser('abort-build', help='abort a running build')
switches 0:0e018d759a2a 358 abort_build_parser.add_argument('-b', '--build-id', required=True, help='build id')
switches 0:0e018d759a2a 359 abort_build_parser.set_defaults(func=abort_build)
switches 0:0e018d759a2a 360
switches 0:0e018d759a2a 361 add_project_runs_parser = subparsers.add_parser('add-project-runs', help='add project runs to a build')
switches 0:0e018d759a2a 362 add_project_runs_parser.add_argument('-b', '--build-id', required=True, help='build id')
switches 0:0e018d759a2a 363 add_project_runs_parser.add_argument('-r', '--build-report', required=False, help='path to junit xml build report')
switches 0:0e018d759a2a 364 add_project_runs_parser.add_argument('-t', '--test-report', required=False, help='path to junit xml test report')
switches 0:0e018d759a2a 365 add_project_runs_parser.add_argument('-o', '--host-os', required=True, help='host os on which test was run')
switches 0:0e018d759a2a 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)')
switches 0:0e018d759a2a 367 add_project_runs_parser.set_defaults(func=add_project_runs)
switches 0:0e018d759a2a 368
switches 0:0e018d759a2a 369 args = parser.parse_args(arguments)
switches 0:0e018d759a2a 370 args.func(args)
switches 0:0e018d759a2a 371
switches 0:0e018d759a2a 372 if __name__ == '__main__':
switches 0:0e018d759a2a 373 main(sys.argv[1:])