OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2013 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 | |
jbudorick
2014/11/03 15:52:32
nit: no blank line here
mikecase (-- gone --)
2014/11/03 19:20:04
Done.
| |
13 from pylib.utils import isolator | |
14 | |
15 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.
| |
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. | |
jbudorick
2014/11/03 15:52:32
nit: indent these consistently
mikecase (-- gone --)
2014/11/03 19:20:04
Done.
| |
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 """ | |
28 if isolate_file_path: | |
29 if os.path.isabs(isolate_file_path): | |
30 isolate_abs_path = isolate_file_path | |
31 else: | |
32 isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT, | |
33 isolate_file_path) | |
34 else: | |
35 isolate_rel_path = isolate_file_paths.get(suite_name) | |
36 if not isolate_rel_path: | |
37 logging.info('Did not find an isolate file for the test suite.') | |
38 return | |
39 isolate_abs_path = os.path.join(constants.DIR_SOURCE_ROOT, isolate_rel_path) | |
40 | |
41 isolated_abs_path = os.path.join( | |
42 constants.GetOutDirectory(), '%s.isolated' % suite_name) | |
43 assert os.path.exists(isolate_abs_path), 'Cannot find %s' % isolate_abs_path | |
44 | |
45 i = isolator.Isolator(constants.ISOLATE_DEPS_DIR) | |
46 i.Clear() | |
47 i.Remap(isolate_abs_path, isolated_abs_path) | |
48 # We're relying on the fact that timestamps are preserved | |
49 # by the remap command (hardlinked). Otherwise, all the data | |
50 # will be pushed to the device once we move to using time diff | |
51 # instead of md5sum. Perform a sanity check here. | |
52 i.VerifyHardlinks() | |
53 i.PurgeExcluded(deps_exclusion_list) | |
54 i.MoveOutputDeps() | |
55 | |
56 | |
57 def PushDataDeps(device, device_dir, test_options): | |
58 valgrind_tools.PushFilesForTool(test_options.tool, device) | |
59 if os.path.exists(constants.ISOLATE_DEPS_DIR): | |
60 device.PushChangedFiles([ | |
61 (os.path.join(constants.ISOLATE_DEPS_DIR, p), | |
62 '%s/%s' % (device_dir, p)) | |
63 for p in os.listdir(constants.ISOLATE_DEPS_DIR)]) | |
OLD | NEW |