Home | History | Annotate | Download | only in base_test
      1 #!/usr/bin/env python
      2 #
      3 # Copyright (C) 2017 The Android Open Source Project
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License");
      6 # you may not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 #      http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS,
     13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 #
     17 
     18 import logging
     19 
     20 from vts.runners.host import test_runner
     21 from vts.testcases.vts_selftest.test_framework.base_test import VtsSelfTestBaseTestFilter
     22 
     23 
     24 class VtsSelfTestBaseTestFilterExclude(
     25         VtsSelfTestBaseTestFilter.VtsSelfTestBaseTestFilter):
     26     '''Filter test class for exclude filter.
     27 
     28     Attributes:
     29         SHOULD_PASS_FILTER: list of string, test names that should pass
     30                             the internal test filter configured by user
     31         SHOULD_NOT_PASS_FILTER: list of string, test names that should pass
     32                                 the internal test filter configured by user
     33     '''
     34 
     35     SHOULD_PASS_FILTER = [
     36         'suite1.test1_16bit',
     37         'suite1.test2',
     38         'suite1.test2_64bit',
     39         'suite2.test1_32bit',
     40         'suite2.test1_64bit',
     41         'suite3.test2_64bit',
     42         # Since include_filter is empty, any pattern not matching the ones in
     43         # exclude filter should pass
     44         'other.test_names',
     45     ]
     46 
     47     SHOULD_NOT_PASS_FILTER = [
     48         'suite1.test1',
     49         'suite1.test2_32bit',
     50         'suite2.test2_32bit',
     51         'suite2.test2_64bit',
     52         'suite3.test1',
     53         'suite3.test1_32bit',
     54         'suite3.test1_64bit',
     55         'suite3.test2_32bit',
     56         # The following test is added to exclude filter through
     57         # filter's add_to_exclude_filter method when expand_bitness is True
     58         'added.test1_32bit',
     59         # The following test is added to include filter with negative pattern by
     60         # filter's add_to_exclude_filter method when expand_bitness is True
     61         'added.test2_64bit',
     62     ]
     63 
     64     # Override
     65     def setUpClass(self):
     66         super(VtsSelfTestBaseTestFilterExclude, self).setUpClass()
     67         self.test_filter.add_to_exclude_filter('added.test1')
     68         self.test_filter.add_to_include_filter('-added.test2')
     69 
     70 if __name__ == "__main__":
     71     test_runner.main()
     72