Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 1 | #!/usr/bin/env python2 |
| 2 | # -*- coding: utf-8 -*- |
| 3 | # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | """Evaluate ChromeOS autotest. |
| 7 | |
| 8 | Note that by default 'test_that' will install dependency packages of autotest |
Kuang-che Wu | fd2ea5e | 2019-06-10 20:40:17 +0800 | [diff] [blame] | 9 | if the package checksum mismatch. If you want to override content of autotest |
| 10 | package, e.g. chrome's test binary, please make sure the autotest version |
| 11 | matches. Otherwise your test binary will be overwritten. |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 12 | """ |
| 13 | from __future__ import print_function |
| 14 | import argparse |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 15 | import logging |
| 16 | import os |
| 17 | import re |
| 18 | import subprocess |
| 19 | import sys |
| 20 | |
Kuang-che Wu | 4f0dc23 | 2019-05-10 18:28:06 +0800 | [diff] [blame] | 21 | from bisect_kit import catapult_util |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 22 | from bisect_kit import cli |
| 23 | from bisect_kit import common |
| 24 | from bisect_kit import configure |
| 25 | from bisect_kit import cros_util |
| 26 | from bisect_kit import util |
| 27 | |
| 28 | logger = logging.getLogger(__name__) |
| 29 | |
| 30 | OLD = 'old' |
| 31 | NEW = 'new' |
| 32 | SKIP = 'skip' |
| 33 | FATAL = 'fatal' |
| 34 | |
| 35 | EXIT_CODE_MAP = { |
Kuang-che Wu | 0476d1f | 2019-03-04 19:27:01 +0800 | [diff] [blame] | 36 | OLD: cli.EXIT_CODE_OLD, |
| 37 | NEW: cli.EXIT_CODE_NEW, |
| 38 | SKIP: cli.EXIT_CODE_SKIP, |
| 39 | FATAL: cli.EXIT_CODE_FATAL, |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | |
| 43 | def create_argument_parser(): |
| 44 | parser = argparse.ArgumentParser(description=__doc__) |
Kuang-che Wu | fe1e88a | 2019-09-10 21:52:25 +0800 | [diff] [blame] | 45 | cli.patching_argparser_exit(parser) |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 46 | common.add_common_arguments(parser) |
| 47 | parser.add_argument( |
| 48 | 'dut', |
| 49 | nargs='?', |
| 50 | type=cli.argtype_notempty, |
| 51 | metavar='DUT', |
| 52 | default=configure.get('DUT', '')) |
| 53 | parser.add_argument( |
| 54 | '--chromeos_root', |
| 55 | type=cli.argtype_dir_path, |
| 56 | metavar='CHROMEOS_ROOT', |
| 57 | default=configure.get('CHROMEOS_ROOT', ''), |
| 58 | help='ChromeOS tree root') |
| 59 | parser.add_argument( |
Kuang-che Wu | d4603d7 | 2018-11-29 17:51:21 +0800 | [diff] [blame] | 60 | '--chrome_root', |
| 61 | metavar='CHROME_ROOT', |
| 62 | type=cli.argtype_dir_path, |
| 63 | default=configure.get('CHROME_ROOT'), |
| 64 | help='Chrome tree root; necessary for telemetry tests') |
| 65 | parser.add_argument( |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 66 | '--prebuilt', |
| 67 | action='store_true', |
| 68 | help='Run autotest using existing prebuilt package if specified; ' |
| 69 | 'otherwise use the default one') |
| 70 | parser.add_argument( |
| 71 | '--reinstall', |
| 72 | action='store_true', |
| 73 | help='Remove existing autotest folder on the DUT first') |
Kuang-che Wu | da3abfe | 2019-03-21 14:48:12 +0800 | [diff] [blame] | 74 | parser.add_argument( |
| 75 | '--reboot_before_test', |
| 76 | action='store_true', |
| 77 | help='Reboot before test run') |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 78 | |
| 79 | group = parser.add_argument_group(title='Options for normal autotest tests') |
| 80 | group.add_argument( |
| 81 | '--test_name', help='Test name, like "video_VideoDecodeAccelerator.h264"') |
| 82 | group.add_argument( |
Kuang-che Wu | 0a4304a | 2019-01-19 01:32:11 +0800 | [diff] [blame] | 83 | '--fail_to_pass', |
| 84 | action='store_true', |
| 85 | help='For functional tests: old behavior is FAIL and new behavior is ' |
| 86 | 'PASS; If not specified, default = old behavior is PASS and new ' |
| 87 | 'behavior is FAIL') |
| 88 | group.add_argument( |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 89 | '--metric', |
| 90 | help= |
| 91 | 'Metric name of performance test; example: "cheets_SystemRawImageSize"') |
| 92 | group.add_argument( |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 93 | '--args', |
| 94 | help='Extra args passed to "test_that --args"; Overrides the default') |
Zheng-Jie Chang | 127c330 | 2019-09-10 17:17:04 +0800 | [diff] [blame] | 95 | group.add_argument( |
| 96 | '--board', |
| 97 | metavar='BOARD', |
| 98 | default=configure.get('BOARD'), |
| 99 | help='ChromeOS board name') |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 100 | |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 101 | group = parser.add_argument_group(title='Options for CTS/GTS tests') |
| 102 | group.add_argument('--cts_revision', help='CTS revision, like "9.0_r3"') |
Kuang-che Wu | 63f836a | 2019-02-21 16:33:32 +0000 | [diff] [blame] | 103 | group.add_argument('--cts_abi', choices=['arm', 'x86']) |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 104 | group.add_argument( |
| 105 | '--cts_prefix', |
| 106 | help='Prefix of autotest test name, ' |
| 107 | 'like cheets_CTS_N, cheets_CTS_P, cheets_GTS') |
| 108 | group.add_argument( |
| 109 | '--cts_module', help='CTS/GTS module name, like "CtsCameraTestCases"') |
| 110 | group.add_argument( |
| 111 | '--cts_test', |
| 112 | help='CTS/GTS test name, like ' |
| 113 | '"android.hardware.cts.CameraTest#testDisplayOrientation"') |
| 114 | group.add_argument('--cts_timeout', type=float, help='timeout, in seconds') |
Kuang-che Wu | 958d7d0 | 2019-05-30 17:58:21 +0800 | [diff] [blame] | 115 | group.add_argument( |
| 116 | '--cts_runonce', action='store_true', help='run test only once') |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 117 | |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 118 | return parser |
| 119 | |
| 120 | |
| 121 | def parse_test_report_log(result_log, metric): |
| 122 | """Parses autotest result log. |
| 123 | |
| 124 | Args: |
| 125 | result_log: content of test_report.log |
| 126 | metric: what metric to capture if not None |
| 127 | |
| 128 | Returns: |
| 129 | passed, values: |
| 130 | passed: True if test run successfully |
| 131 | values: captured metric values; None if test failed or metric is None |
| 132 | """ |
| 133 | m = re.search(r'Total PASS: (\d+)/(\d+)', result_log) |
Kuang-che Wu | 171dcb6 | 2018-10-25 12:37:05 +0800 | [diff] [blame] | 134 | passed = (m and m.group(1) == m.group(2)) |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 135 | |
| 136 | if not metric: |
Kuang-che Wu | 171dcb6 | 2018-10-25 12:37:05 +0800 | [diff] [blame] | 137 | return passed, None |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 138 | |
| 139 | values = [] |
| 140 | for line in result_log.splitlines(): |
| 141 | m = re.match(r'^(\S+)\s+(\w+)(?:\{\d+\})?\s+(\d+\.\d+)$', line) |
| 142 | if not m: |
| 143 | continue |
| 144 | if m.group(2) == metric: |
| 145 | values.append(float(m.group(3))) |
Kuang-che Wu | 171dcb6 | 2018-10-25 12:37:05 +0800 | [diff] [blame] | 146 | return passed, values |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 147 | |
| 148 | |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 149 | def get_additional_test_args(test_name): |
| 150 | """Gets extra arguments to specific test. |
| 151 | |
| 152 | Some tests may require special arguments to run. |
| 153 | |
| 154 | Args: |
| 155 | test_name: test name |
| 156 | |
| 157 | Returns: |
| 158 | arguments (str) |
| 159 | """ |
| 160 | if test_name.startswith('telemetry_'): |
| 161 | return 'local=True' |
| 162 | return '' |
| 163 | |
| 164 | |
Kuang-che Wu | 6c5a5b2 | 2019-01-17 18:09:50 +0800 | [diff] [blame] | 165 | def prepare_to_run_test(opts): |
| 166 | # Some versions of ChromeOS SDK is broken and ship bad 'ssh' executable. This |
Kuang-che Wu | 9fcf108 | 2019-03-04 11:24:04 +0800 | [diff] [blame] | 167 | # works around the issue. See crbug/906289 for detail. |
| 168 | # TODO(kcwu): remove this workaround once we no longer support bisecting |
| 169 | # versions earlier than R73-11445.0.0. |
| 170 | ssh_path = os.path.join(opts.chromeos_root, 'chroot/usr/bin/ssh') |
Kuang-che Wu | 4fbd2d3 | 2019-03-07 01:07:57 +0800 | [diff] [blame] | 171 | if os.path.exists(ssh_path): |
| 172 | if 'file descriptor passing not supported' in open(ssh_path).read(): |
| 173 | cros_util.cros_sdk(opts.chromeos_root, 'sudo', 'emerge', |
| 174 | 'net-misc/openssh') |
Kuang-che Wu | 6c5a5b2 | 2019-01-17 18:09:50 +0800 | [diff] [blame] | 175 | |
Kuang-che Wu | f0ad9ac | 2019-09-06 13:05:04 +0800 | [diff] [blame] | 176 | # test_that may use this ssh key and ssh complains its permission is too open. |
Kuang-che Wu | 4a81ea7 | 2019-10-05 15:35:17 +0800 | [diff] [blame] | 177 | # chmod every time just before run test_that because the permission may change |
Kuang-che Wu | f0ad9ac | 2019-09-06 13:05:04 +0800 | [diff] [blame] | 178 | # after some git operations. |
| 179 | util.check_call( |
| 180 | 'chmod', |
| 181 | 'o-r,g-r', |
| 182 | 'src/scripts/mod_for_test_scripts/ssh_keys/testing_rsa', |
| 183 | cwd=opts.chromeos_root) |
| 184 | |
Kuang-che Wu | 6c5a5b2 | 2019-01-17 18:09:50 +0800 | [diff] [blame] | 185 | if opts.reinstall: |
Kuang-che Wu | 4427814 | 2019-03-04 11:33:57 +0800 | [diff] [blame] | 186 | util.ssh_cmd(opts.dut, 'rm', '-rf', '/usr/local/autotest') |
Kuang-che Wu | 6c5a5b2 | 2019-01-17 18:09:50 +0800 | [diff] [blame] | 187 | |
Kuang-che Wu | da3abfe | 2019-03-21 14:48:12 +0800 | [diff] [blame] | 188 | if opts.reboot_before_test: |
| 189 | cros_util.reboot(opts.dut) |
| 190 | |
Kuang-che Wu | 6c5a5b2 | 2019-01-17 18:09:50 +0800 | [diff] [blame] | 191 | |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 192 | def run_test(opts): |
| 193 | """Runs an autotest test. |
| 194 | |
| 195 | Args: |
| 196 | opts: An argparse.Namespace to hold command line arguments. |
| 197 | |
| 198 | Returns: |
| 199 | path of test result (outside chroot) |
| 200 | """ |
Kuang-che Wu | 7f82c6f | 2019-08-12 14:29:28 +0800 | [diff] [blame] | 201 | prebuilt_autotest_dir = os.path.join(cros_util.chromeos_root_inside_chroot, |
| 202 | cros_util.prebuilt_autotest_dir) |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 203 | # Set results dir inside source tree, so it's easier to access them outside |
| 204 | # chroot. |
| 205 | results_dir = os.path.join(cros_util.chromeos_root_inside_chroot, |
| 206 | 'tmp/autotest_results_tmp') |
Kuang-che Wu | 7f82c6f | 2019-08-12 14:29:28 +0800 | [diff] [blame] | 207 | if opts.prebuilt: |
| 208 | test_that_bin = os.path.join(prebuilt_autotest_dir, |
| 209 | 'site_utils/test_that.py') |
| 210 | else: |
| 211 | test_that_bin = '/usr/bin/test_that' |
Kuang-che Wu | f3d03ca | 2019-03-11 17:31:40 +0800 | [diff] [blame] | 212 | cmd = [ |
| 213 | test_that_bin, opts.dut, opts.test_name, '--debug', '--results_dir', |
Zheng-Jie Chang | 127c330 | 2019-09-10 17:17:04 +0800 | [diff] [blame] | 214 | results_dir, '--board', opts.board |
Kuang-che Wu | f3d03ca | 2019-03-11 17:31:40 +0800 | [diff] [blame] | 215 | ] |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 216 | if opts.prebuilt: |
Kuang-che Wu | 7f82c6f | 2019-08-12 14:29:28 +0800 | [diff] [blame] | 217 | cmd += ['--autotest_dir', prebuilt_autotest_dir] |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 218 | |
| 219 | args = get_additional_test_args(opts.test_name) |
| 220 | if opts.args: |
| 221 | if args: |
Kuang-che Wu | 74768d3 | 2018-09-07 12:03:24 +0800 | [diff] [blame] | 222 | logger.info( |
| 223 | 'default test_that args `%s` is overridden by ' |
| 224 | 'command line option `%s`', args, opts.args) |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 225 | cmd += ['--args', opts.args] |
| 226 | elif args: |
| 227 | cmd += ['--args', args] |
| 228 | |
Kuang-che Wu | 171dcb6 | 2018-10-25 12:37:05 +0800 | [diff] [blame] | 229 | try: |
Kuang-che Wu | d4603d7 | 2018-11-29 17:51:21 +0800 | [diff] [blame] | 230 | output = cros_util.cros_sdk( |
| 231 | opts.chromeos_root, *cmd, chrome_root=opts.chrome_root) |
Kuang-che Wu | 171dcb6 | 2018-10-25 12:37:05 +0800 | [diff] [blame] | 232 | except subprocess.CalledProcessError as e: |
| 233 | output = e.output |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 234 | |
| 235 | m = re.search(r'Finished running tests. Results can be found in (\S+)', |
| 236 | output) |
| 237 | if not m: |
| 238 | logger.error('result dir is unknown') |
| 239 | return None |
| 240 | assert m.group(1) == results_dir |
| 241 | return results_dir.replace(cros_util.chromeos_root_inside_chroot, |
| 242 | opts.chromeos_root) |
| 243 | |
| 244 | |
| 245 | def gather_test_result(opts, result_dir): |
| 246 | result_log_path = os.path.join(result_dir, 'test_report.log') |
| 247 | result_log = open(result_log_path).read() |
| 248 | |
| 249 | passed, values = parse_test_report_log(result_log, opts.metric) |
Kuang-che Wu | 171dcb6 | 2018-10-25 12:37:05 +0800 | [diff] [blame] | 250 | if opts.metric and not values: |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 251 | values = [] |
| 252 | for root, _, files in os.walk(result_dir): |
| 253 | for filename in files: |
| 254 | if filename != 'results-chart.json': |
| 255 | continue |
| 256 | full_path = os.path.join(root, filename) |
Kuang-che Wu | 4f0dc23 | 2019-05-10 18:28:06 +0800 | [diff] [blame] | 257 | values = catapult_util.get_benchmark_values(full_path, opts.metric) |
| 258 | return passed, values |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 259 | |
| 260 | return passed, values |
| 261 | |
| 262 | |
Kuang-che Wu | fe1e88a | 2019-09-10 21:52:25 +0800 | [diff] [blame] | 263 | @cli.fatal_error_handler |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 264 | def main(args=None): |
| 265 | common.init() |
| 266 | parser = create_argument_parser() |
| 267 | opts = parser.parse_args(args) |
| 268 | common.config_logging(opts) |
| 269 | |
| 270 | if not cros_util.is_dut(opts.dut): |
Kuang-che Wu | 4a75f95 | 2019-03-26 17:22:42 +0800 | [diff] [blame] | 271 | logger.error('%r is not a valid DUT address', opts.dut) |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 272 | return FATAL |
Kuang-che Wu | c8c495d | 2019-08-19 17:48:58 +0800 | [diff] [blame] | 273 | dut_os_version = cros_util.query_dut_short_version(opts.dut) |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 274 | |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 275 | is_cts = ( |
| 276 | opts.cts_revision or opts.cts_abi or opts.cts_prefix or opts.cts_module or |
Kuang-che Wu | 958d7d0 | 2019-05-30 17:58:21 +0800 | [diff] [blame] | 277 | opts.cts_test or opts.cts_runonce or opts.cts_timeout) |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 278 | if is_cts: |
| 279 | if opts.test_name or opts.metric or opts.args: |
| 280 | parser.error( |
| 281 | 'do not specify --test_name, --metric, --args for CTS/GTS tests') |
Kuang-che Wu | b91b151 | 2019-05-29 15:16:29 +0800 | [diff] [blame] | 282 | if not opts.cts_prefix: |
| 283 | parser.error('--cts_prefix should be specified for CTS/GTS tests') |
| 284 | if not opts.cts_module: |
| 285 | parser.error('--cts_module should be specified for CTS/GTS tests') |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 286 | opts.test_name = '%s.tradefed-run-test' % opts.cts_prefix |
| 287 | opts.args = 'module=%s test=%s' % (opts.cts_module, opts.cts_test) |
| 288 | if opts.cts_revision: |
| 289 | opts.args += ' revision=%s' % opts.cts_revision |
| 290 | if opts.cts_abi: |
| 291 | opts.args += ' abi=%s' % opts.cts_abi |
Kuang-che Wu | 958d7d0 | 2019-05-30 17:58:21 +0800 | [diff] [blame] | 292 | if opts.cts_runonce: |
| 293 | opts.args += ' max_retry=0' |
Kuang-che Wu | 85c613c | 2019-01-09 15:46:11 +0800 | [diff] [blame] | 294 | if opts.cts_timeout: |
| 295 | opts.args += ' timeout=%s' % opts.cts_timeout |
| 296 | else: |
| 297 | if not opts.test_name: |
| 298 | parser.error('argument --test_name is required') |
| 299 | |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 300 | # Verify command line options. |
| 301 | if opts.metric: |
Kuang-che Wu | 0a4304a | 2019-01-19 01:32:11 +0800 | [diff] [blame] | 302 | if opts.fail_to_pass: |
| 303 | logger.error('--fail_to_pass is not for benchmark test (--metric)') |
| 304 | return FATAL |
Kuang-che Wu | d4603d7 | 2018-11-29 17:51:21 +0800 | [diff] [blame] | 305 | if opts.test_name.startswith('telemetry_'): |
| 306 | if not opts.chrome_root: |
| 307 | logger.error('--chrome_root is mandatory for telemetry tests') |
| 308 | return FATAL |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 309 | |
Kuang-che Wu | 6c5a5b2 | 2019-01-17 18:09:50 +0800 | [diff] [blame] | 310 | try: |
| 311 | prepare_to_run_test(opts) |
| 312 | except Exception: |
| 313 | logger.exception('failed when prepare, assume it is temporary; SKIP') |
| 314 | return SKIP |
Kuang-che Wu | e47162d | 2018-10-29 17:24:04 +0800 | [diff] [blame] | 315 | |
Kuang-che Wu | 171dcb6 | 2018-10-25 12:37:05 +0800 | [diff] [blame] | 316 | result_dir = run_test(opts) |
| 317 | if not result_dir: |
Kuang-che Wu | dd80267 | 2018-08-10 19:40:14 +0800 | [diff] [blame] | 318 | return FATAL |
| 319 | |
Kuang-che Wu | c986b1d | 2019-04-15 16:45:20 +0800 | [diff] [blame] | 320 | try: |
| 321 | passed, values = gather_test_result(opts, result_dir) |
| 322 | except Exception: |
| 323 | logger.exception('failed to parse test result') |
| 324 | return FATAL |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 325 | |
Kuang-che Wu | c8c495d | 2019-08-19 17:48:58 +0800 | [diff] [blame] | 326 | # Sanity check. The OS version should not change. |
Kuang-che Wu | 523bdf2 | 2019-08-20 12:11:09 +0800 | [diff] [blame] | 327 | assert dut_os_version == cros_util.query_dut_short_version(opts.dut), \ |
| 328 | 'Someone else reflashed the DUT. ' \ |
| 329 | 'DUT locking is not respected? b/126141102' |
Kuang-che Wu | c8c495d | 2019-08-19 17:48:58 +0800 | [diff] [blame] | 330 | |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 331 | if opts.metric: |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 332 | if not values: |
| 333 | logger.warning('no values found; SKIP') |
| 334 | return SKIP |
| 335 | |
| 336 | print('BISECT_RESULT_VALUES=', ' '.join(map(str, values))) |
Kuang-che Wu | 81cde45 | 2019-04-08 16:56:51 +0800 | [diff] [blame] | 337 | logger.info('values=%s', values) |
| 338 | # The exit code doesn't matter. |
| 339 | return OLD |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 340 | else: |
Kuang-che Wu | 0a4304a | 2019-01-19 01:32:11 +0800 | [diff] [blame] | 341 | if opts.fail_to_pass: |
| 342 | if passed: |
| 343 | logger.info('passed') |
| 344 | return NEW |
| 345 | logger.info('failed') |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 346 | return OLD |
Kuang-che Wu | 0a4304a | 2019-01-19 01:32:11 +0800 | [diff] [blame] | 347 | else: |
| 348 | if passed: |
| 349 | logger.info('passed') |
| 350 | return OLD |
| 351 | logger.info('failed') |
| 352 | return NEW |
Kuang-che Wu | b9705bd | 2018-06-28 17:59:18 +0800 | [diff] [blame] | 353 | |
| 354 | |
| 355 | if __name__ == '__main__': |
| 356 | sys.exit(EXIT_CODE_MAP[main()]) |