1#!/usr/bin/python2.4 2# 3# 4# Copyright 2009, The Android Open Source Project 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18"""Abstract Android test suite.""" 19 20 21class AbstractTestSuite(object): 22 """Represents a generic test suite definition.""" 23 24 def __init__(self): 25 self._name = None 26 self._build_path = None 27 self._build_dependencies = [] 28 self._is_continuous = False 29 self._is_cts = False 30 self._description = '' 31 self._extra_build_args = '' 32 33 def GetName(self): 34 return self._name 35 36 def SetName(self, name): 37 self._name = name 38 return self 39 40 def GetBuildPath(self): 41 """Returns the build path of this test, relative to source tree root.""" 42 return self._build_path 43 44 def SetBuildPath(self, build_path): 45 self._build_path = build_path 46 return self 47 48 def GetBuildDependencies(self, options): 49 """Returns a list of dependent build paths.""" 50 return self._build_dependencies 51 52 def SetBuildDependencies(self, build_dependencies): 53 self._build_dependencies = build_dependencies 54 return self 55 56 def IsContinuous(self): 57 """Returns true if test is part of the continuous test.""" 58 return self._is_continuous 59 60 def SetContinuous(self, continuous): 61 self._is_continuous = continuous 62 return self._is_continuous 63 64 def IsCts(self): 65 """Returns true if test is part of the compatibility test suite""" 66 return self._is_cts 67 68 def SetCts(self, cts): 69 self._is_cts = cts 70 return self 71 72 def GetDescription(self): 73 """Returns a description if available, an empty string otherwise.""" 74 return self._description 75 76 def SetDescription(self, desc): 77 self._description = desc 78 return self 79 80 def GetExtraBuildArgs(self): 81 """Returns the extra build args if available, an empty string otherwise.""" 82 return self._extra_build_args 83 84 def SetExtraBuildArgs(self, build_args): 85 self._extra_build_args = build_args 86 return self 87 88 def Run(self, options, adb): 89 """Runs the test. 90 91 Subclasses must implement this. 92 Args: 93 options: global command line options 94 adb: asdb_interface to device under test 95 """ 96 raise NotImplementedError 97