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

Unified Diff: build/android/pylib/base/base_setup.py

Issue 689293002: Add option to push files to device using isolate for instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved shared functions into new base_setup module. Created 6 years, 1 month 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
Index: build/android/pylib/base/base_setup.py
diff --git a/build/android/pylib/base/base_setup.py b/build/android/pylib/base/base_setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..91efea6fb336e501ad929aa80f10a0cec1bd2bb2
--- /dev/null
+++ b/build/android/pylib/base/base_setup.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Base script for doing test setup."""
+
+import logging
+import os
+
+from pylib import constants
+from pylib import valgrind_tools
+
jbudorick 2014/11/03 15:52:32 nit: no blank line here
mikecase (-- gone --) 2014/11/03 19:20:04 Done.
+from pylib.utils import isolator
+
+def GenerateDepsDirUsingIsolate(suite_name, isolate_file_path,
jbudorick 2014/11/03 15:52:32 Either: - leave the params on the first line and
mikecase (-- gone --) 2014/11/03 19:20:04 Done.
+ isolate_file_paths, deps_exclusion_list):
+ """Generate the dependency dir for the test suite using isolate.
+
+ Args:
+ suite_name: Name of the test suite (e.g. base_unittests).
+ isolate_file_path: .isolate file path to use. If there is a default .isolate
+ file path for the suite_name, this will override it.
jbudorick 2014/11/03 15:52:32 nit: indent these consistently
mikecase (-- gone --) 2014/11/03 19:20:04 Done.
+ isolate_file_paths: Dictionary with the default .isolate file paths for
+ the test suites.
+ deps_exclusion_list: A list of files that are listed as dependencies in the
+ .isolate files but should not be pushed to the device.
+ """
+ if isolate_file_path:
+ if os.path.isabs(isolate_file_path):
+ isolate_abs_path = isolate_file_path
+ else:
+ isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT,
+ isolate_file_path)
+ else:
+ isolate_rel_path = isolate_file_paths.get(suite_name)
+ if not isolate_rel_path:
+ logging.info('Did not find an isolate file for the test suite.')
+ return
+ isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT, isolate_rel_path)
+
+ isolated_abs_path = os.path.join(
+ constants.GetOutDirectory(), '%s.isolated' % suite_name)
+ assert os.path.exists(isolate_abs_path), 'Cannot find %s' % isolate_abs_path
+
+ i = isolator.Isolator(constants.ISOLATE_DEPS_DIR)
+ i.Clear()
+ i.Remap(isolate_abs_path, isolated_abs_path)
+ # We're relying on the fact that timestamps are preserved
+ # by the remap command (hardlinked). Otherwise, all the data
+ # will be pushed to the device once we move to using time diff
+ # instead of md5sum. Perform a sanity check here.
+ i.VerifyHardlinks()
+ i.PurgeExcluded(deps_exclusion_list)
+ i.MoveOutputDeps()
+
+
+def PushDataDeps(device, device_dir, test_options):
+ valgrind_tools.PushFilesForTool(test_options.tool, device)
+ if os.path.exists(constants.ISOLATE_DEPS_DIR):
+ device.PushChangedFiles([
+ (os.path.join(constants.ISOLATE_DEPS_DIR, p),
+ '%s/%s' % (device_dir, p))
+ for p in os.listdir(constants.ISOLATE_DEPS_DIR)])

Powered by Google App Engine
This is Rietveld 408576698