OLD | NEW |
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 sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 '%s %s/%s --gtest_filter=%s %s\n' | 98 '%s %s/%s --gtest_filter=%s %s\n' |
99 'echo $? > %s' % | 99 'echo $? > %s' % |
100 (constants.TEST_EXECUTABLE_DIR, | 100 (constants.TEST_EXECUTABLE_DIR, |
101 self._AddNativeCoverageExports(device), | 101 self._AddNativeCoverageExports(device), |
102 tool_wrapper, constants.TEST_EXECUTABLE_DIR, | 102 tool_wrapper, constants.TEST_EXECUTABLE_DIR, |
103 self.suite_name, | 103 self.suite_name, |
104 test_filter, test_arguments, | 104 test_filter, test_arguments, |
105 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE)) | 105 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE)) |
106 sh_script_file.flush() | 106 sh_script_file.flush() |
107 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) | 107 cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name]) |
108 device.PushChangedFiles( | 108 device.PushChangedFiles([( |
109 sh_script_file.name, | 109 sh_script_file.name, |
110 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh') | 110 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh')]) |
111 logging.info('Conents of the test runner script: ') | 111 logging.info('Conents of the test runner script: ') |
112 for line in open(sh_script_file.name).readlines(): | 112 for line in open(sh_script_file.name).readlines(): |
113 logging.info(' ' + line.rstrip()) | 113 logging.info(' ' + line.rstrip()) |
114 | 114 |
115 #override | 115 #override |
116 def GetAllTests(self, device): | 116 def GetAllTests(self, device): |
117 all_tests = device.RunShellCommand( | 117 all_tests = device.RunShellCommand( |
118 '%s %s/%s --gtest_list_tests' % | 118 '%s %s/%s --gtest_list_tests' % |
119 (self.tool.GetTestWrapper(), | 119 (self.tool.GetTestWrapper(), |
120 constants.TEST_EXECUTABLE_DIR, | 120 constants.TEST_EXECUTABLE_DIR, |
(...skipping 20 matching lines...) Expand all Loading... |
141 target_mtime = os.stat(target_name).st_mtime | 141 target_mtime = os.stat(target_name).st_mtime |
142 source_mtime = os.stat(self.suite_path).st_mtime | 142 source_mtime = os.stat(self.suite_path).st_mtime |
143 if target_mtime < source_mtime: | 143 if target_mtime < source_mtime: |
144 raise Exception( | 144 raise Exception( |
145 'stripped binary (%s, timestamp %d) older than ' | 145 'stripped binary (%s, timestamp %d) older than ' |
146 'source binary (%s, timestamp %d), build target %s' % | 146 'source binary (%s, timestamp %d), build target %s' % |
147 (target_name, target_mtime, self.suite_path, source_mtime, | 147 (target_name, target_mtime, self.suite_path, source_mtime, |
148 self.suite_name + '_stripped')) | 148 self.suite_name + '_stripped')) |
149 | 149 |
150 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 150 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
151 device.PushChangedFiles(target_name, test_binary) | 151 device.PushChangedFiles([(target_name, test_binary)]) |
OLD | NEW |