Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

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