1# Copyright 2023 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15from importlib import resources 16from pathlib import Path 17import importlib 18import sys 19import tempfile 20import unittest 21 22tests = [ 23 'HCI.AEN.BV_06_C', 24 'LL.CIS.CEN.BV_01_C', 25 'LL.CIS.CEN.BV_03_C', 26 'LL.CIS.CEN.BV_10_C', 27 'LL.CIS.CEN.BV_26_C', 28 'LL.CIS.PER.BV_01_C', 29 'LL.CIS.PER.BV_02_C', 30 'LL.CON_.CEN.BV_41_C', 31 'LL.CON_.CEN.BV_43_C', 32 'LL.CON_.INI.BV_08_C', 33 'LL.CON_.INI.BV_09_C', 34 'LL.CON_.INI.BV_10_C', 35 'LL.CON_.INI.BV_11_C', 36 'LL.CON_.PER.BV_40_C', 37 'LL.CON_.PER.BV_42_C', 38 'LL.DDI.ADV.BV_01_C', 39 'LL.DDI.ADV.BV_02_C', 40 'LL.DDI.ADV.BV_03_C', 41 'LL.DDI.ADV.BV_04_C', 42 'LL.DDI.ADV.BV_05_C', 43 'LL.DDI.ADV.BV_06_C', 44 'LL.DDI.ADV.BV_07_C', 45 'LL.DDI.ADV.BV_08_C', 46 'LL.DDI.ADV.BV_09_C', 47 'LL.DDI.ADV.BV_11_C', 48 'LL.DDI.ADV.BV_15_C', 49 'LL.DDI.ADV.BV_16_C', 50 'LL.DDI.ADV.BV_17_C', 51 'LL.DDI.ADV.BV_18_C', 52 'LL.DDI.ADV.BV_19_C', 53 'LL.DDI.ADV.BV_20_C', 54 'LL.DDI.ADV.BV_21_C', 55 'LL.DDI.ADV.BV_22_C', 56 'LL.DDI.ADV.BV_26_C', 57 'LL.DDI.ADV.BV_47_C', 58 'LL.DDI.SCN.BV_13_C', 59 'LL.DDI.SCN.BV_14_C', 60 'LL.DDI.SCN.BV_18_C', 61 'LL.DDI.SCN.BV_19_C', 62 'LL.DDI.SCN.BV_20_C', 63 'LL.DDI.SCN.BV_79_C', 64 'LL.SEC.ADV.BV_11_C', 65 'LMP.LIH.BV_01_C', 66 'LMP.LIH.BV_02_C', 67 'LMP.LIH.BV_78_C', 68 'LMP.LIH.BV_79_C', 69 'LMP.LIH.BV_142_C', 70 'LMP.LIH.BV_143_C', 71 'LMP.LIH.BV_144_C', 72 'LMP.LIH.BV_149_C', 73 'LL.scan_collision', 74 'LL.scan_timeout', 75 'LMP.page_collision', 76] 77 78 79def include_test(test: str, patterns) -> bool: 80 return not patterns or any(test.startswith(prefix) for prefix in patterns) 81 82 83if __name__ == "__main__": 84 suite = unittest.TestSuite() 85 patterns = [arg for arg in sys.argv[1:] if not arg.startswith('-')] 86 for test in tests: 87 if include_test(test, patterns): 88 module = importlib.import_module(f'test.{test}') 89 suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(module)) 90 unittest.TextTestRunner(verbosity=3).run(suite) 91