Index: build/android/pylib/instrumentation/test_jar.py |
diff --git a/build/android/pylib/instrumentation/test_jar.py b/build/android/pylib/instrumentation/test_jar.py |
index 21ce8402b15a8fd2e50c105f19caeae369b3b212..9296b921fa2a2d33650329e8b929c7a16afee7b9 100644 |
--- a/build/android/pylib/instrumentation/test_jar.py |
+++ b/build/android/pylib/instrumentation/test_jar.py |
@@ -9,10 +9,16 @@ import logging |
import os |
import pickle |
import re |
+import sys |
from pylib import cmd_helper |
from pylib import constants |
+sys.path.insert(0, |
+ os.path.join(constants.DIR_SOURCE_ROOT, |
+ 'build', 'util', 'lib', 'common')) |
+ |
+import unittest_util |
# If you change the cached output of proguard, increment this number |
PICKLE_FORMAT_VERSION = 1 |
@@ -207,9 +213,16 @@ class TestJar(object): |
tests = [] |
if test_filter: |
# |available_tests| are in adb instrument format: package.path.class#test. |
- filter_without_hash = test_filter.replace('#', '.') |
- tests = [t for t in available_tests |
- if filter_without_hash in t.replace('#', '.')] |
+ |
+ # Maps a 'class.test' name to each 'package.path.class#test' name. |
+ sanitized_test_names = { |
+ t.split('.')[-1].replace('#', '.') : t for t in available_tests} |
frankf
2014/01/22 22:14:11
dictionary comprehension is only python 2.7+ right
|
+ # Filters 'class.test' names and populates |tests| with the corresponding |
+ # 'package.path.class#test' names. |
+ tests = [sanitized_test_names[t] for t in |
+ unittest_util.FilterTestNames( |
+ sanitized_test_names.keys(), |
+ test_filter.replace('#', '.'))] |
frankf
2014/01/22 22:14:11
this is pretty unreadable, can you tweak the white
|
else: |
tests = available_tests |