OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 pexpect | 8 import pexpect |
9 import shutil | 9 import shutil |
10 import sys | 10 import sys |
(...skipping 25 matching lines...) Expand all Loading... |
36 dump_debug_info: A debug_info object. | 36 dump_debug_info: A debug_info object. |
37 symbols_dir: Directory to put the stripped binaries. | 37 symbols_dir: Directory to put the stripped binaries. |
38 """ | 38 """ |
39 TestPackage.__init__(self, adb, device, test_suite, timeout, | 39 TestPackage.__init__(self, adb, device, test_suite, timeout, |
40 rebaseline, performance_test, cleanup_test_files, | 40 rebaseline, performance_test, cleanup_test_files, |
41 tool, dump_debug_info) | 41 tool, dump_debug_info) |
42 self.symbols_dir = symbols_dir | 42 self.symbols_dir = symbols_dir |
43 | 43 |
44 def _GetGTestReturnCode(self): | 44 def _GetGTestReturnCode(self): |
45 ret = None | 45 ret = None |
| 46 ret_code = 1 # Assume failure if we can't find it |
46 ret_code_file = tempfile.NamedTemporaryFile() | 47 ret_code_file = tempfile.NamedTemporaryFile() |
47 try: | 48 try: |
48 if not self.adb.Adb().Pull( | 49 if not self.adb.Adb().Pull( |
49 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE, ret_code_file.name): | 50 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE, ret_code_file.name): |
50 logging.critical('Unable to pull gtest ret val file %s', | 51 logging.critical('Unable to pull gtest ret val file %s', |
51 ret_code_file.name) | 52 ret_code_file.name) |
52 raise ValueError | 53 raise ValueError |
53 ret_code = file(ret_code_file.name).read() | 54 ret_code = file(ret_code_file.name).read() |
54 ret = int(ret_code) | 55 ret = int(ret_code) |
55 except ValueError: | 56 except ValueError: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 '%s /data/local/%s --gtest_filter=%s %s\n' | 99 '%s /data/local/%s --gtest_filter=%s %s\n' |
99 'echo $? > %s' % | 100 'echo $? > %s' % |
100 (self._AddNativeCoverageExports(), | 101 (self._AddNativeCoverageExports(), |
101 tool_wrapper, self.test_suite_basename, | 102 tool_wrapper, self.test_suite_basename, |
102 gtest_filter, test_arguments, | 103 gtest_filter, test_arguments, |
103 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE)) | 104 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE)) |
104 sh_script_file.flush() | 105 sh_script_file.flush() |
105 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) | 106 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) |
106 self.adb.PushIfNeeded(sh_script_file.name, | 107 self.adb.PushIfNeeded(sh_script_file.name, |
107 '/data/local/chrome_test_runner.sh') | 108 '/data/local/chrome_test_runner.sh') |
| 109 logging.info('Conents of the test runner script: ') |
| 110 for line in open(sh_script_file.name).readlines(): |
| 111 logging.info(' ' + line.rstrip()) |
108 | 112 |
109 def RunTestsAndListResults(self): | 113 def RunTestsAndListResults(self): |
110 """Runs all the tests and checks for failures. | 114 """Runs all the tests and checks for failures. |
111 | 115 |
112 Returns: | 116 Returns: |
113 A TestResults object. | 117 A TestResults object. |
114 """ | 118 """ |
115 args = ['adb', '-s', self.device, 'shell', 'sh', | 119 args = ['adb', '-s', self.device, 'shell', 'sh', |
116 '/data/local/chrome_test_runner.sh'] | 120 '/data/local/chrome_test_runner.sh'] |
117 logging.info(args) | 121 logging.info(args) |
(...skipping 25 matching lines...) Expand all Loading... |
143 # Whenever we generate a stripped binary, copy to the symbols dir. If we | 147 # Whenever we generate a stripped binary, copy to the symbols dir. If we |
144 # aren't stripping a new binary, assume it's there. | 148 # aren't stripping a new binary, assume it's there. |
145 if self.symbols_dir: | 149 if self.symbols_dir: |
146 if not os.path.exists(self.symbols_dir): | 150 if not os.path.exists(self.symbols_dir): |
147 os.makedirs(self.symbols_dir) | 151 os.makedirs(self.symbols_dir) |
148 shutil.copy(self.test_suite, self.symbols_dir) | 152 shutil.copy(self.test_suite, self.symbols_dir) |
149 strip = os.environ['STRIP'] | 153 strip = os.environ['STRIP'] |
150 cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name]) | 154 cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name]) |
151 test_binary = '/data/local/' + self.test_suite_basename | 155 test_binary = '/data/local/' + self.test_suite_basename |
152 self.adb.PushIfNeeded(target_name, test_binary) | 156 self.adb.PushIfNeeded(target_name, test_binary) |
OLD | NEW |