• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018 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_P.tradefed-run-test
15   test_that --args="module=CtsViewTestCases test=android.view.cts.SurfaceViewSyncTest#testVideoSurfaceViewCornerCoverage retry=0 revision=9.0_r7" 100.90.29.152 cheets_CTS_P.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 = '9.0_r14'  # TODO(ihf): Set this default value from generator.
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_revision or not cts_test:
60    usage_error()
61
62# And we are getting ready for tradefed.
63uri = ('gs://chromeos-arc-images/cts/bundle/P/android-cts-' + cts_revision +
64       '-linux_x86-' + cts_abi + '.zip')
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_P.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 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_P',
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