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

Side by Side Diff: build/android/pylib/browsertests/dispatch.py

Issue 19021003: Fixes dispatch files to return exit codes in several places (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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 | build/android/pylib/gtest/dispatch.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) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 """Dispatches content_browsertests.""" 5 """Dispatches content_browsertests."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import sys 9 import sys
10 10
11 from pylib import android_commands 11 from pylib import android_commands
12 from pylib import cmd_helper 12 from pylib import cmd_helper
13 from pylib import constants 13 from pylib import constants
14 from pylib import ports 14 from pylib import ports
15 from pylib.base import base_test_result
15 from pylib.base import shard 16 from pylib.base import shard
16 from pylib.gtest import dispatch as gtest_dispatch 17 from pylib.gtest import dispatch as gtest_dispatch
17 from pylib.gtest import test_runner 18 from pylib.gtest import test_runner
18 from pylib.utils import report_results 19 from pylib.utils import report_results
19 20
20 sys.path.insert(0, 21 sys.path.insert(0,
21 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib')) 22 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib'))
22 from common import unittest_util 23 from common import unittest_util
23 24
24 25
25 def Dispatch(options): 26 def Dispatch(options):
26 """Dispatches all content_browsertests. 27 """Dispatches all content_browsertests.
27 28
28 Args: 29 Args:
29 options: optparse.Options object containing command-line options 30 options: optparse.Options object containing command-line options
30 Returns: 31 Returns:
31 A tuple of (base_test_result.TestRunResults object, exit code). 32 A tuple of (base_test_result.TestRunResults object, exit code).
32 Raises: 33 Raises:
33 Exception: Failed to reset the test server port. 34 Exception: Failed to reset the test server port.
34 """ 35 """
35 36
36 attached_devices = [] 37 attached_devices = []
37 if options.test_device: 38 if options.test_device:
38 attached_devices = [options.test_device] 39 attached_devices = [options.test_device]
39 else: 40 else:
40 attached_devices = android_commands.GetAttachedDevices() 41 attached_devices = android_commands.GetAttachedDevices()
41 42
42 if not attached_devices: 43 if not attached_devices:
43 logging.critical('A device must be attached and online.') 44 logging.critical('A device must be attached and online.')
44 return 1 45 return (base_test_result.TestRunResults(), constants.ERROR_EXIT_CODE)
45 46
46 # Reset the test port allocation. It's important to do it before starting 47 # Reset the test port allocation. It's important to do it before starting
47 # to dispatch any tests. 48 # to dispatch any tests.
48 if not ports.ResetTestServerPortAllocation(): 49 if not ports.ResetTestServerPortAllocation():
49 raise Exception('Failed to reset test server port.') 50 raise Exception('Failed to reset test server port.')
50 51
51 test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(), 52 test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(),
52 options.build_type) 53 options.build_type)
53 options.test_suite = os.path.join(test_suite_dir, 54 options.test_suite = os.path.join(test_suite_dir,
54 'apks', 55 'apks',
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 fixture, case = test.split('.', 1) 107 fixture, case = test.split('.', 1)
107 if _StartsWith(fixture, case, 'PRE_'): 108 if _StartsWith(fixture, case, 'PRE_'):
108 return False 109 return False
109 if _StartsWith(fixture, case, 'MANUAL_'): 110 if _StartsWith(fixture, case, 'MANUAL_'):
110 return False 111 return False
111 return True 112 return True
112 113
113 114
114 def _StartsWith(a, b, prefix): 115 def _StartsWith(a, b, prefix):
115 return a.startswith(prefix) or b.startswith(prefix) 116 return a.startswith(prefix) or b.startswith(prefix)
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/gtest/dispatch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698