| OLD | NEW |
| (Empty) |
| 1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 """Base script for doing test setup.""" | |
| 6 | |
| 7 import logging | |
| 8 import os | |
| 9 | |
| 10 from pylib import constants | |
| 11 from pylib import valgrind_tools | |
| 12 from pylib.constants import host_paths | |
| 13 from pylib.utils import isolator | |
| 14 | |
| 15 def GenerateDepsDirUsingIsolate(suite_name, isolate_file_path, | |
| 16 isolate_file_paths, deps_exclusion_list): | |
| 17 """Generate the dependency dir for the test suite using isolate. | |
| 18 | |
| 19 Args: | |
| 20 suite_name: Name of the test suite (e.g. base_unittests). | |
| 21 isolate_file_path: .isolate file path to use. If there is a default .isolate | |
| 22 file path for the suite_name, this will override it. | |
| 23 isolate_file_paths: Dictionary with the default .isolate file paths for | |
| 24 the test suites. | |
| 25 deps_exclusion_list: A list of files that are listed as dependencies in the | |
| 26 .isolate files but should not be pushed to the device. | |
| 27 Returns: | |
| 28 The Isolator instance used to remap the dependencies, or None. | |
| 29 """ | |
| 30 if isolate_file_path: | |
| 31 if os.path.isabs(isolate_file_path): | |
| 32 isolate_abs_path = isolate_file_path | |
| 33 else: | |
| 34 isolate_abs_path = os.path.join(host_paths.DIR_SOURCE_ROOT, | |
| 35 isolate_file_path) | |
| 36 else: | |
| 37 isolate_rel_path = isolate_file_paths.get(suite_name) | |
| 38 if not isolate_rel_path: | |
| 39 logging.info('Did not find an isolate file for the test suite.') | |
| 40 return | |
| 41 isolate_abs_path = os.path.join(host_paths.DIR_SOURCE_ROOT, | |
| 42 isolate_rel_path) | |
| 43 | |
| 44 isolated_abs_path = os.path.join( | |
| 45 constants.GetOutDirectory(), '%s.isolated' % suite_name) | |
| 46 assert os.path.exists(isolate_abs_path), 'Cannot find %s' % isolate_abs_path | |
| 47 | |
| 48 i = isolator.Isolator() | |
| 49 i.Clear() | |
| 50 i.Remap(isolate_abs_path, isolated_abs_path) | |
| 51 # We're relying on the fact that timestamps are preserved | |
| 52 # by the remap command (hardlinked). Otherwise, all the data | |
| 53 # will be pushed to the device once we move to using time diff | |
| 54 # instead of md5sum. Perform a sanity check here. | |
| 55 i.VerifyHardlinks() | |
| 56 i.PurgeExcluded(deps_exclusion_list) | |
| 57 i.MoveOutputDeps() | |
| 58 return i | |
| 59 | |
| 60 | |
| 61 def PushDataDeps(device, host_dir, device_dir, test_options): | |
| 62 valgrind_tools.PushFilesForTool(test_options.tool, device) | |
| 63 if os.path.exists(host_dir): | |
| 64 device.PushChangedFiles([(host_dir, device_dir)], | |
| 65 delete_device_stale=test_options.delete_stale_data) | |
| OLD | NEW |