summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-selftest49
1 files changed, 24 insertions, 25 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index 8cc2095c53..900b3f4873 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -220,12 +220,12 @@ def get_tests_from_module(tmod):
220 try: 220 try:
221 tid = vars(mod)[test].test_case 221 tid = vars(mod)[test].test_case
222 except: 222 except:
223 print 'DEBUG: tc id missing for ' + str(test) 223 print('DEBUG: tc id missing for ' + str(test))
224 tid = None 224 tid = None
225 try: 225 try:
226 ttag = vars(mod)[test].tag__feature 226 ttag = vars(mod)[test].tag__feature
227 except: 227 except:
228 # print 'DEBUG: feature tag missing for ' + str(test) 228 # print('DEBUG: feature tag missing for ' + str(test))
229 ttag = None 229 ttag = None
230 230
231 # NOTE: for some reason lstrip() doesn't work for mod.__module__ 231 # NOTE: for some reason lstrip() doesn't work for mod.__module__
@@ -320,17 +320,17 @@ def list_testsuite_by(criteria, keyword):
320 320
321 ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ]) 321 ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ])
322 322
323 print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module') 323 print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module'))
324 print '_' * 150 324 print('_' * 150)
325 for t in ts: 325 for t in ts:
326 if isinstance(t[1], (tuple, list)): 326 if isinstance(t[1], (tuple, list)):
327 print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t[0], ', '.join(t[1]), t[2], t[3], t[4]) 327 print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % (t[0], ', '.join(t[1]), t[2], t[3], t[4]))
328 else: 328 else:
329 print '%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % t 329 print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % t)
330 print '_' * 150 330 print('_' * 150)
331 print 'Filtering by:\t %s' % criteria 331 print('Filtering by:\t %s' % criteria)
332 print 'Looking for:\t %s' % ', '.join(str(x) for x in keyword) 332 print('Looking for:\t %s' % ', '.join(str(x) for x in keyword))
333 print 'Total found:\t %s' % len(ts) 333 print('Total found:\t %s' % len(ts))
334 334
335 335
336def list_tests(): 336def list_tests():
@@ -338,16 +338,15 @@ def list_tests():
338 338
339 ts = get_all_tests() 339 ts = get_all_tests()
340 340
341 print '%-4s\t%-10s\t%-50s' % ('id', 'tag', 'test') 341 print('%-4s\t%-10s\t%-50s' % ('id', 'tag', 'test'))
342 print '_' * 80 342 print('_' * 80)
343 for t in ts: 343 for t in ts:
344 if isinstance(t.tctag, (tuple, list)): 344 if isinstance(t.tctag, (tuple, list)):
345 print '%-4s\t%-10s\t%-50s' % (t.tcid, ', '.join(t.tctag), '.'.join([t.tcmodule, t.tcclass, t.tcname])) 345 print('%-4s\t%-10s\t%-50s' % (t.tcid, ', '.join(t.tctag), '.'.join([t.tcmodule, t.tcclass, t.tcname])))
346 else: 346 else:
347 print '%-4s\t%-10s\t%-50s' % (t.tcid, t.tctag, '.'.join([t.tcmodule, t.tcclass, t.tcname])) 347 print('%-4s\t%-10s\t%-50s' % (t.tcid, t.tctag, '.'.join([t.tcmodule, t.tcclass, t.tcname])))
348 print '_' * 80 348 print('_' * 80)
349 print 'Total found:\t %s' % len(ts) 349 print('Total found:\t %s' % len(ts))
350
351 350
352def list_tags(): 351def list_tags():
353 # Get all tags set to test cases 352 # Get all tags set to test cases
@@ -362,7 +361,7 @@ def list_tags():
362 else: 361 else:
363 tags.add(tc.tctag) 362 tags.add(tc.tctag)
364 363
365 print 'Tags:\t%s' % ', '.join(str(x) for x in tags) 364 print('Tags:\t%s' % ', '.join(str(x) for x in tags))
366 365
367def coverage_setup(coverage_source, coverage_include, coverage_omit): 366def coverage_setup(coverage_source, coverage_include, coverage_omit):
368 """ Set up the coverage measurement for the testcases to be run """ 367 """ Set up the coverage measurement for the testcases to be run """
@@ -443,12 +442,12 @@ def main():
443 bbpath = get_bb_var('BBPATH').split(':') 442 bbpath = get_bb_var('BBPATH').split(':')
444 layer_libdirs = [p for p in (os.path.join(l, 'lib') for l in bbpath) if os.path.exists(p)] 443 layer_libdirs = [p for p in (os.path.join(l, 'lib') for l in bbpath) if os.path.exists(p)]
445 sys.path.extend(layer_libdirs) 444 sys.path.extend(layer_libdirs)
446 reload(oeqa.selftest) 445 imp.reload(oeqa.selftest)
447 446
448 if args.run_tests_by and len(args.run_tests_by) >= 2: 447 if args.run_tests_by and len(args.run_tests_by) >= 2:
449 valid_options = ['name', 'class', 'module', 'id', 'tag'] 448 valid_options = ['name', 'class', 'module', 'id', 'tag']
450 if args.run_tests_by[0] not in valid_options: 449 if args.run_tests_by[0] not in valid_options:
451 print '--run-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.run_tests_by[0] 450 print('--run-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.run_tests_by[0])
452 return 1 451 return 1
453 else: 452 else:
454 criteria = args.run_tests_by[0] 453 criteria = args.run_tests_by[0]
@@ -458,7 +457,7 @@ def main():
458 if args.list_tests_by and len(args.list_tests_by) >= 2: 457 if args.list_tests_by and len(args.list_tests_by) >= 2:
459 valid_options = ['name', 'class', 'module', 'id', 'tag'] 458 valid_options = ['name', 'class', 'module', 'id', 'tag']
460 if args.list_tests_by[0] not in valid_options: 459 if args.list_tests_by[0] not in valid_options:
461 print '--list-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.list_tests_by[0] 460 print('--list-tests-by %s not a valid option. Choose one of <name|class|module|id|tag>.' % args.list_tests_by[0])
462 return 1 461 return 1
463 else: 462 else:
464 criteria = args.list_tests_by[0] 463 criteria = args.list_tests_by[0]
@@ -482,7 +481,7 @@ def main():
482 info = '' 481 info = ''
483 if module.startswith('_'): 482 if module.startswith('_'):
484 info = ' (hidden)' 483 info = ' (hidden)'
485 print module + info 484 print(module + info)
486 if args.list_allclasses: 485 if args.list_allclasses:
487 try: 486 try:
488 import importlib 487 import importlib
@@ -490,13 +489,13 @@ def main():
490 for v in vars(modlib): 489 for v in vars(modlib):
491 t = vars(modlib)[v] 490 t = vars(modlib)[v]
492 if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest: 491 if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest:
493 print " --", v 492 print(" --", v)
494 for method in dir(t): 493 for method in dir(t):
495 if method.startswith("test_") and callable(vars(t)[method]): 494 if method.startswith("test_") and callable(vars(t)[method]):
496 print " -- --", method 495 print(" -- --", method)
497 496
498 except (AttributeError, ImportError) as e: 497 except (AttributeError, ImportError) as e:
499 print e 498 print(e)
500 pass 499 pass
501 500
502 if args.run_tests or args.run_all_tests or args.run_tests_by: 501 if args.run_tests or args.run_all_tests or args.run_tests_by: