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 shutil | 9 import shutil |
10 import sys | 10 import sys |
(...skipping 10 matching lines...) Expand all Loading... |
21 """A helper class for running stand-alone executables.""" | 21 """A helper class for running stand-alone executables.""" |
22 | 22 |
23 _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval' | 23 _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval' |
24 | 24 |
25 def __init__(self, suite_name): | 25 def __init__(self, suite_name): |
26 """ | 26 """ |
27 Args: | 27 Args: |
28 suite_name: Name of the test suite (e.g. base_unittests). | 28 suite_name: Name of the test suite (e.g. base_unittests). |
29 """ | 29 """ |
30 TestPackage.__init__(self, suite_name) | 30 TestPackage.__init__(self, suite_name) |
31 self.suite_path = os.path.join(constants.GetOutDirectory(), suite_name) | 31 product_dir = os.path.join(cmd_helper.OutDirectory.get(), |
32 self._symbols_dir = os.path.join(constants.GetOutDirectory(), | 32 constants.GetBuildType()) |
33 'lib.target') | 33 self.suite_path = os.path.join(product_dir, suite_name) |
| 34 self._symbols_dir = os.path.join(product_dir, 'lib.target') |
34 | 35 |
35 #override | 36 #override |
36 def GetGTestReturnCode(self, adb): | 37 def GetGTestReturnCode(self, adb): |
37 ret = None | 38 ret = None |
38 ret_code = 1 # Assume failure if we can't find it | 39 ret_code = 1 # Assume failure if we can't find it |
39 ret_code_file = tempfile.NamedTemporaryFile() | 40 ret_code_file = tempfile.NamedTemporaryFile() |
40 try: | 41 try: |
41 if not adb.Adb().Pull( | 42 if not adb.Adb().Pull( |
42 constants.TEST_EXECUTABLE_DIR + '/' + | 43 constants.TEST_EXECUTABLE_DIR + '/' + |
43 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE, | 44 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 'new one (%s).' % target_name) | 139 'new one (%s).' % target_name) |
139 # Whenever we generate a stripped binary, copy to the symbols dir. If we | 140 # Whenever we generate a stripped binary, copy to the symbols dir. If we |
140 # aren't stripping a new binary, assume it's there. | 141 # aren't stripping a new binary, assume it's there. |
141 if not os.path.exists(self._symbols_dir): | 142 if not os.path.exists(self._symbols_dir): |
142 os.makedirs(self._symbols_dir) | 143 os.makedirs(self._symbols_dir) |
143 shutil.copy(self.suite_path, self._symbols_dir) | 144 shutil.copy(self.suite_path, self._symbols_dir) |
144 strip = os.environ['STRIP'] | 145 strip = os.environ['STRIP'] |
145 cmd_helper.RunCmd([strip, self.suite_path, '-o', target_name]) | 146 cmd_helper.RunCmd([strip, self.suite_path, '-o', target_name]) |
146 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 147 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
147 adb.PushIfNeeded(target_name, test_binary) | 148 adb.PushIfNeeded(target_name, test_binary) |
OLD | NEW |