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

Side by Side Diff: trunk/src/build/android/pylib/gtest/test_package_executable.py

Issue 18732002: Revert 210035 "Creates a new test running script test_runner.py" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
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."""
6 5
7 import logging 6 import logging
8 import os 7 import os
9 import shutil 8 import shutil
10 import sys 9 import sys
11 import tempfile 10 import tempfile
12 11
13 from pylib import cmd_helper 12 from pylib import cmd_helper
14 from pylib import constants 13 from pylib import constants
15 from pylib import pexpect 14 from pylib import pexpect
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 82
84 def GetAllTests(self): 83 def GetAllTests(self):
85 """Returns a list of all tests available in the test suite.""" 84 """Returns a list of all tests available in the test suite."""
86 all_tests = self.adb.RunShellCommand( 85 all_tests = self.adb.RunShellCommand(
87 '%s %s/%s --gtest_list_tests' % 86 '%s %s/%s --gtest_list_tests' %
88 (self.tool.GetTestWrapper(), 87 (self.tool.GetTestWrapper(),
89 constants.TEST_EXECUTABLE_DIR, 88 constants.TEST_EXECUTABLE_DIR,
90 self.test_suite_basename)) 89 self.test_suite_basename))
91 return self._ParseGTestListTests(all_tests) 90 return self._ParseGTestListTests(all_tests)
92 91
93 def CreateTestRunnerScript(self, test_filter, test_arguments): 92 def CreateTestRunnerScript(self, gtest_filter, test_arguments):
94 """Creates a test runner script and pushes to the device. 93 """Creates a test runner script and pushes to the device.
95 94
96 Args: 95 Args:
97 test_filter: A test_filter flag. 96 gtest_filter: A gtest_filter flag.
98 test_arguments: Additional arguments to pass to the test binary. 97 test_arguments: Additional arguments to pass to the test binary.
99 """ 98 """
100 tool_wrapper = self.tool.GetTestWrapper() 99 tool_wrapper = self.tool.GetTestWrapper()
101 sh_script_file = tempfile.NamedTemporaryFile() 100 sh_script_file = tempfile.NamedTemporaryFile()
102 # We need to capture the exit status from the script since adb shell won't 101 # We need to capture the exit status from the script since adb shell won't
103 # propagate to us. 102 # propagate to us.
104 sh_script_file.write('cd %s\n' 103 sh_script_file.write('cd %s\n'
105 '%s' 104 '%s'
106 '%s %s/%s --gtest_filter=%s %s\n' 105 '%s %s/%s --gtest_filter=%s %s\n'
107 'echo $? > %s' % 106 'echo $? > %s' %
108 (constants.TEST_EXECUTABLE_DIR, 107 (constants.TEST_EXECUTABLE_DIR,
109 self._AddNativeCoverageExports(), 108 self._AddNativeCoverageExports(),
110 tool_wrapper, constants.TEST_EXECUTABLE_DIR, 109 tool_wrapper, constants.TEST_EXECUTABLE_DIR,
111 self.test_suite_basename, 110 self.test_suite_basename,
112 test_filter, test_arguments, 111 gtest_filter, test_arguments,
113 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE)) 112 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE))
114 sh_script_file.flush() 113 sh_script_file.flush()
115 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) 114 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name])
116 self.adb.PushIfNeeded( 115 self.adb.PushIfNeeded(
117 sh_script_file.name, 116 sh_script_file.name,
118 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh') 117 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh')
119 logging.info('Conents of the test runner script: ') 118 logging.info('Conents of the test runner script: ')
120 for line in open(sh_script_file.name).readlines(): 119 for line in open(sh_script_file.name).readlines():
121 logging.info(' ' + line.rstrip()) 120 logging.info(' ' + line.rstrip())
122 121
123 def RunTestsAndListResults(self): 122 def RunTestsAndListResults(self):
124 """Runs all the tests and checks for failures. 123 """Runs all the tests and checks for failures.
125 124
126 Returns: 125 Returns:
127 A TestRunResults object. 126 A TestRunResults object.
128 """ 127 """
(...skipping 29 matching lines...) Expand all
158 os.makedirs(self.symbols_dir) 157 os.makedirs(self.symbols_dir)
159 shutil.copy(self.test_suite, self.symbols_dir) 158 shutil.copy(self.test_suite, self.symbols_dir)
160 strip = os.environ['STRIP'] 159 strip = os.environ['STRIP']
161 cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name]) 160 cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name])
162 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.test_suite_basename 161 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.test_suite_basename
163 self.adb.PushIfNeeded(target_name, test_binary) 162 self.adb.PushIfNeeded(target_name, test_binary)
164 163
165 def _GetTestSuiteBaseName(self): 164 def _GetTestSuiteBaseName(self):
166 """Returns the base name of the test suite.""" 165 """Returns the base name of the test suite."""
167 return os.path.basename(self.test_suite) 166 return os.path.basename(self.test_suite)
OLDNEW
« no previous file with comments | « trunk/src/build/android/pylib/gtest/test_package_apk.py ('k') | trunk/src/build/android/pylib/host_driven/run_python_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698