1 # 2 # Copyright (C) 2017 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 import logging 18 19 from vts.runners.host import asserts 20 from vts.runners.host import test_runner 21 22 from vts.testcases.template.gtest_binary_test import gtest_binary_test 23 24 25 class VtsKernelLibcutilsTest(gtest_binary_test.GtestBinaryTest): 26 '''Test runner script for kernel libctils test. 27 28 Attributes: 29 include_test_suite: list of string, gtest test suite names to include. 30 ''' 31 32 include_test_suite = ["AshmemTest"] 33 34 # Override 35 def filterOneTest(self, test_name): 36 """Check test filters for a test name. 37 38 The first layer of filter is user defined test filters: 39 if a include filter is not empty, only tests in include filter will 40 be executed regardless whether they are also in exclude filter. Else 41 if include filter is empty, only tests not in exclude filter will be 42 executed. 43 44 The second layer of filter is checking abi bitness: 45 if a test has a suffix indicating the intended architecture bitness, 46 and the current abi bitness information is available, non matching tests 47 will be skipped. By our convention, this function will look for bitness in suffix 48 formated as "32bit", "32Bit", "32BIT", or 64 bit equivalents. 49 50 This method assumes const.SUFFIX_32BIT and const.SUFFIX_64BIT are in lower cases. 51 52 Args: 53 test_name: string, name of a test 54 55 Raises: 56 signals.TestSilent if a test should not be executed 57 """ 58 super(VtsKernelLibcutilsTest, self).filterOneTest(test_name) 59 asserts.skipIf( 60 test_name.split('.')[0] not in self.include_test_suite, 61 'Test case not selected.') 62 63 64 if __name__ == "__main__": 65 test_runner.main() 66