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

Side by Side Diff: build/android/buildbot/bb_utils.py

Issue 18323020: Updates the test runner script exit codes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes Python dispatch issues in test_runner.py 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 | « build/android/buildbot/bb_host_steps.py ('k') | build/android/pylib/base/base_test_result.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 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 import json 5 import json
6 import optparse 6 import optparse
7 import os 7 import os
8 import pipes 8 import pipes
9 import subprocess 9 import subprocess
10 import sys 10 import sys
11 11
12 import bb_annotations
13
12 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) 14 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
13 from pylib import buildbot_report 15 from pylib import constants
14 16
15 17
16 TESTING = 'BUILDBOT_TESTING' in os.environ 18 TESTING = 'BUILDBOT_TESTING' in os.environ
17 19
18 BB_BUILD_DIR = os.path.abspath( 20 BB_BUILD_DIR = os.path.abspath(
19 os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, 21 os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
20 os.pardir, os.pardir, os.pardir, os.pardir)) 22 os.pardir, os.pardir, os.pardir, os.pardir))
21 23
22 CHROME_SRC = os.path.abspath( 24 CHROME_SRC = os.path.abspath(
23 os.path.join(os.path.dirname(__file__), '..', '..', '..')) 25 os.path.join(os.path.dirname(__file__), '..', '..', '..'))
(...skipping 12 matching lines...) Expand all
36 if TESTING: 38 if TESTING:
37 class MockPopen(object): 39 class MockPopen(object):
38 @staticmethod 40 @staticmethod
39 def wait(): 41 def wait():
40 return 0 42 return 0
41 return MockPopen() 43 return MockPopen()
42 return subprocess.Popen(command, cwd=CHROME_SRC, stdout=stdout) 44 return subprocess.Popen(command, cwd=CHROME_SRC, stdout=stdout)
43 45
44 46
45 def RunCmd(command, flunk_on_failure=True, halt_on_failure=False, 47 def RunCmd(command, flunk_on_failure=True, halt_on_failure=False,
46 warning_code=88, stdout=None): 48 warning_code=constants.WARNING_EXIT_CODE, stdout=None):
47 """Run a command relative to the chrome source root.""" 49 """Run a command relative to the chrome source root."""
48 code = SpawnCmd(command, stdout).wait() 50 code = SpawnCmd(command, stdout).wait()
49 print '<', CommandToString(command) 51 print '<', CommandToString(command)
50 if code != 0: 52 if code != 0:
51 print 'ERROR: process exited with code %d' % code 53 print 'ERROR: process exited with code %d' % code
52 if code != warning_code and flunk_on_failure: 54 if code != warning_code and flunk_on_failure:
53 buildbot_report.PrintError() 55 bb_annotations.PrintError()
54 else: 56 else:
55 buildbot_report.PrintWarning() 57 bb_annotations.PrintWarning()
56 # Allow steps to have both halting (i.e. 1) and non-halting exit codes. 58 # Allow steps to have both halting (i.e. 1) and non-halting exit codes.
57 if code != warning_code and halt_on_failure: 59 if code != warning_code and halt_on_failure:
58 print 'FATAL %d != %d' % (code, warning_code) 60 print 'FATAL %d != %d' % (code, warning_code)
59 sys.exit(1) 61 sys.exit(1)
60 return code 62 return code
61 63
62 64
63 def GetParser(): 65 def GetParser():
64 def ConvertJson(option, _, value, parser): 66 def ConvertJson(option, _, value, parser):
65 setattr(parser.values, option.dest, json.loads(value)) 67 setattr(parser.values, option.dest, json.loads(value))
(...skipping 14 matching lines...) Expand all
80 82
81 def RunSteps(steps, step_cmds, options): 83 def RunSteps(steps, step_cmds, options):
82 unknown_steps = set(steps) - set(step for step, _ in step_cmds) 84 unknown_steps = set(steps) - set(step for step, _ in step_cmds)
83 if unknown_steps: 85 if unknown_steps:
84 print >> sys.stderr, 'FATAL: Unknown steps %s' % list(unknown_steps) 86 print >> sys.stderr, 'FATAL: Unknown steps %s' % list(unknown_steps)
85 sys.exit(1) 87 sys.exit(1)
86 88
87 for step, cmd in step_cmds: 89 for step, cmd in step_cmds:
88 if step in steps: 90 if step in steps:
89 cmd(options) 91 cmd(options)
OLDNEW
« no previous file with comments | « build/android/buildbot/bb_host_steps.py ('k') | build/android/pylib/base/base_test_result.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698