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

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

Issue 15942016: Creates a new test running script test_runner.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
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 5
6 import logging 6 import logging
7 import os 7 import os
8 import shutil 8 import shutil
9 import sys 9 import sys
10 import tempfile 10 import tempfile
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 def GetAllTests(self): 83 def GetAllTests(self):
84 """Returns a list of all tests available in the test suite.""" 84 """Returns a list of all tests available in the test suite."""
85 all_tests = self.adb.RunShellCommand( 85 all_tests = self.adb.RunShellCommand(
86 '%s %s/%s --gtest_list_tests' % 86 '%s %s/%s --gtest_list_tests' %
87 (self.tool.GetTestWrapper(), 87 (self.tool.GetTestWrapper(),
88 constants.TEST_EXECUTABLE_DIR, 88 constants.TEST_EXECUTABLE_DIR,
89 self.test_suite_basename)) 89 self.test_suite_basename))
90 return self._ParseGTestListTests(all_tests) 90 return self._ParseGTestListTests(all_tests)
91 91
92 def CreateTestRunnerScript(self, gtest_filter, test_arguments): 92 def CreateTestRunnerScript(self, test_filter, test_arguments):
93 """Creates a test runner script and pushes to the device. 93 """Creates a test runner script and pushes to the device.
94 94
95 Args: 95 Args:
96 gtest_filter: A gtest_filter flag. 96 test_filter: A test_filter flag.
97 test_arguments: Additional arguments to pass to the test binary. 97 test_arguments: Additional arguments to pass to the test binary.
98 """ 98 """
99 tool_wrapper = self.tool.GetTestWrapper() 99 tool_wrapper = self.tool.GetTestWrapper()
100 sh_script_file = tempfile.NamedTemporaryFile() 100 sh_script_file = tempfile.NamedTemporaryFile()
101 # 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
102 # propagate to us. 102 # propagate to us.
103 sh_script_file.write('cd %s\n' 103 sh_script_file.write('cd %s\n'
104 '%s' 104 '%s'
105 '%s %s/%s --gtest_filter=%s %s\n' 105 '%s %s/%s --test_filter=%s %s\n'
frankf 2013/06/11 02:50:15 Same here.
gkanwar 2013/06/12 01:27:32 Done.
106 'echo $? > %s' % 106 'echo $? > %s' %
107 (constants.TEST_EXECUTABLE_DIR, 107 (constants.TEST_EXECUTABLE_DIR,
108 self._AddNativeCoverageExports(), 108 self._AddNativeCoverageExports(),
109 tool_wrapper, constants.TEST_EXECUTABLE_DIR, 109 tool_wrapper, constants.TEST_EXECUTABLE_DIR,
110 self.test_suite_basename, 110 self.test_suite_basename,
111 gtest_filter, test_arguments, 111 test_filter, test_arguments,
112 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE)) 112 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE))
113 sh_script_file.flush() 113 sh_script_file.flush()
114 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) 114 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name])
115 self.adb.PushIfNeeded( 115 self.adb.PushIfNeeded(
116 sh_script_file.name, 116 sh_script_file.name,
117 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh') 117 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh')
118 logging.info('Conents of the test runner script: ') 118 logging.info('Conents of the test runner script: ')
119 for line in open(sh_script_file.name).readlines(): 119 for line in open(sh_script_file.name).readlines():
120 logging.info(' ' + line.rstrip()) 120 logging.info(' ' + line.rstrip())
121 121
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 os.makedirs(self.symbols_dir) 157 os.makedirs(self.symbols_dir)
158 shutil.copy(self.test_suite, self.symbols_dir) 158 shutil.copy(self.test_suite, self.symbols_dir)
159 strip = os.environ['STRIP'] 159 strip = os.environ['STRIP']
160 cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name]) 160 cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name])
161 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.test_suite_basename 161 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.test_suite_basename
162 self.adb.PushIfNeeded(target_name, test_binary) 162 self.adb.PushIfNeeded(target_name, test_binary)
163 163
164 def _GetTestSuiteBaseName(self): 164 def _GetTestSuiteBaseName(self):
165 """Returns the base name of the test suite.""" 165 """Returns the base name of the test suite."""
166 return os.path.basename(self.test_suite) 166 return os.path.basename(self.test_suite)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698