OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Defines TestPackageExecutable to help run stand-alone executables.""" | 5 """Defines TestPackageExecutable to help run stand-alone executables.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
11 | 11 |
12 from pylib import cmd_helper | 12 from pylib import cmd_helper |
13 from pylib import constants | 13 from pylib import constants |
14 from pylib import pexpect | 14 from pylib import pexpect |
15 from pylib.gtest.test_package import TestPackage | 15 |
| 16 from test_package import TestPackage |
16 | 17 |
17 | 18 |
18 class TestPackageExecutable(TestPackage): | 19 class TestPackageExecutable(TestPackage): |
19 """A helper class for running stand-alone executables.""" | 20 """A helper class for running stand-alone executables.""" |
20 | 21 |
21 _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval' | 22 _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval' |
22 | 23 |
23 def __init__(self, suite_name): | 24 def __init__(self, suite_name): |
24 """ | 25 """ |
25 Args: | 26 Args: |
(...skipping 18 matching lines...) Expand all Loading... |
44 ret_code_file.name) | 45 ret_code_file.name) |
45 raise ValueError | 46 raise ValueError |
46 ret_code = file(ret_code_file.name).read() | 47 ret_code = file(ret_code_file.name).read() |
47 ret = int(ret_code) | 48 ret = int(ret_code) |
48 except ValueError: | 49 except ValueError: |
49 logging.critical('Error reading gtest ret val file %s [%s]', | 50 logging.critical('Error reading gtest ret val file %s [%s]', |
50 ret_code_file.name, ret_code) | 51 ret_code_file.name, ret_code) |
51 ret = 1 | 52 ret = 1 |
52 return ret | 53 return ret |
53 | 54 |
54 @staticmethod | 55 def _AddNativeCoverageExports(self, adb): |
55 def _AddNativeCoverageExports(adb): | |
56 # export GCOV_PREFIX set the path for native coverage results | 56 # export GCOV_PREFIX set the path for native coverage results |
57 # export GCOV_PREFIX_STRIP indicates how many initial directory | 57 # export GCOV_PREFIX_STRIP indicates how many initial directory |
58 # names to strip off the hardwired absolute paths. | 58 # names to strip off the hardwired absolute paths. |
59 # This value is calculated in buildbot.sh and | 59 # This value is calculated in buildbot.sh and |
60 # depends on where the tree is built. | 60 # depends on where the tree is built. |
61 # Ex: /usr/local/google/code/chrome will become | 61 # Ex: /usr/local/google/code/chrome will become |
62 # /code/chrome if GCOV_PREFIX_STRIP=3 | 62 # /code/chrome if GCOV_PREFIX_STRIP=3 |
63 try: | 63 try: |
64 depth = os.environ['NATIVE_COVERAGE_DEPTH_STRIP'] | 64 depth = os.environ['NATIVE_COVERAGE_DEPTH_STRIP'] |
65 except KeyError: | 65 except KeyError: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if target_mtime < source_mtime: | 132 if target_mtime < source_mtime: |
133 logging.critical( | 133 logging.critical( |
134 'stripped binary (%s, timestamp %d) older than ' | 134 'stripped binary (%s, timestamp %d) older than ' |
135 'source binary (%s, timestamp %d), build target %s', | 135 'source binary (%s, timestamp %d), build target %s', |
136 target_name, target_mtime, self.suite_path, source_mtime, | 136 target_name, target_mtime, self.suite_path, source_mtime, |
137 self.suite_name + '_stripped') | 137 self.suite_name + '_stripped') |
138 sys.exit(1) | 138 sys.exit(1) |
139 | 139 |
140 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 140 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
141 adb.PushIfNeeded(target_name, test_binary) | 141 adb.PushIfNeeded(target_name, test_binary) |
OLD | NEW |