Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: build/android/pylib/gtest/test_package_exe.py

Issue 1050883002: [Android] Reland cleanup of old_interface in build/android/pylib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/gtest/test_options.py ('k') | build/android/pylib/gtest/test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 lib_path = posixpath.join(
123 constants.TEST_EXECUTABLE_DIR, self.suite_name) 124 constants.TEST_EXECUTABLE_DIR, '%s_deps' % self.suite_name)
124 lib_path = '%s/%s_deps' % (constants.TEST_EXECUTABLE_DIR, self.suite_name) 125
125 (exit_code, output) = device.old_interface.GetAndroidToolStatusAndOutput( 126 cmd = []
126 cmd, lib_path=lib_path) 127 for wrapper in (device.GetDevicePieWrapper(), self.tool.GetTestWrapper()):
127 if exit_code != 0: 128 if wrapper:
128 raise Exception( 129 cmd.append(wrapper)
129 'Failed to start binary:\n%s' % '\n'.join(output)) 130 cmd.extend([
131 posixpath.join(constants.TEST_EXECUTABLE_DIR, self.suite_name),
132 '--gtest_list_tests'])
133
134 output = device.RunShellCommand(
135 cmd, check_return=True, env={'LD_LIBRARY_PATH': lib_path})
130 return gtest_test_instance.ParseGTestListTests(output) 136 return gtest_test_instance.ParseGTestListTests(output)
131 137
132 #override 138 #override
133 def SpawnTestProcess(self, device): 139 def SpawnTestProcess(self, device):
134 args = ['adb', '-s', str(device), 'shell', 'sh', 140 args = ['adb', '-s', str(device), 'shell', 'sh',
135 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh'] 141 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh']
136 logging.info(args) 142 logging.info(args)
137 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) 143 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout)
138 144
139 #override 145 #override
(...skipping 13 matching lines...) Expand all
153 'stripped binary (%s, timestamp %d) older than ' 159 'stripped binary (%s, timestamp %d) older than '
154 'source binary (%s, timestamp %d), build target %s' % 160 'source binary (%s, timestamp %d), build target %s' %
155 (target_name, target_mtime, self.suite_path, source_mtime, 161 (target_name, target_mtime, self.suite_path, source_mtime,
156 self.suite_name + '_stripped')) 162 self.suite_name + '_stripped'))
157 163
158 test_binary_path = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name 164 test_binary_path = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name
159 device.PushChangedFiles([(target_name, test_binary_path)]) 165 device.PushChangedFiles([(target_name, test_binary_path)])
160 deps_path = self.suite_path + '_deps' 166 deps_path = self.suite_path + '_deps'
161 if os.path.isdir(deps_path): 167 if os.path.isdir(deps_path):
162 device.PushChangedFiles([(deps_path, test_binary_path + '_deps')]) 168 device.PushChangedFiles([(deps_path, test_binary_path + '_deps')])
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_options.py ('k') | build/android/pylib/gtest/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698