1*9c5db199SXin Li# Copyright 2015 The Chromium OS Authors. All rights reserved. 2*9c5db199SXin Li# Use of this source code is governed by a BSD-style license that can be 3*9c5db199SXin Li# found in the LICENSE file. 4*9c5db199SXin Li 5*9c5db199SXin LiAUTHOR = "shuqianz, chromeos-infra" 6*9c5db199SXin LiNAME = "suite_attr_wrapper" 7*9c5db199SXin Li 8*9c5db199SXin LiTIME = "SHORT" 9*9c5db199SXin LiTEST_CATEGORY = "General" 10*9c5db199SXin LiTEST_CLASS = "suite" 11*9c5db199SXin LiTEST_TYPE = "Server" 12*9c5db199SXin Li 13*9c5db199SXin LiDOC = """ 14*9c5db199SXin LiThis is a wrapper suite to trigger tests that satisfy any attribute boolean 15*9c5db199SXin Liexpression. 16*9c5db199SXin Li 17*9c5db199SXin Li@param build: The name of the image to test. 18*9c5db199SXin Li Ex: x86-mario-release/R17-1412.33.0-a1-b29 19*9c5db199SXin Li@param board: The board to test on. Ex: x86-mario 20*9c5db199SXin Li@param pool: The pool of machines to utilize for scheduling. If pool=None 21*9c5db199SXin Li board is used. 22*9c5db199SXin Li@param check_hosts: require appropriate live hosts to exist in the lab. 23*9c5db199SXin Li@param SKIP_IMAGE: (optional) If present and True, don't re-image devices. 24*9c5db199SXin Li""" 25*9c5db199SXin Liimport logging 26*9c5db199SXin Li 27*9c5db199SXin Liimport common 28*9c5db199SXin Lifrom autotest_lib.server.cros.dynamic_suite import dynamic_suite 29*9c5db199SXin Lifrom autotest_lib.server.cros.dynamic_suite import suite 30*9c5db199SXin Li 31*9c5db199SXin Li# Get the predicate object from attr_filter argument 32*9c5db199SXin Li 33*9c5db199SXin Litry: 34*9c5db199SXin Li attr = args_dict['attr_filter'] 35*9c5db199SXin Li attr_predicate = suite.Suite.matches_attribute_expression_predicate(attr) 36*9c5db199SXin Liexcept KeyError: 37*9c5db199SXin Li logging.error('Unable to find the attribute boolean expression used to ' 38*9c5db199SXin Li 'trigger tests in suite_args %s, please use attr_filter ' 39*9c5db199SXin Li 'keyword to specify it. suite aborting' % args_dict) 40*9c5db199SXin Li raise 41*9c5db199SXin Li 42*9c5db199SXin Liargs_dict['predicate'] = attr_predicate 43*9c5db199SXin Liargs_dict.setdefault('name', NAME) 44*9c5db199SXin Liargs_dict['job'] = job 45*9c5db199SXin Li 46*9c5db199SXin Lidynamic_suite.reimage_and_run(**args_dict) 47