Backup 1

Committer:
borlanic
Date:
Tue Apr 24 11:45:18 2018 +0000
Revision:
0:02dd72d1d465
BaBoRo_test2 - backup 1

Who changed what in which revision?

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