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

Side by Side Diff: chrome/test/mini_installer/test_installer.py

Issue 24126005: Use CreateProcess instead of subprocess.Popen to launch Chrome in the mini_installer test framework. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use taskkill. Created 7 years, 3 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
« no previous file with comments | « chrome/test/mini_installer/launch_chrome.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """This script tests the installer with test cases specified in the config file. 5 """This script tests the installer with test cases specified in the config file.
6 6
7 For each test case, it checks that the machine states after the execution of 7 For each test case, it checks that the machine states after the execution of
8 each command match the expected machine states. For more details, take a look at 8 each command match the expected machine states. For more details, take a look at
9 the design documentation at http://goo.gl/Q0rGM6 9 the design documentation at http://goo.gl/Q0rGM6
10 """ 10 """
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 config: A Config object. 193 config: A Config object.
194 194
195 Returns: 195 Returns:
196 True if all the tests passed, or False otherwise. 196 True if all the tests passed, or False otherwise.
197 """ 197 """
198 suite = unittest.TestSuite() 198 suite = unittest.TestSuite()
199 path_resolver = PathResolver(mini_installer_path) 199 path_resolver = PathResolver(mini_installer_path)
200 for test in config.tests: 200 for test in config.tests:
201 suite.addTest(InstallerTest(test, config, path_resolver)) 201 suite.addTest(InstallerTest(test, config, path_resolver))
202 result = unittest.TextTestRunner(verbosity=2).run(suite) 202 result = unittest.TextTestRunner(verbosity=2).run(suite)
203
204 # We want to terminate all child processes that were spawned during the tests.
205 # One way to do this is to put them in a job object. However, Chrome also uses
206 # a job object and the ability to use nested jobs was only added in Windows 8.
207 # Work around this by using taskkill.
208 subprocess.call('taskkill /f /im chrome.exe', shell=True)
gab 2013/09/13 21:16:10 If the intention is to exit cleanly, would it make
209
203 return result.wasSuccessful() 210 return result.wasSuccessful()
204 211
205 212
206 def main(): 213 def main():
207 usage = 'usage: %prog [options] config_filename' 214 usage = 'usage: %prog [options] config_filename'
208 parser = optparse.OptionParser(usage, description='Test the installer.') 215 parser = optparse.OptionParser(usage, description='Test the installer.')
209 parser.add_option('--build-dir', default='out', 216 parser.add_option('--build-dir', default='out',
210 help='Path to main build directory (the parent of the ' 217 help='Path to main build directory (the parent of the '
211 'Release or Debug directory)') 218 'Release or Debug directory)')
212 parser.add_option('--target', default='Release', 219 parser.add_option('--target', default='Release',
213 help='Build target (Release or Debug)') 220 help='Build target (Release or Debug)')
214 options, args = parser.parse_args() 221 options, args = parser.parse_args()
215 if len(args) != 1: 222 if len(args) != 1:
216 parser.error('Incorrect number of arguments.') 223 parser.error('Incorrect number of arguments.')
217 config_filename = args[0] 224 config_filename = args[0]
218 225
219 mini_installer_path = os.path.join(options.build_dir, options.target, 226 mini_installer_path = os.path.join(options.build_dir, options.target,
220 'mini_installer.exe') 227 'mini_installer.exe')
221 assert os.path.exists(mini_installer_path), ('Could not find file %s' % 228 assert os.path.exists(mini_installer_path), ('Could not find file %s' %
222 mini_installer_path) 229 mini_installer_path)
223 config = ParseConfigFile(config_filename) 230 config = ParseConfigFile(config_filename)
224 if not RunTests(mini_installer_path, config): 231 if not RunTests(mini_installer_path, config):
225 return 1 232 return 1
226 return 0 233 return 0
227 234
228 235
229 if __name__ == '__main__': 236 if __name__ == '__main__':
230 sys.exit(main()) 237 sys.exit(main())
OLDNEW
« no previous file with comments | « chrome/test/mini_installer/launch_chrome.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698