1# Copyright 2019 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# This file is not auto-generated. Don't delete it. 6 7# Boring. 8import logging 9import pprint 10from autotest_lib.client.bin import utils 11 12usage = """ 131) To run agains a particular $DUT use 14 test_that --args="module=CtsDeqpTestCases test=dEQP-GLES31.functional.image_load_store.2d_array.atomic#exchange_r32f_return_value" $DUT cheets_CTS_N.tradefed-run-tests 15 162) To run against a lab pool use 17 run_suite.py --board=eve --build=$TRYJOB_BUILD --suite_name arc-cts-test --pool cts --no_wait True --priority CQ --timeout_mins 6160 --retry False --num 1 --suite_min_duts 1 --test_args="{'module' : 'CtsDeqpTestCases', 'test' : 'dEQP-GLES31.functional.image_load_store.2d_array.atomic#exchange_r32f_return_value'}" 18""" 19 20def usage_error(): 21 logging.info('Example usage:') 22 logging.info(usage) 23 raise SystemExit 24 25pp = pprint.PrettyPrinter() 26logging.info( 27 '***********************************************************************') 28 29# Define the variables that we are going to use and set sensible defaults. 30cts_abi = 'arm' 31cts_module = '' 32cts_retry = 5 33cts_revision = '7.1_r29' # TODO(ihf): Set this default value from generator. 34cts_test = '' 35cts_timeout = 600 36 37# Pull parameters either from run_suite or test_that. 38if 'args_dict' in vars(): 39 logging.info('Raw test options from run_suite:') 40 pp.pprint(args_dict) 41elif args: 42 logging.info('Raw test options from test_that:') 43 pp.pprint(args) 44 args_dict = utils.args_to_dict(args) 45else: 46 usage_error() 47 48cts_abi = args_dict.get('abi', cts_abi) 49cts_module = args_dict.get('module', cts_module) 50cts_revision = args_dict.get('revision', cts_revision) 51cts_test = args_dict.get('test', cts_test) 52cts_timeout = float(args_dict.get('timeout', cts_timeout)) 53cts_retry = int(args_dict.get('max_retry', cts_retry)) 54 55# Sanity checks. 56logging.error('Running module %s with test %s on abi %s and revision %s', 57 cts_module, cts_test, cts_abi, cts_revision) 58if not cts_abi or not cts_module or not cts_revision or not cts_test: 59 usage_error() 60 61# And we are getting ready for tradefed. 62uri = ('gs://chromeos-arc-images/cts/bundle/N/android-cts-' + cts_revision + 63 '-linux_x86-' + cts_abi + '.zip') 64run_template = ['run', 'commandAndExit', 'cts', 65 '--include-filter', cts_module + ' ' + cts_test, 66 '--logcat-on-failure'] 67retry_template = ['run', 'commandAndExit', 'cts', 68 '--disable-reboot', '--skip-device-info', 69 '--retry', '{session_id}'] 70# Unfortunately super long test names can cause problems. Try to get the 71# rightmost element and use that as a simplified name. 72# TODO(ihf): fix pipeline so it works with super long names. 73simplified_test = cts_test 74if '#' in cts_test: 75 simplified_test = cts_test.split('#')[-1] 76elif '.' in cts_test: 77 simplified_test = cts_test.split('.')[-1] 78tag = 'tradefed-run-test.%s.%s' % (cts_module, simplified_test) 79 80# The usual testing stanza. We are suppressing some DEPENDENCIES on purpose. 81AUTHOR = 'ARC++ Team' 82NAME = 'cheets_CTS_N.tradefed-run-test' 83ATTRIBUTES = 'suite:arc-cts-test' 84DEPENDENCIES = 'arc' 85JOB_RETRIES = 0 86TEST_TYPE = 'server' 87TIME = 'LONG' 88MAX_RESULT_SIZE_KB = 256000 89DOC = ('Run a test of the Android Compatibility Test Suite (CTS) in the ARC++ ' 90 'container.') 91 92# And launch. 93def run_TS(machine): 94 host_list = [hosts.create_host(machine)] 95 job.run_test( 96 'cheets_CTS_N', 97 hosts=host_list, 98 iterations=1, 99 max_retry=cts_retry, 100 needs_push_media=True, 101 tag=tag, 102 test_name=NAME, 103 run_template=run_template, 104 retry_template=retry_template, 105 target_module=None, 106 target_plan=None, 107 bundle=cts_abi, 108 uri=uri, 109 login_precondition_commands=[ 110 'lsblk -do NAME,RM | sed -n s/1$//p | xargs -n1 eject' 111 ], 112 precondition_commands=[ 113 'echo $(({0} % 2 * 2 + 1)) > /proc/sys/kernel/perf_event_paranoid', 114 'modprobe configs' 115 ], 116 timeout=cts_timeout) 117 118parallel_simple(run_TS, machines) 119