xref: /aosp_15_r20/external/autotest/server/site_tests/cheets_CTS_R/control.tradefed-run-test (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
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 = 3600
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                '--skip-device-info',
68                '--logcat-on-failure']
69retry_template = ['run', 'commandAndExit', 'retry',
70                  '--retry', '{session_id}']
71# Unfortunately super long test names can cause problems. Try to get the
72# rightmost element and use that as a simplified name.
73# TODO(ihf): fix pipeline so it works with super long names.
74simplified_test = cts_test
75if '#' in cts_test:
76    simplified_test = cts_test.split('#')[-1]
77elif '.' in cts_test:
78    simplified_test = cts_test.split('.')[-1]
79tag = 'tradefed-run-test.%s.%s' % (cts_module, simplified_test)
80
81# The usual testing stanza. We are suppressing some DEPENDENCIES on purpose.
82AUTHOR = 'ARC++ Team'
83NAME = 'cheets_CTS_R.tradefed-run-test'
84ATTRIBUTES = ''
85DEPENDENCIES = 'arc'
86JOB_RETRIES = 0
87TEST_TYPE = 'server'
88TIME = 'LONG'
89MAX_RESULT_SIZE_KB = 256000
90PY_VERSION = 3
91DOC = 'Run a test of the Android Compatibility Test Suite (CTS) in ARC++'
92
93# And launch.
94def run_TS(machine):
95    host_list = [hosts.create_host(machine)]
96    job.run_test(
97        'cheets_CTS_R',
98        hosts=host_list,
99        iterations=1,
100        enable_default_apps=True,
101        max_retry=cts_retry,
102        needs_push_media=True,
103        tag=tag,
104        test_name=NAME,
105        run_template=run_template,
106        retry_template=retry_template,
107        target_module=None,
108        target_plan=None,
109        bundle=cts_abi,
110        use_jdk9=True,
111        uri=uri,
112        load_waivers=('#' not in cts_test),  # No waivers for single-test runs
113        retry_manual_tests=('#' in cts_test),  # No waivers for single-test runs
114        login_precondition_commands=[
115            'lsblk -do NAME,RM | sed -n s/1$//p | xargs -n1 eject'
116        ],
117        timeout=cts_timeout)
118
119parallel_simple(run_TS, machines)
120