1# Copyright 2020 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_R.tradefed-run-test 15 test_that --args="module=CtsViewTestCases test=android.view.cts.SurfaceViewSyncTest#testVideoSurfaceViewCornerCoverage retry=0 revision=6714044" 100.90.29.152 cheets_CTS_R.tradefed-run-test 16 172) To run against a lab pool use 18 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'}" 19""" 20 21def usage_error(): 22 logging.info('Example usage:') 23 logging.info(usage) 24 raise SystemExit 25 26pp = pprint.PrettyPrinter() 27logging.info( 28 '***********************************************************************') 29 30# Define the variables that we are going to use and set sensible defaults. 31cts_abi = 'arm' 32cts_module = '' 33cts_retry = 5 34cts_revision = None 35cts_test = '' 36cts_timeout = 600 37 38# Pull parameters either from run_suite or test_that. 39if 'args_dict' in vars(): 40 logging.info('Raw test options from run_suite:') 41 pp.pprint(args_dict) 42elif args: 43 logging.info('Raw test options from test_that:') 44 pp.pprint(args) 45 args_dict = utils.args_to_dict(args) 46else: 47 usage_error() 48 49cts_abi = args_dict.get('abi', cts_abi) 50cts_module = args_dict.get('module', cts_module) 51cts_revision = args_dict.get('revision', cts_revision) 52cts_test = args_dict.get('test', cts_test) 53cts_timeout = float(args_dict.get('timeout', cts_timeout)) 54cts_retry = int(args_dict.get('max_retry', cts_retry)) 55 56# Basic checks for option validity. 57logging.error('Running module %s with test %s on abi %s and revision %s', 58 cts_module, cts_test, cts_abi, cts_revision) 59if not cts_abi or not cts_module or not cts_test: 60 usage_error() 61 62# And we are getting ready for tradefed. 63uri = ('gs://chromeos-arc-images/cts/bundle/R/android-cts-' + cts_revision + 64 '-linux_x86-' + cts_abi + '.zip') if cts_revision else 'LATEST' 65run_template = ['run', 'commandAndExit', 'cts', 66 '--include-filter', cts_module + ' ' + cts_test, 67 '--logcat-on-failure'] 68retry_template = ['run', 'commandAndExit', 'retry', 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_R.tradefed-run-test' 83ATTRIBUTES = '' 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 ARC++' 90 91# And launch. 92def run_TS(machine): 93 host_list = [hosts.create_host(machine)] 94 job.run_test( 95 'cheets_CTS_R', 96 hosts=host_list, 97 iterations=1, 98 max_retry=cts_retry, 99 needs_push_media=True, 100 tag=tag, 101 test_name=NAME, 102 run_template=run_template, 103 retry_template=retry_template, 104 target_module=None, 105 target_plan=None, 106 bundle=cts_abi, 107 use_jdk9=True, 108 uri=uri, 109 timeout=cts_timeout) 110 111parallel_simple(run_TS, machines) 112