Aviv Keshet | 7cd1231 | 2013-07-25 10:25:55 -0700 | [diff] [blame] | 1 | # 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 | |
| 5 | AUTHOR = "akeshet, chromeos-lab-infrastructure" |
| 6 | NAME = "test_that_wrapper" |
| 7 | PURPOSE = "Wrapper for ad-hoc suites kicked of by test_that tool." |
Aviv Keshet | 7cd1231 | 2013-07-25 10:25:55 -0700 | [diff] [blame] | 8 | |
| 9 | TIME = "SHORT" |
| 10 | TEST_CATEGORY = "General" |
| 11 | TEST_CLASS = "suite" |
| 12 | TEST_TYPE = "Server" |
| 13 | |
| 14 | DOC = """ |
| 15 | This is a wrapper suite for lab jobs that get kicked off by developers |
| 16 | running 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 | |
| 27 | import logging, shlex |
| 28 | |
| 29 | import common |
| 30 | from autotest_lib.server.cros.dynamic_suite import dynamic_suite |
Fang Deng | f1d8925 | 2016-01-12 06:40:19 +0800 | [diff] [blame] | 31 | from autotest_lib.site_utils import test_runner_utils |
Aviv Keshet | 7cd1231 | 2013-07-25 10:25:55 -0700 | [diff] [blame] | 32 | from autotest_lib.site_utils import test_that |
Aviv Keshet | 7cd1231 | 2013-07-25 10:25:55 -0700 | [diff] [blame] | 33 | |
| 34 | # Values specified in this bug template will override default values when |
| 35 | # filing bugs on tests that are a part of this suite. If left unspecified |
| 36 | # the bug filer will fallback to it's defaults. |
| 37 | _BUG_TEMPLATE = { |
| 38 | 'labels': ['test_that_wrapper'], |
| 39 | 'owner': '', |
| 40 | 'status': None, |
| 41 | 'summary': None, |
| 42 | 'title': None, |
Aviv Keshet | 7cd1231 | 2013-07-25 10:25:55 -0700 | [diff] [blame] | 43 | } |
| 44 | |
Fang Deng | f1d8925 | 2016-01-12 06:40:19 +0800 | [diff] [blame] | 45 | parsed_test_arguments = [test_runner_utils.get_predicate_for_test_arg(test_arg) |
Allen Li | 3c0d6cb | 2017-08-21 17:05:57 -0700 | [diff] [blame] | 46 | for test_arg in args_dict['tests']] |
Aviv Keshet | 7cd1231 | 2013-07-25 10:25:55 -0700 | [diff] [blame] | 47 | sub_predicates, descriptions = zip(*parsed_test_arguments) |
| 48 | |
| 49 | logging.info('This is a test_that triggered suite, consisting of:') |
| 50 | for desc in descriptions: |
| 51 | logging.info('A %s.', desc) |
| 52 | |
| 53 | combined_predicate = lambda test: any(f(test) for f in sub_predicates) |
| 54 | |
Shuqian Zhao | 24785cc | 2015-06-01 16:32:18 -0700 | [diff] [blame] | 55 | args_dict['name'] = NAME |
Allen Li | 4e245be | 2017-08-07 13:01:04 -0700 | [diff] [blame] | 56 | args_dict.setdefault('max_runtime_mins', 20) |
Shuqian Zhao | 24785cc | 2015-06-01 16:32:18 -0700 | [diff] [blame] | 57 | args_dict['predicate'] = combined_predicate |
| 58 | args_dict['job'] = job |
| 59 | args_dict['add_experimental'] = True |
Shuqian Zhao | 24785cc | 2015-06-01 16:32:18 -0700 | [diff] [blame] | 60 | args_dict['bug_template'] = _BUG_TEMPLATE |
| 61 | |
| 62 | dynamic_suite.reimage_and_run(**args_dict) |