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

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

Issue 11557016: Clean up Android gtest runners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed docstring Created 8 years 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 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
11 11
12 import cmd_helper 12 import cmd_helper
13 import constants 13 import constants
14 from test_package import TestPackage 14 from test_package import TestPackage
15 from pylib import pexpect 15 from pylib import pexpect
16 16
17 17
18 class TestPackageExecutable(TestPackage): 18 class TestPackageExecutable(TestPackage):
19 """A helper class for running stand-alone executables.""" 19 """A helper class for running stand-alone executables."""
20 20
21 _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval' 21 _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval'
22 22
23 def __init__(self, adb, device, test_suite, timeout, rebaseline, 23 def __init__(self, adb, device, test_suite, timeout,
24 performance_test, cleanup_test_files, tool, dump_debug_info, 24 performance_test, cleanup_test_files, tool, dump_debug_info,
25 symbols_dir=None): 25 symbols_dir=None):
26 """ 26 """
27 Args: 27 Args:
28 adb: ADB interface the tests are using. 28 adb: ADB interface the tests are using.
29 device: Device to run the tests. 29 device: Device to run the tests.
30 test_suite: A specific test suite to run, empty to run all. 30 test_suite: A specific test suite to run, empty to run all.
31 timeout: Timeout for each test. 31 timeout: Timeout for each test.
32 rebaseline: Whether or not to run tests in isolation and update the
33 filter.
34 performance_test: Whether or not performance test(s). 32 performance_test: Whether or not performance test(s).
35 cleanup_test_files: Whether or not to cleanup test files on device. 33 cleanup_test_files: Whether or not to cleanup test files on device.
36 tool: Name of the Valgrind tool. 34 tool: Name of the Valgrind tool.
37 dump_debug_info: A debug_info object. 35 dump_debug_info: A debug_info object.
38 symbols_dir: Directory to put the stripped binaries. 36 symbols_dir: Directory to put the stripped binaries.
39 """ 37 """
40 TestPackage.__init__(self, adb, device, test_suite, timeout, 38 TestPackage.__init__(self, adb, device, test_suite, timeout,
41 rebaseline, performance_test, cleanup_test_files, 39 performance_test, cleanup_test_files,
42 tool, dump_debug_info) 40 tool, dump_debug_info)
43 self.symbols_dir = symbols_dir 41 self.symbols_dir = symbols_dir
44 42
45 def _GetGTestReturnCode(self): 43 def _GetGTestReturnCode(self):
46 ret = None 44 ret = None
47 ret_code = 1 # Assume failure if we can't find it 45 ret_code = 1 # Assume failure if we can't find it
48 ret_code_file = tempfile.NamedTemporaryFile() 46 ret_code_file = tempfile.NamedTemporaryFile()
49 try: 47 try:
50 if not self.adb.Adb().Pull( 48 if not self.adb.Adb().Pull(
51 constants.TEST_EXECUTABLE_DIR + '/' + 49 constants.TEST_EXECUTABLE_DIR + '/' +
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 os.makedirs(self.symbols_dir) 156 os.makedirs(self.symbols_dir)
159 shutil.copy(self.test_suite, self.symbols_dir) 157 shutil.copy(self.test_suite, self.symbols_dir)
160 strip = os.environ['STRIP'] 158 strip = os.environ['STRIP']
161 cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name]) 159 cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name])
162 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.test_suite_basename 160 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.test_suite_basename
163 self.adb.PushIfNeeded(target_name, test_binary) 161 self.adb.PushIfNeeded(target_name, test_binary)
164 162
165 def _GetTestSuiteBaseName(self): 163 def _GetTestSuiteBaseName(self):
166 """Returns the base name of the test suite.""" 164 """Returns the base name of the test suite."""
167 return os.path.basename(self.test_suite) 165 return os.path.basename(self.test_suite)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698