diff 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
line wrap: on
line diff
--- 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: