comparison mx/mx_graal.py @ 18714:b56e88144e0a

prefer exact class matches when searching for unit tests with method name
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 17 Dec 2014 20:00:44 -0800
parents 88c280297bd2
children d7ec30ebb0f2
comparison
equal deleted inserted replaced
18713:cbb097347545 18714:b56e88144e0a
1121 if len(words) != 2: 1121 if len(words) != 2:
1122 mx.abort("Method specification is class#method: " + tests[0]) 1122 mx.abort("Method specification is class#method: " + tests[0])
1123 t, method = words 1123 t, method = words
1124 1124
1125 for c, p in candidates.iteritems(): 1125 for c, p in candidates.iteritems():
1126 if t in c: 1126 # prefer exact matches first
1127 if t == c:
1127 found = True 1128 found = True
1128 classes.append(c + '#' + method) 1129 classes.append(c)
1129 projs.add(p.name) 1130 projs.add(p.name)
1130 if not found: 1131 if not found:
1132 for c, p in candidates.iteritems():
1133 if t in c:
1134 found = True
1135 classes.append(c)
1136 projs.add(p.name)
1137 if not found:
1131 mx.log('warning: no tests matched by substring "' + t) 1138 mx.log('warning: no tests matched by substring "' + t)
1139 elif len(classes) != 1:
1140 mx.abort('More than one test matches substring {0} {1}'.format(t, classes))
1141
1142 classes = [c + "#" + method for c in classes]
1132 else: 1143 else:
1133 for t in tests: 1144 for t in tests:
1134 if '#' in t: 1145 if '#' in t:
1135 mx.abort('Method specifications can only be used in a single test: ' + t) 1146 mx.abort('Method specifications can only be used in a single test: ' + t)
1136 for c, p in candidates.iteritems(): 1147 for c, p in candidates.iteritems():