# HG changeset patch # User Tom Rodriguez # Date 1418875244 28800 # Node ID b56e88144e0a003e86b8d63fab9679e6a7589996 # Parent cbb09734754597475b6815484143a05a307a4b3f prefer exact class matches when searching for unit tests with method name diff -r cbb097347545 -r b56e88144e0a mx/mx_graal.py --- a/mx/mx_graal.py Wed Dec 17 19:57:58 2014 -0800 +++ b/mx/mx_graal.py Wed Dec 17 20:00:44 2014 -0800 @@ -1123,12 +1123,23 @@ t, method = words for c, p in candidates.iteritems(): - if t in c: + # prefer exact matches first + if t == c: found = True - classes.append(c + '#' + method) + classes.append(c) projs.add(p.name) if not found: + for c, p in candidates.iteritems(): + if t in c: + found = True + classes.append(c) + projs.add(p.name) + if not found: mx.log('warning: no tests matched by substring "' + t) + elif len(classes) != 1: + mx.abort('More than one test matches substring {0} {1}'.format(t, classes)) + + classes = [c + "#" + method for c in classes] else: for t in tests: if '#' in t: