blob: 239e7a34b0ba9fd3633ede1b06d9d8b150d1ea7f [file] [log] [blame]
Aviv Keshet7cd12312013-07-25 10:25:55 -07001# Copyright (c) 2012 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
5AUTHOR = "akeshet, chromeos-lab-infrastructure"
6NAME = "test_that_wrapper"
7PURPOSE = "Wrapper for ad-hoc suites kicked of by test_that tool."
Aviv Keshet7cd12312013-07-25 10:25:55 -07008
9TIME = "SHORT"
10TEST_CATEGORY = "General"
11TEST_CLASS = "suite"
12TEST_TYPE = "Server"
13
14DOC = """
15This is a wrapper suite for lab jobs that get kicked off by developers
16running the test_that tool on their desks, but targetting devices in the lab.
17
18@param build: The name of the image to test.
19 Ex: x86-mario-release/R17-1412.33.0-a1-b29
20@param board: The board to test on. Ex: x86-mario
21@param pool: The pool of machines to utilize for scheduling. If pool=None
22 board is used.
23@param check_hosts: require appropriate live hosts to exist in the lab.
24@param SKIP_IMAGE: (optional) If present and True, don't re-image devices.
25"""
26
27import logging, shlex
28
29import common
30from autotest_lib.server.cros.dynamic_suite import dynamic_suite
Fang Dengf1d89252016-01-12 06:40:19 +080031from autotest_lib.site_utils import test_runner_utils
Aviv Keshet7cd12312013-07-25 10:25:55 -070032from autotest_lib.site_utils import test_that
33from autotest_lib.server.cros import provision
34
35# Values specified in this bug template will override default values when
36# filing bugs on tests that are a part of this suite. If left unspecified
37# the bug filer will fallback to it's defaults.
38_BUG_TEMPLATE = {
39 'labels': ['test_that_wrapper'],
40 'owner': '',
41 'status': None,
42 'summary': None,
43 'title': None,
Aviv Keshet7cd12312013-07-25 10:25:55 -070044}
45
Allen Li3c0d6cb2017-08-21 17:05:57 -070046# TODO(crbug.com/758427): suite_args needed to support being run by old Autotest
47if 'tests' not in args_dict:
Allen Li8cb46d32017-08-07 13:06:02 -070048 try:
49 arguments = test_that.parse_arguments(shlex.split(suite_args))
50 except SystemExit:
51 logging.error('Unable to parse test_that arguments %s, suite aborting',
52 shlex.split(suite_args))
53 raise
Allen Li3c0d6cb2017-08-21 17:05:57 -070054 args_dict['tests'] = arguments.tests
Aviv Keshet7cd12312013-07-25 10:25:55 -070055
Fang Dengf1d89252016-01-12 06:40:19 +080056parsed_test_arguments = [test_runner_utils.get_predicate_for_test_arg(test_arg)
Allen Li3c0d6cb2017-08-21 17:05:57 -070057 for test_arg in args_dict['tests']]
Aviv Keshet7cd12312013-07-25 10:25:55 -070058sub_predicates, descriptions = zip(*parsed_test_arguments)
59
60logging.info('This is a test_that triggered suite, consisting of:')
61for desc in descriptions:
62 logging.info('A %s.', desc)
63
64combined_predicate = lambda test: any(f(test) for f in sub_predicates)
65
Shuqian Zhao24785cc2015-06-01 16:32:18 -070066args_dict['name'] = NAME
Allen Li4e245be2017-08-07 13:01:04 -070067args_dict.setdefault('max_runtime_mins', 20)
Shuqian Zhao24785cc2015-06-01 16:32:18 -070068args_dict['predicate'] = combined_predicate
69args_dict['job'] = job
70args_dict['add_experimental'] = True
71args_dict['version_prefix'] = provision.CROS_VERSION_PREFIX
72args_dict['bug_template'] = _BUG_TEMPLATE
73
74dynamic_suite.reimage_and_run(**args_dict)