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 posixpath | |
9 import sys | 10 import sys |
10 import tempfile | 11 import tempfile |
11 | 12 |
12 from pylib import cmd_helper | 13 from pylib import cmd_helper |
13 from pylib import constants | 14 from pylib import constants |
14 from pylib import pexpect | 15 from pylib import pexpect |
15 from pylib.device import device_errors | 16 from pylib.device import device_errors |
16 from pylib.gtest import gtest_test_instance | 17 from pylib.gtest import gtest_test_instance |
17 from pylib.gtest.test_package import TestPackage | 18 from pylib.gtest.test_package import TestPackage |
18 | 19 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) | 113 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) |
113 device.PushChangedFiles([( | 114 device.PushChangedFiles([( |
114 sh_script_file.name, | 115 sh_script_file.name, |
115 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh')]) | 116 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh')]) |
116 logging.info('Conents of the test runner script: ') | 117 logging.info('Conents of the test runner script: ') |
117 for line in open(sh_script_file.name).readlines(): | 118 for line in open(sh_script_file.name).readlines(): |
118 logging.info(' ' + line.rstrip()) | 119 logging.info(' ' + line.rstrip()) |
119 | 120 |
120 #override | 121 #override |
121 def GetAllTests(self, device): | 122 def GetAllTests(self, device): |
122 cmd = '%s %s/%s --gtest_list_tests' % (self.tool.GetTestWrapper(), | |
123 constants.TEST_EXECUTABLE_DIR, self.suite_name) | |
124 lib_path = '%s/%s_deps' % (constants.TEST_EXECUTABLE_DIR, self.suite_name) | 123 lib_path = '%s/%s_deps' % (constants.TEST_EXECUTABLE_DIR, self.suite_name) |
perezju
2015/03/30 16:01:17
nit: maybe should also use posixpath.join?
jbudorick
2015/03/30 16:42:14
Done.
| |
125 (exit_code, output) = device.old_interface.GetAndroidToolStatusAndOutput( | 124 output = device.RunShellCommand( |
126 cmd, lib_path=lib_path) | 125 [device.GetDevicePieWrapper(), self.tool.GetTestWrapper(), |
perezju
2015/03/30 16:01:16
only pass wrappers if needed.
jbudorick
2015/03/30 16:42:14
Done.
| |
127 if exit_code != 0: | 126 posixpath.join(constants.TEST_EXECUTABLE_DIR, self.suite_name), |
128 raise Exception( | 127 '--gtest_list_tests'], |
129 'Failed to start binary:\n%s' % '\n'.join(output)) | 128 check_return=True, |
129 env={'LD_LIBRARY_PATH': lib_path}) | |
130 return gtest_test_instance.ParseGTestListTests(output) | 130 return gtest_test_instance.ParseGTestListTests(output) |
131 | 131 |
132 #override | 132 #override |
133 def SpawnTestProcess(self, device): | 133 def SpawnTestProcess(self, device): |
134 args = ['adb', '-s', str(device), 'shell', 'sh', | 134 args = ['adb', '-s', str(device), 'shell', 'sh', |
135 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh'] | 135 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh'] |
136 logging.info(args) | 136 logging.info(args) |
137 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) | 137 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) |
138 | 138 |
139 #override | 139 #override |
(...skipping 13 matching lines...) Expand all Loading... | |
153 'stripped binary (%s, timestamp %d) older than ' | 153 'stripped binary (%s, timestamp %d) older than ' |
154 'source binary (%s, timestamp %d), build target %s' % | 154 'source binary (%s, timestamp %d), build target %s' % |
155 (target_name, target_mtime, self.suite_path, source_mtime, | 155 (target_name, target_mtime, self.suite_path, source_mtime, |
156 self.suite_name + '_stripped')) | 156 self.suite_name + '_stripped')) |
157 | 157 |
158 test_binary_path = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 158 test_binary_path = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
159 device.PushChangedFiles([(target_name, test_binary_path)]) | 159 device.PushChangedFiles([(target_name, test_binary_path)]) |
160 deps_path = self.suite_path + '_deps' | 160 deps_path = self.suite_path + '_deps' |
161 if os.path.isdir(deps_path): | 161 if os.path.isdir(deps_path): |
162 device.PushChangedFiles([(deps_path, test_binary_path + '_deps')]) | 162 device.PushChangedFiles([(deps_path, test_binary_path + '_deps')]) |
OLD | NEW |