Index: build/android/pylib/gtest/gtest_test_instance.py |
diff --git a/build/android/pylib/gtest/gtest_test_instance.py b/build/android/pylib/gtest/gtest_test_instance.py |
index 1e8769310e7d797dc0d872e01a1b0972d31e9551..37b252799ab33316f344aa568abdd087e0aebbfc 100644 |
--- a/build/android/pylib/gtest/gtest_test_instance.py |
+++ b/build/android/pylib/gtest/gtest_test_instance.py |
@@ -38,24 +38,75 @@ _DEPS_EXCLUSION_LIST = [ |
] |
+# TODO(jbudorick): Make this a class method of GtestTestInstance once |
+# test_package_apk and test_package_exe are gone. |
+def ParseGTestListTests(raw_list): |
+ """Parses a raw test list as provided by --gtest_list_tests. |
+ |
+ Args: |
+ raw_list: The raw test listing with the following format: |
+ |
+ IPCChannelTest. |
+ SendMessageInChannelConnected |
+ IPCSyncChannelTest. |
+ Simple |
+ DISABLED_SendWithTimeoutMixedOKAndTimeout |
+ |
+ Returns: |
+ A list of all tests. For the above raw listing: |
+ |
+ [IPCChannelTest.SendMessageInChannelConnected, IPCSyncChannelTest.Simple, |
+ IPCSyncChannelTest.DISABLED_SendWithTimeoutMixedOKAndTimeout] |
+ """ |
+ ret = [] |
+ current = '' |
+ for test in raw_list: |
+ if not test: |
+ continue |
+ if test[0] != ' ': |
+ test_case = test.split()[0] |
+ if test_case.endswith('.'): |
+ current = test_case |
+ elif not 'YOU HAVE' in test: |
+ test_name = test.split()[0] |
+ ret += [current + test_name] |
+ return ret |
+ |
+ |
class GtestTestInstance(test_instance.TestInstance): |
- def __init__(self, options, isolate_delegate): |
+ def __init__(self, args, isolate_delegate, error_func): |
super(GtestTestInstance, self).__init__() |
- self._apk_path = os.path.join( |
- constants.GetOutDirectory(), '%s_apk' % options.suite_name, |
- '%s-debug.apk' % options.suite_name) |
+ self._suite = args.suite_name[0] |
+ |
+ if self._suite == 'content_browsertests': |
+ error_func('content_browsertests are not currently supported ' |
+ 'in platform mode.') |
+ self._apk_path = os.path.join( |
+ constants.GetOutDirectory(), 'apks', '%s.apk' % self._suite) |
+ else: |
+ self._apk_path = os.path.join( |
+ constants.GetOutDirectory(), '%s_apk' % self._suite, |
+ '%s-debug.apk' % self._suite) |
+ self._exe_path = os.path.join(constants.GetOutDirectory(), |
+ self._suite) |
+ if not os.path.exists(self._apk_path): |
+ self._apk_path = None |
+ if not os.path.exists(self._exe_path): |
+ self._exe_path = None |
+ if not self._apk_path and not self._exe_path: |
+ error_func('Could not find apk or executable for %s' % self._suite) |
+ |
self._data_deps = [] |
- self._gtest_filter = options.test_filter |
- if options.isolate_file_path: |
- self._isolate_abs_path = os.path.abspath(options.isolate_file_path) |
+ self._gtest_filter = args.test_filter |
+ if args.isolate_file_path: |
+ self._isolate_abs_path = os.path.abspath(args.isolate_file_path) |
self._isolate_delegate = isolate_delegate |
self._isolated_abs_path = os.path.join( |
- constants.GetOutDirectory(), '%s.isolated' % options.suite_name) |
+ constants.GetOutDirectory(), '%s.isolated' % self._suite) |
else: |
logging.warning('No isolate file provided. No data deps will be pushed.'); |
self._isolate_delegate = None |
- self._suite = options.suite_name |
#override |
def TestType(self): |
@@ -69,7 +120,11 @@ class GtestTestInstance(test_instance.TestInstance): |
self._isolate_abs_path, self._isolated_abs_path) |
self._isolate_delegate.PurgeExcluded(_DEPS_EXCLUSION_LIST) |
self._isolate_delegate.MoveOutputDeps() |
- self._data_deps.extend([(constants.ISOLATE_DEPS_DIR, None)]) |
+ dest_dir = None |
+ if self._suite == 'breakpad_unittests': |
klundberg
2014/12/11 03:45:38
Anything we can do to avoid this special case in t
jbudorick
2014/12/11 17:43:24
Agreed, it is annoying. At a glance, though, it ap
|
+ dest_dir = '/data/local/tmp/' |
+ self._data_deps.extend([(constants.ISOLATE_DEPS_DIR, dest_dir)]) |
+ |
def GetDataDependencies(self): |
"""Returns the test suite's data dependencies. |
@@ -97,10 +152,8 @@ class GtestTestInstance(test_instance.TestInstance): |
filtered_test_list = test_list |
for gtest_filter_string in gtest_filter_strings: |
- logging.info('gtest filter string: %s' % gtest_filter_string) |
filtered_test_list = unittest_util.FilterTestNames( |
filtered_test_list, gtest_filter_string) |
- logging.info('final list of tests: %s' % (str(filtered_test_list))) |
return filtered_test_list |
def _GenerateDisabledFilterString(self, disabled_prefixes): |
@@ -109,6 +162,7 @@ class GtestTestInstance(test_instance.TestInstance): |
if disabled_prefixes is None: |
disabled_prefixes = ['DISABLED_', 'FLAKY_', 'FAILS_', 'PRE_', 'MANUAL_'] |
disabled_filter_items += ['%s*' % dp for dp in disabled_prefixes] |
+ disabled_filter_items += ['*.%s*' % dp for dp in disabled_prefixes] |
disabled_tests_file_path = os.path.join( |
constants.DIR_SOURCE_ROOT, 'build', 'android', 'pylib', 'gtest', |
@@ -132,6 +186,10 @@ class GtestTestInstance(test_instance.TestInstance): |
return self._apk_path |
@property |
+ def exe(self): |
+ return self._exe_path |
+ |
+ @property |
def suite(self): |
return self._suite |