summaryrefslogtreecommitdiffstats
path: root/testing/chromoting/browser_tests_launcher.py
diff options
context:
space:
mode:
authoranandc <anandc@chromium.org>2015-02-02 00:27:15 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-02 08:28:11 +0000
commitbb6be9722e652bed1225f260a2efdbd81fb883a4 (patch)
tree912ced6c13ad735be8fc89918f9281b4dbfbbe1b /testing/chromoting/browser_tests_launcher.py
parent1dde806cef3bab34266a27e648458821df41988d (diff)
downloadchromium_src-bb6be9722e652bed1225f260a2efdbd81fb883a4.zip
chromium_src-bb6be9722e652bed1225f260a2efdbd81fb883a4.tar.gz
chromium_src-bb6be9722e652bed1225f260a2efdbd81fb883a4.tar.bz2
Don't exit on first test failure; run all specified tests, even if any fail.
BUG= Review URL: https://codereview.chromium.org/874393008 Cr-Commit-Position: refs/heads/master@{#314112}
Diffstat (limited to 'testing/chromoting/browser_tests_launcher.py')
-rw-r--r--testing/chromoting/browser_tests_launcher.py39
1 files changed, 18 insertions, 21 deletions
diff --git a/testing/chromoting/browser_tests_launcher.py b/testing/chromoting/browser_tests_launcher.py
index 0cb903b..a265f56 100644
--- a/testing/chromoting/browser_tests_launcher.py
+++ b/testing/chromoting/browser_tests_launcher.py
@@ -20,24 +20,16 @@ SUCCESS_INDICATOR = 'SUCCESS: all tests passed.'
NATIVE_MESSAGING_DIR = 'NativeMessagingHosts'
CRD_ID = 'chrome-remote-desktop' # Used in a few file/folder names
CHROMOTING_HOST_PATH = '/opt/google/chrome-remote-desktop/chrome-remote-desktop'
+TEST_FAILURE = False
def LaunchBTCommand(command):
- results, error = RunCommandInSubProcess(command)
+ global TEST_FAILURE
+ results = RunCommandInSubProcess(command)
# Check that the test passed.
if SUCCESS_INDICATOR not in results:
- # Obtain contents of Chromoting host logs.
- log_contents = ''
- # There should be only 1 log file, as we delete logs on test completion.
- # Loop through matching files, just in case there are more.
- for log_file in glob.glob('/tmp/chrome_remote_desktop_*'):
- with open(log_file, 'r') as log:
- log_contents += '\nHOST LOG %s CONTENTS:\n%s' % (log_file, log.read())
- print log_contents
- raise Exception(
- 'Test failed. Command:%s\nResults:%s\nError:%s\n' %
- (command, results, error))
+ TEST_FAILURE = True
def RunCommandInSubProcess(command):
@@ -47,7 +39,6 @@ def RunCommandInSubProcess(command):
command: The text of command to be executed.
Returns:
results: stdout contents of executing the command.
- error: stderr contents.
"""
cmd_line = [command]
@@ -59,7 +50,7 @@ def RunCommandInSubProcess(command):
(e, command, error))
else:
print results
- return results, error
+ return results
def TestCleanUp(user_profile_dir):
@@ -88,12 +79,6 @@ def InitialiseTestMachineForLinux(cfg_file):
$HOME/.config/chrome-remote-desktop
Its name is expected to have a hash that is specific to a machine.
- TODO(anandc):
- Once we have Linux machines in the swarming lab already installed with the
- me2me host, this function should also perform the step of starting the host.
- That is gated on this CL: https://chromereviews.googleplex.com/123957013/, and
- then having base images in the chrome-labs be updated with it.
-
Args:
cfg_file: location of test account's host-config file.
"""
@@ -119,7 +104,7 @@ def InitialiseTestMachineForLinux(cfg_file):
def SetupUserProfileDir(me2me_manifest_file, it2me_manifest_file,
user_profile_dir):
- """Sets up the Google Chrome user profile directory
+ """Sets up the Google Chrome user profile directory.
Delete the previous user profile directory if exists and create a new one.
This invalidates any state changes by the previous test so each test can start
@@ -179,6 +164,18 @@ def main():
line = line.replace(PROD_DIR_ID, args.prod_dir)
LaunchBTCommand(line)
+ # Was there any test failure?
+ if TEST_FAILURE:
+ # Obtain contents of Chromoting host logs.
+ log_contents = ''
+ # There should be only 1 log file, as we delete logs on test completion.
+ # Loop through matching files, just in case there are more.
+ for log_file in glob.glob('/tmp/chrome_remote_desktop_*'):
+ with open(log_file, 'r') as log:
+ log_contents += '\nHOST LOG %s\n CONTENTS:\n%s' % (log_file, log.read())
+ print log_contents
+ raise Exception('At least one test failed.')
+
# Now, stop host, and cleanup user-profile-dir
TestCleanUp(args.user_profile_dir)