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

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: address frankf comments Created 6 years, 11 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 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
« 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