Brett Chabot | 924c089 | 2009-10-21 14:23:54 -0700 | [diff] [blame] | 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 | |
| 21 | class AbstractTestSuite(object): |
Brett Chabot | 4a5d9f1 | 2010-02-18 20:01:11 -0800 | [diff] [blame] | 22 | """Represents a generic test suite definition. |
| 23 | |
| 24 | TODO: rename this as AbstractTestDef. |
| 25 | """ |
Brett Chabot | 924c089 | 2009-10-21 14:23:54 -0700 | [diff] [blame] | 26 | |
| 27 | def __init__(self): |
| 28 | self._name = None |
| 29 | self._build_path = None |
| 30 | self._build_dependencies = [] |
| 31 | self._is_continuous = False |
Brett Chabot | 4a5d9f1 | 2010-02-18 20:01:11 -0800 | [diff] [blame] | 32 | self._suite = None |
Brett Chabot | 924c089 | 2009-10-21 14:23:54 -0700 | [diff] [blame] | 33 | self._description = '' |
| 34 | self._extra_build_args = '' |
| 35 | |
| 36 | def GetName(self): |
| 37 | return self._name |
| 38 | |
| 39 | def SetName(self, name): |
| 40 | self._name = name |
| 41 | return self |
| 42 | |
| 43 | def GetBuildPath(self): |
| 44 | """Returns the build path of this test, relative to source tree root.""" |
| 45 | return self._build_path |
| 46 | |
| 47 | def SetBuildPath(self, build_path): |
| 48 | self._build_path = build_path |
| 49 | return self |
| 50 | |
| 51 | def GetBuildDependencies(self, options): |
| 52 | """Returns a list of dependent build paths.""" |
| 53 | return self._build_dependencies |
| 54 | |
| 55 | def SetBuildDependencies(self, build_dependencies): |
| 56 | self._build_dependencies = build_dependencies |
| 57 | return self |
| 58 | |
| 59 | def IsContinuous(self): |
| 60 | """Returns true if test is part of the continuous test.""" |
| 61 | return self._is_continuous |
| 62 | |
| 63 | def SetContinuous(self, continuous): |
| 64 | self._is_continuous = continuous |
| 65 | return self._is_continuous |
| 66 | |
Brett Chabot | 4a5d9f1 | 2010-02-18 20:01:11 -0800 | [diff] [blame] | 67 | def GetSuite(self): |
| 68 | """Returns the name of test' suite, or None.""" |
| 69 | return self._suite |
Brett Chabot | 924c089 | 2009-10-21 14:23:54 -0700 | [diff] [blame] | 70 | |
Brett Chabot | 4a5d9f1 | 2010-02-18 20:01:11 -0800 | [diff] [blame] | 71 | def SetSuite(self, suite): |
| 72 | self._suite = suite |
Brett Chabot | 924c089 | 2009-10-21 14:23:54 -0700 | [diff] [blame] | 73 | return self |
| 74 | |
| 75 | def GetDescription(self): |
| 76 | """Returns a description if available, an empty string otherwise.""" |
| 77 | return self._description |
| 78 | |
| 79 | def SetDescription(self, desc): |
| 80 | self._description = desc |
| 81 | return self |
| 82 | |
| 83 | def GetExtraBuildArgs(self): |
| 84 | """Returns the extra build args if available, an empty string otherwise.""" |
| 85 | return self._extra_build_args |
| 86 | |
| 87 | def SetExtraBuildArgs(self, build_args): |
| 88 | self._extra_build_args = build_args |
| 89 | return self |
| 90 | |
| 91 | def Run(self, options, adb): |
| 92 | """Runs the test. |
| 93 | |
| 94 | Subclasses must implement this. |
| 95 | Args: |
| 96 | options: global command line options |
| 97 | adb: asdb_interface to device under test |
| 98 | """ |
| 99 | raise NotImplementedError |