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=GtsMediaTestCases test=com.google.android.media.gts.MediaCodecStressTest#testDecodeDecodeCompositeDisplay1080p" $DUT cheets_GTS_R.tradefed-run-test 15 162) To run against a lab pool use 17 run_suite.py --board=eve --build=$TRYJOB_BUILD --suite_name arc-gts-test --pool cts --no_wait True --priority CQ --timeout_mins 6160 --retry False --num 1 --suite_min_duts 1 --test_args="{'module' : 'GtsMediaTestCases', 'test' : 'com.google.android.media.gts.MediaCodecStressTest#testDecodeDecodeCompositeDisplay1080p'}" 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. 30gts_module = '' 31gts_retry = 5 32gts_revision = None 33gts_test = '' 34gts_timeout = 600 35 36# Pull parameters either from run_suite or test_that. 37if 'args_dict' in vars(): 38 logging.info('Raw test options from run_suite:') 39 pp.pprint(args_dict) 40elif args: 41 logging.info('Raw test options from test_that:') 42 pp.pprint(args) 43 args_dict = utils.args_to_dict(args) 44else: 45 usage_error() 46 47gts_module = args_dict.get('module', gts_module) 48gts_revision = args_dict.get('revision', gts_revision) 49gts_test = args_dict.get('test', gts_test) 50gts_timeout = float(args_dict.get('timeout', gts_timeout)) 51gts_retry = int(args_dict.get('max_retry', gts_retry)) 52 53# Basic checks for option validity. 54logging.error('Running module %s with test %s on revision %s', 55 gts_module, gts_test, gts_revision) 56if not gts_module or not gts_test: 57 usage_error() 58 59# And we are getting ready for tradefed. 60uri = ('gs://chromeos-arc-images/cts/bundle/android-gts-' + gts_revision + 61 '.zip') if gts_revision else 'LATEST' 62run_template = ['run', 'commandAndExit', 'gts', 63 '--include-filter', gts_module + ' ' + gts_test, 64 '--ignore-business-logic-failure'] 65retry_template = ['run', 'commandAndExit', 'retry', 66 '--retry', '{session_id}'] 67# Unfortunately super long test names can cause problems. Try to get the 68# rightmost element and use that as a simplified name. 69# TODO(ihf): fix pipeline so it works with super long names. 70simplified_test = gts_test 71if '#' in gts_test: 72 simplified_test = gts_test.split('#')[-1] 73elif '.' in gts_test: 74 simplified_test = gts_test.split('.')[-1] 75tag = 'tradefed-run-test.%s.%s' % (gts_module, simplified_test) 76 77# The usual testing stanza. We are suppressing some DEPENDENCIES on purpose. 78AUTHOR = 'ARC++ Team' 79NAME = 'cheets_GTS_R.tradefed-run-test' 80ATTRIBUTES = '' 81DEPENDENCIES = 'arc' 82JOB_RETRIES = 0 83TEST_TYPE = 'server' 84TIME = 'LONG' 85MAX_RESULT_SIZE_KB = 256000 86DOC = ('Run a test of the Android Google Test Suite (GTS) in the ARC++ ' 87 'container.') 88 89# And launch. 90def run_TS(machine): 91 host_list = [hosts.create_host(machine)] 92 job.run_test( 93 'cheets_GTS_R', 94 hosts=host_list, 95 iterations=1, 96 max_retry=gts_retry, 97 needs_push_media=True, 98 tag=tag, 99 test_name=NAME, 100 authkey='gs://chromeos-arc-images/cts/bundle/gts-arc.json', 101 run_template=run_template, 102 retry_template=retry_template, 103 target_module=None, 104 target_plan=None, 105 uri=uri, 106 login_precondition_commands=[ 107 'lsblk -do NAME,RM | sed -n s/1$//p | xargs -n1 eject' 108 ], 109 precondition_commands=[ 110 'echo $(({0} % 2 * 2 + 1)) > /proc/sys/kernel/perf_event_paranoid', 111 'modprobe configs' 112 ], 113 timeout=gts_timeout) 114 115parallel_simple(run_TS, machines) 116