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 40de2d6f0116699647fa5815349e0501a76461f1..9cf76a277f4233fcbf546b9c54e0fad4e9597555 100644 |
--- a/build/android/pylib/gtest/gtest_test_instance.py |
+++ b/build/android/pylib/gtest/gtest_test_instance.py |
@@ -14,6 +14,7 @@ from pylib import constants |
from pylib.constants import host_paths |
from pylib.base import base_test_result |
from pylib.base import test_instance |
+from pylib.utils import isolator |
with host_paths.SysPath(host_paths.BUILD_COMMON_PATH): |
import unittest_util # pylint: disable=import-error |
@@ -229,7 +230,7 @@ def ConvertTestFilterFileIntoGTestFilterArgument(input_lines): |
class GtestTestInstance(test_instance.TestInstance): |
- def __init__(self, args, data_deps_delegate, error_func): |
+ def __init__(self, args, isolate_delegate, error_func): |
super(GtestTestInstance, self).__init__() |
# TODO(jbudorick): Support multiple test suites. |
if len(args.suite_name) > 1: |
@@ -286,10 +287,16 @@ class GtestTestInstance(test_instance.TestInstance): |
else: |
self._gtest_filter = None |
- self._data_deps_delegate = data_deps_delegate |
- self._runtime_deps_path = args.runtime_deps_path |
- if not self._runtime_deps_path: |
- logging.warning('No data dependencies will be pushed.') |
+ if (args.isolate_file_path and |
+ not isolator.IsIsolateEmpty(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' % self._suite) |
+ else: |
+ logging.warning('%s isolate file provided. No data deps will be pushed.', |
+ 'Empty' if args.isolate_file_path else 'No') |
+ self._isolate_delegate = None |
if args.app_data_files: |
self._app_data_files = args.app_data_files |
@@ -386,8 +393,15 @@ class GtestTestInstance(test_instance.TestInstance): |
#override |
def SetUp(self): |
"""Map data dependencies via isolate.""" |
- self._data_deps.extend( |
- self._data_deps_delegate(self._runtime_deps_path)) |
+ if self._isolate_delegate: |
+ self._isolate_delegate.Remap( |
+ self._isolate_abs_path, self._isolated_abs_path) |
+ self._isolate_delegate.PurgeExcluded(_DEPS_EXCLUSION_LIST) |
+ self._isolate_delegate.MoveOutputDeps() |
+ dest_dir = None |
+ self._data_deps.extend([ |
+ (self._isolate_delegate.isolate_deps_dir, dest_dir)]) |
+ |
def GetDataDependencies(self): |
"""Returns the test suite's data dependencies. |
@@ -441,6 +455,7 @@ class GtestTestInstance(test_instance.TestInstance): |
#override |
def TearDown(self): |
- """Do nothing.""" |
- pass |
+ """Clear the mappings created by SetUp.""" |
+ if self._isolate_delegate: |
+ self._isolate_delegate.Clear() |