Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Unified Diff: build/android/pylib/instrumentation/test_jar.py

Issue 144183004: Convert to gtest-style filtering in instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/host_driven/test_info_collection.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9df90fcb7c0a785131bba4f6ce1190c9028367ff..53fd4948aad27caa9b2cc03c9d5d05a9f7140fa2 100644
--- a/build/android/pylib/instrumentation/test_jar.py
+++ b/build/android/pylib/instrumentation/test_jar.py
@@ -10,10 +10,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
@@ -177,7 +183,7 @@ class TestJar(object):
return sorted(tests_missing_annotations)
def GetAllMatchingTests(self, annotation_filter_list,
- exclude_annotation_list, test_filter):
+ exclude_annotation_list, test_filter):
"""Get a list of tests matching any of the annotations and the filter.
Args:
@@ -210,9 +216,15 @@ 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 = dict([
+ (t.split('.')[-1].replace('#', '.'), t) for t in available_tests])
+ # 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('#', '.'))]
else:
tests = available_tests
« no previous file with comments | « build/android/pylib/host_driven/test_info_collection.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698