1# Copyright 2015 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 = "shuqianz, chromeos-infra" 6NAME = "suite_attr_wrapper" 7 8TIME = "SHORT" 9TEST_CATEGORY = "General" 10TEST_CLASS = "suite" 11TEST_TYPE = "Server" 12 13DOC = """ 14This is a wrapper suite to trigger tests that satisfy any attribute boolean 15expression. 16 17@param build: The name of the image to test. 18 Ex: x86-mario-release/R17-1412.33.0-a1-b29 19@param board: The board to test on. Ex: x86-mario 20@param pool: The pool of machines to utilize for scheduling. If pool=None 21 board is used. 22@param check_hosts: require appropriate live hosts to exist in the lab. 23@param SKIP_IMAGE: (optional) If present and True, don't re-image devices. 24""" 25import ast 26import logging 27 28import common 29from autotest_lib.server.cros.dynamic_suite import dynamic_suite 30from autotest_lib.server.cros.dynamic_suite import suite 31from autotest_lib.server.cros import provision 32 33# Get the predicate object from attr_filter argument 34 35# TODO(crbug.com/758427): suite_args needed to support being run by old Autotest 36if 'attr_filter' not in args_dict: 37 args_dict.update(ast.literal_eval(suite_args)) 38 39try: 40 attr = args_dict['attr_filter'] 41 attr_predicate = suite.Suite.matches_attribute_expression_predicate(attr) 42except KeyError: 43 logging.error('Unable to find the attribute boolean expression used to ' 44 'trigger tests in suite_args %s, please use attr_filter ' 45 'keyword to specify it. suite aborting' % args_dict) 46 raise 47 48args_dict['predicate'] = attr_predicate 49args_dict.setdefault('name', NAME) 50args_dict['job'] = job 51args_dict.setdefault('version_prefix', provision.CROS_VERSION_PREFIX) 52 53dynamic_suite.reimage_and_run(**args_dict) 54