comparison mx/mx_graal.py @ 16388:31e242cad4d1

Allow mx unittest to run single test method from a class
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 02 Jul 2014 13:05:02 -0700
parents d91fecb90fc0
children 380290b81eb0
comparison
equal deleted inserted replaced
16387:2bd6dbbd7842 16388:31e242cad4d1
972 if len(tests) == 0: 972 if len(tests) == 0:
973 classes = candidates.keys() 973 classes = candidates.keys()
974 projectscp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance]) 974 projectscp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance])
975 else: 975 else:
976 projs = set() 976 projs = set()
977 for t in tests: 977 if len(tests) == 1 and '#' in tests[0]:
978 found = False 978 words = tests[0].split('#')
979 if len(words) != 2:
980 mx.abort("Method specification is class#method: " + tests[0])
981 t, method = words
979 for c, p in candidates.iteritems(): 982 for c, p in candidates.iteritems():
980 if t in c: 983 if t in c:
981 found = True 984 found = True
982 classes.append(c) 985 # this code assumes a single test will be handled by GraalJUnitCore
986 classes.append(c + '#' + method)
983 projs.add(p.name) 987 projs.add(p.name)
984 if not found: 988 if not found:
985 mx.log('warning: no tests matched by substring "' + t) 989 mx.log('warning: no tests matched by substring "' + t)
990 else:
991 for t in tests:
992 if '#' in t:
993 mx.abort('Method specifications can only be used in a single test: ' + t)
994 found = False
995 for c, p in candidates.iteritems():
996 if t in c:
997 found = True
998 classes.append(c)
999 projs.add(p.name)
1000 if not found:
1001 mx.log('warning: no tests matched by substring "' + t)
986 projectscp = mx.classpath(projs) 1002 projectscp = mx.classpath(projs)
987 1003
988 if whitelist: 1004 if whitelist:
989 classes = [c for c in classes if any((glob.match(c) for glob in whitelist))] 1005 classes = [c for c in classes if any((glob.match(c) for glob in whitelist))]
990 1006