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=GtsMediaTestCases test=com.google.android.media.gts.MediaCodecStressTest#testDecodeDecodeCompositeDisplay1080p" $DUT cheets_GTS.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 = '8-R2-P-6955212' # TODO(ihf): Set this default value from generator. 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_revision 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 + '.zip') 61run_template = ['run', 'commandAndExit', 'gts', 62 '--include-filter', gts_module + ' ' + gts_test, 63 '--ignore-business-logic-failure'] 64retry_template = ['run', 'commandAndExit', 'retry', 65 '--retry', '{session_id}'] 66# Unfortunately super long test names can cause problems. Try to get the 67# rightmost element and use that as a simplified name. 68# TODO(ihf): fix pipeline so it works with super long names. 69simplified_test = gts_test 70if '#' in gts_test: 71 simplified_test = gts_test.split('#')[-1] 72elif '.' in gts_test: 73 simplified_test = gts_test.split('.')[-1] 74tag = 'tradefed-run-test.%s.%s' % (gts_module, simplified_test) 75 76# The usual testing stanza. We are suppressing some DEPENDENCIES on purpose. 77AUTHOR = 'ARC++ Team' 78NAME = 'cheets_GTS.tradefed-run-test' 79ATTRIBUTES = '' 80DEPENDENCIES = 'arc' 81JOB_RETRIES = 0 82TEST_TYPE = 'server' 83TIME = 'LONG' 84MAX_RESULT_SIZE_KB = 256000 85DOC = ('Run a test of the Android Google Test Suite (GTS) in the ARC++ ' 86 'container.') 87 88# And launch. 89def run_TS(machine): 90 host_list = [hosts.create_host(machine)] 91 job.run_test( 92 'cheets_GTS', 93 hosts=host_list, 94 iterations=1, 95 max_retry=gts_retry, 96 needs_push_media=True, 97 tag=tag, 98 test_name=NAME, 99 authkey='gs://chromeos-arc-images/cts/bundle/gts-arc.json', 100 run_template=run_template, 101 retry_template=retry_template, 102 target_module=None, 103 target_plan=None, 104 uri=uri, 105 login_precondition_commands=[ 106 'lsblk -do NAME,RM | sed -n s/1$//p | xargs -n1 eject' 107 ], 108 precondition_commands=[ 109 'echo $(({0} % 2 * 2 + 1)) > /proc/sys/kernel/perf_event_paranoid', 110 'modprobe configs' 111 ], 112 timeout=gts_timeout) 113 114parallel_simple(run_TS, machines) 115