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

Side by Side Diff: testing/chromoting/browser_tests_launcher.py

Issue 1718733002: Add a retry to Chromoting tests on Linux builders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update TODO to anandc from jamiewalch. Created 4 years, 10 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 | « no previous file | testing/chromoting/chromoting_test_driver_launcher.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2014 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 """Utility script to launch browser-tests on the Chromoting bot.""" 6 """Utility script to launch browser-tests on the Chromoting bot."""
7 import argparse 7 import argparse
8 import time 8 import time
9 9
10 from chromoting_test_utilities import CleanupUserProfileDir 10 from chromoting_test_utilities import CleanupUserProfileDir
11 from chromoting_test_utilities import GetJidFromHostLog 11 from chromoting_test_utilities import GetJidFromHostLog
12 from chromoting_test_utilities import GetJidListFromTestResults 12 from chromoting_test_utilities import GetJidListFromTestResults
13 from chromoting_test_utilities import InitialiseTestMachineForLinux 13 from chromoting_test_utilities import InitialiseTestMachineForLinux
14 from chromoting_test_utilities import MAX_RETRIES
14 from chromoting_test_utilities import PrintHostLogContents 15 from chromoting_test_utilities import PrintHostLogContents
15 from chromoting_test_utilities import PROD_DIR_ID 16 from chromoting_test_utilities import PROD_DIR_ID
16 from chromoting_test_utilities import RunCommandInSubProcess 17 from chromoting_test_utilities import RunCommandInSubProcess
17 from chromoting_test_utilities import TestCaseSetup 18 from chromoting_test_utilities import TestCaseSetup
18 from chromoting_test_utilities import TestMachineCleanup 19 from chromoting_test_utilities import TestMachineCleanup
19 20
20 SUCCESS_INDICATOR = 'SUCCESS: all tests passed.' 21 SUCCESS_INDICATOR = 'SUCCESS: all tests passed.'
21 TEST_FAILURE = False 22 TEST_FAILURE = False
22 FAILING_TESTS = '' 23 FAILING_TESTS = ''
23 BROWSER_NOT_STARTED_ERROR = ( 24 BROWSER_NOT_STARTED_ERROR = (
24 'Still waiting for the following processes to finish') 25 'Still waiting for the following processes to finish')
25 TIME_OUT_INDICATOR = '(TIMED OUT)' 26 TIME_OUT_INDICATOR = '(TIMED OUT)'
26 MAX_RETRIES = 1
27 27
28 28
29 def LaunchBTCommand(args, command): 29 def LaunchBTCommand(args, command):
30 """Launches the specified browser-test command. 30 """Launches the specified browser-test command.
31 31
32 Retry if the execution failed because a browser-instance was not launched or 32 Retry if the execution failed because a browser-instance was not launched or
33 because the JID used did not match the host-JID. 33 because the JID used did not match the host-JID.
34 Args: 34 Args:
35 args: Command line args, used for test-case startup tasks. 35 args: Command line args, used for test-case startup tasks.
36 command: Browser-test command line. 36 command: Browser-test command line.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 break 94 break
95 95
96 # Sometimes, during execution of browser-tests, a browser instance is 96 # Sometimes, during execution of browser-tests, a browser instance is
97 # not started and the test times out. See http://crbug/480025. 97 # not started and the test times out. See http://crbug/480025.
98 # To work around it, check if this execution failed owing to that 98 # To work around it, check if this execution failed owing to that
99 # problem and retry. 99 # problem and retry.
100 # There are 2 things to look for in the results: 100 # There are 2 things to look for in the results:
101 # A line saying "Still waiting for the following processes to finish", 101 # A line saying "Still waiting for the following processes to finish",
102 # and, because sometimes that line gets logged even if the test 102 # and, because sometimes that line gets logged even if the test
103 # eventually passes, we'll also look for "(TIMED OUT)", before retrying. 103 # eventually passes, we'll also look for "(TIMED OUT)", before retrying.
104 if not ( 104 if BROWSER_NOT_STARTED_ERROR in results and TIME_OUT_INDICATOR in results:
105 BROWSER_NOT_STARTED_ERROR in results and TIME_OUT_INDICATOR in results): 105 print 'Browser-instance not started (http://crbug/480025). Retrying.'
106 # Test failed for some other reason. Let's not retry. 106 else:
107 break 107 print 'Test failed for unknown reason. Retrying.'
108
108 retries += 1 109 retries += 1
109 110
110 # Check that the test passed. 111 # Check that the test passed.
111 if SUCCESS_INDICATOR not in results: 112 if SUCCESS_INDICATOR not in results:
112 TEST_FAILURE = True 113 TEST_FAILURE = True
113 # Add this command-line to list of tests that failed. 114 # Add this command-line to list of tests that failed.
114 FAILING_TESTS += command 115 FAILING_TESTS += command
115 116
116 return host_log_file_names 117 return host_log_file_names
117 118
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 try: 156 try:
156 host_logs = main(command_line_args) 157 host_logs = main(command_line_args)
157 if TEST_FAILURE: 158 if TEST_FAILURE:
158 print '++++++++++AT LEAST 1 TEST FAILED++++++++++' 159 print '++++++++++AT LEAST 1 TEST FAILED++++++++++'
159 print FAILING_TESTS.rstrip('\n') 160 print FAILING_TESTS.rstrip('\n')
160 print '++++++++++++++++++++++++++++++++++++++++++' 161 print '++++++++++++++++++++++++++++++++++++++++++'
161 raise Exception('At least one test failed.') 162 raise Exception('At least one test failed.')
162 finally: 163 finally:
163 # Stop host and cleanup user-profile-dir. 164 # Stop host and cleanup user-profile-dir.
164 TestMachineCleanup(command_line_args.user_profile_dir, host_logs) 165 TestMachineCleanup(command_line_args.user_profile_dir, host_logs)
OLDNEW
« no previous file with comments | « no previous file | testing/chromoting/chromoting_test_driver_launcher.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698