summaryrefslogtreecommitdiffstats
path: root/scripts/oe-selftest
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/oe-selftest')
-rwxr-xr-xscripts/oe-selftest53
1 files changed, 28 insertions, 25 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index bd9cbe0826..de98a6cb0d 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -162,19 +162,33 @@ def remove_inc_files():
162 except: 162 except:
163 pass 163 pass
164 164
165
166def get_tests_modules(include_hidden=False):
167 modules_list = list()
168 for modules_path in oeqa.selftest.__path__:
169 for (p, d, f) in os.walk(modules_path):
170 files = sorted([f for f in os.listdir(p) if f.endswith('.py') and not (f.startswith('_') and not include_hidden) and not f.startswith('__') and f != 'base.py'])
171 for f in files:
172 submodules = p.split("selftest")[-1]
173 module = ""
174 if submodules:
175 module = 'oeqa.selftest' + submodules.replace("/",".") + "." + f.split('.py')[0]
176 else:
177 module = 'oeqa.selftest.' + f.split('.py')[0]
178 if module not in modules_list:
179 modules_list.append(module)
180 return modules_list
181
182
165def get_tests(exclusive_modules=[], include_hidden=False): 183def get_tests(exclusive_modules=[], include_hidden=False):
166 testslist = [] 184 test_modules = list()
167 for x in exclusive_modules: 185 for x in exclusive_modules:
168 testslist.append('oeqa.selftest.' + x) 186 test_modules.append('oeqa.selftest.' + x)
169 if not testslist: 187 if not test_modules:
170 for testpath in oeqa.selftest.__path__: 188 inc_hidden = include_hidden
171 files = sorted([f for f in os.listdir(testpath) if f.endswith('.py') and not (f.startswith('_') and not include_hidden) and not f.startswith('__') and f != 'base.py']) 189 test_modules = get_tests_modules(inc_hidden)
172 for f in files:
173 module = 'oeqa.selftest.' + f[:-3]
174 if module not in testslist:
175 testslist.append(module)
176 190
177 return testslist 191 return test_modules
178 192
179 193
180class Tc: 194class Tc:
@@ -221,23 +235,12 @@ def get_tests_from_module(tmod):
221 235
222 236
223def get_all_tests(): 237def get_all_tests():
224 tmodules = set()
225 testlist = []
226 prefix = 'oeqa.selftest.'
227
228 # Get all the test modules (except the hidden ones) 238 # Get all the test modules (except the hidden ones)
229 for tpath in oeqa.selftest.__path__: 239 testlist = []
230 files = sorted([f for f in os.listdir(tpath) if f.endswith('.py') and not 240 tests_modules = get_tests_modules()
231 f.startswith(('_', '__')) and f != 'base.py'])
232 for f in files:
233 tmodules.add(prefix + f.rstrip('.py'))
234
235 # Get all the tests from modules 241 # Get all the tests from modules
236 tmodules = sorted(list(tmodules)) 242 for tmod in sorted(tests_modules):
237
238 for tmod in tmodules:
239 testlist += get_tests_from_module(tmod) 243 testlist += get_tests_from_module(tmod)
240
241 return testlist 244 return testlist
242 245
243 246
@@ -481,7 +484,7 @@ def main():
481 log.info('Listing all available test modules:') 484 log.info('Listing all available test modules:')
482 testslist = get_tests(include_hidden=True) 485 testslist = get_tests(include_hidden=True)
483 for test in testslist: 486 for test in testslist:
484 module = test.split('.')[-1] 487 module = test.split('oeqa.selftest.')[-1]
485 info = '' 488 info = ''
486 if module.startswith('_'): 489 if module.startswith('_'):
487 info = ' (hidden)' 490 info = ' (hidden)'