OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Set of utilities to add commands to a buildbot factory. | 5 """Set of utilities to add commands to a buildbot factory. |
6 | 6 |
7 This is based on commands.py and adds skia-specific commands.""" | 7 This is based on commands.py and adds skia-specific commands.""" |
8 | 8 |
9 | 9 |
10 from buildbot.process.properties import WithProperties | 10 from buildbot.process.properties import WithProperties |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 ] | 60 ] |
61 self.AddSlaveScript(script=self.PathJoin('utils', 'merge_into_svn.py'), | 61 self.AddSlaveScript(script=self.PathJoin('utils', 'merge_into_svn.py'), |
62 args=args, description=description, timeout=timeout, | 62 args=args, description=description, timeout=timeout, |
63 is_upload_step=True, | 63 is_upload_step=True, |
64 is_rebaseline_step=is_rebaseline_step) | 64 is_rebaseline_step=is_rebaseline_step) |
65 | 65 |
66 def AddSlaveScript(self, script, args, description, timeout=None, | 66 def AddSlaveScript(self, script, args, description, timeout=None, |
67 halt_on_failure=False, is_upload_step=False, | 67 halt_on_failure=False, is_upload_step=False, |
68 is_rebaseline_step=False, get_props_from_stdout=None, | 68 is_rebaseline_step=False, get_props_from_stdout=None, |
69 workdir=None, do_step_if=None, | 69 workdir=None, do_step_if=None, |
70 always_run=False, flunk_on_failure=True): | 70 always_run=False, flunk_on_failure=True, |
| 71 exception_on_failure=False): |
71 """Run a slave-side Python script as its own build step.""" | 72 """Run a slave-side Python script as its own build step.""" |
72 if workdir: | 73 if workdir: |
73 path_to_script = script | 74 path_to_script = script |
74 use_workdir = workdir | 75 use_workdir = workdir |
75 else: | 76 else: |
76 path_to_script = self.PathJoin(self._local_slave_script_dir, script) | 77 path_to_script = self.PathJoin(self._local_slave_script_dir, script) |
77 use_workdir = self.workdir | 78 use_workdir = self.workdir |
78 self.AddRunCommand(command=['python', path_to_script] + args, | 79 self.AddRunCommand(command=['python', path_to_script] + args, |
79 description=description, timeout=timeout, | 80 description=description, timeout=timeout, |
80 halt_on_failure=halt_on_failure, | 81 halt_on_failure=halt_on_failure, |
81 is_upload_step=is_upload_step, | 82 is_upload_step=is_upload_step, |
82 is_rebaseline_step=is_rebaseline_step, | 83 is_rebaseline_step=is_rebaseline_step, |
83 get_props_from_stdout=get_props_from_stdout, | 84 get_props_from_stdout=get_props_from_stdout, |
84 workdir=use_workdir, | 85 workdir=use_workdir, |
85 do_step_if=do_step_if, | 86 do_step_if=do_step_if, |
86 always_run=always_run, | 87 always_run=always_run, |
87 flunk_on_failure=flunk_on_failure) | 88 flunk_on_failure=flunk_on_failure, |
| 89 exception_on_failure=exception_on_failure) |
88 | 90 |
89 def AddRunCommand(self, command, description='Run', timeout=None, | 91 def AddRunCommand(self, command, description='Run', timeout=None, |
90 halt_on_failure=False, is_upload_step=False, | 92 halt_on_failure=False, is_upload_step=False, |
91 is_rebaseline_step=False, get_props_from_stdout=None, | 93 is_rebaseline_step=False, get_props_from_stdout=None, |
92 workdir=None, do_step_if=None, always_run=False, | 94 workdir=None, do_step_if=None, always_run=False, |
93 flunk_on_failure=True): | 95 flunk_on_failure=True, exception_on_failure=False): |
94 """Runs an arbitrary command, perhaps a binary we built.""" | 96 """Runs an arbitrary command, perhaps a binary we built.""" |
95 if not timeout: | 97 if not timeout: |
96 timeout = self.default_timeout | 98 timeout = self.default_timeout |
97 self.factory.addStep(skia_build_step.SkiaBuildStep, | 99 self.factory.addStep(skia_build_step.SkiaBuildStep, |
98 is_upload_step=is_upload_step, | 100 is_upload_step=is_upload_step, |
99 is_rebaseline_step=is_rebaseline_step, | 101 is_rebaseline_step=is_rebaseline_step, |
100 get_props_from_stdout=get_props_from_stdout, | 102 get_props_from_stdout=get_props_from_stdout, |
101 description=description, timeout=timeout, | 103 description=description, timeout=timeout, |
102 command=command, workdir=workdir or self.workdir, | 104 command=command, workdir=workdir or self.workdir, |
103 env=self.environment_variables, | 105 env=self.environment_variables, |
104 haltOnFailure=halt_on_failure, | 106 haltOnFailure=halt_on_failure, |
105 doStepIf=do_step_if or skia_build_step.ShouldDoStep, | 107 doStepIf=do_step_if or skia_build_step.ShouldDoStep, |
106 alwaysRun=always_run, | 108 alwaysRun=always_run, |
107 flunkOnFailure=flunk_on_failure, | 109 flunkOnFailure=flunk_on_failure, |
| 110 exception_on_failure=exception_on_failure, |
108 hideStepIf=lambda s: s.isSkipped()) | 111 hideStepIf=lambda s: s.isSkipped()) |
109 | 112 |
110 def AddRunCommandList(self, command_list, description='Run', timeout=None, | 113 def AddRunCommandList(self, command_list, description='Run', timeout=None, |
111 halt_on_failure=False, is_upload_step=False, | 114 halt_on_failure=False, is_upload_step=False, |
112 is_rebaseline_step=False): | 115 is_rebaseline_step=False): |
113 """Runs a list of arbitrary commands.""" | 116 """Runs a list of arbitrary commands.""" |
114 # TODO(epoger): Change this so that build-step output shows each command | 117 # TODO(epoger): Change this so that build-step output shows each command |
115 # in the list separately--that will be a lot easier to follow. | 118 # in the list separately--that will be a lot easier to follow. |
116 # | 119 # |
117 # TODO(epoger): For now, this wraps the total command with WithProperties() | 120 # TODO(epoger): For now, this wraps the total command with WithProperties() |
118 # because *some* callers need it, and we can't use the string.join() command | 121 # because *some* callers need it, and we can't use the string.join() command |
119 # to concatenate strings that have already been wrapped with | 122 # to concatenate strings that have already been wrapped with |
120 # WithProperties(). Once I figure out how to make the build-step output | 123 # WithProperties(). Once I figure out how to make the build-step output |
121 # show each command separately, maybe I can remove this wrapper. | 124 # show each command separately, maybe I can remove this wrapper. |
122 self.AddRunCommand(command=WithProperties(' && '.join(command_list)), | 125 self.AddRunCommand(command=WithProperties(' && '.join(command_list)), |
123 description=description, timeout=timeout, | 126 description=description, timeout=timeout, |
124 halt_on_failure=halt_on_failure, | 127 halt_on_failure=halt_on_failure, |
125 is_upload_step=is_upload_step, | 128 is_upload_step=is_upload_step, |
126 is_rebaseline_step=is_rebaseline_step) | 129 is_rebaseline_step=is_rebaseline_step) |
OLD | NEW |