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

Side by Side Diff: master/skia_master_scripts/commands.py

Issue 648353002: Remove Skia's forked buildbot code (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Address comment Created 6 years, 2 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
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 """Set of utilities to add commands to a buildbot factory.
6
7 This is based on commands.py and adds skia-specific commands.
8
9 TODO(borenet): Do we need this file at all? Can't we just do everything
10 in factory.py? (See https://codereview.chromium.org/248053003/ )
11 """
12
13
14 from buildbot.process.properties import WithProperties
15 from master.factory import commands
16 import skia_build_step
17
18
19 class SkiaCommands(commands.FactoryCommands):
20
21 def __init__(self, factory, configuration, workdir, target_arch,
22 default_timeout, target_platform, environment_variables):
23 """Instantiates subclass of FactoryCommands appropriate for Skia.
24
25 factory: a BaseFactory
26 configuration: 'Debug' or 'Release'
27 workdir: string indicating path within slave directory
28 target_arch: string such as 'x64'
29 default_timeout: default timeout for each command, in seconds
30 target_platform: a string such as skia_factory.TARGET_PLATFORM_LINUX,
31 to be passed into FactoryCommands.__init__()
32 environment_variables: dictionary of environment variables that should
33 be passed to all commands
34 """
35 commands.FactoryCommands.__init__(
36 self, factory=factory, target=configuration,
37 build_dir='', target_platform=target_platform)
38 # Store some parameters that the subclass may want to use later.
39 self.default_timeout = default_timeout
40 self.environment_variables = environment_variables
41 self.factory = factory
42 self.target_arch = target_arch
43 self.workdir = workdir
44 # TODO(epoger): It would be better for this path to be specified by
45 # an environment variable or some such, so that it is not dependent on the
46 # path from CWD to slave/skia_slave_scripts... but for now, this will do.
47 self._local_slave_script_dir = self.PathJoin(
48 '..', '..', '..', '..', '..', '..', 'slave', 'skia_slave_scripts')
49
50 # TODO(borenet): Can kwargs be used to simplify this function declaration?
51 def AddSlaveScript(self, script, args, description, timeout=None,
52 halt_on_failure=False, is_upload_step=False,
53 is_rebaseline_step=False, get_props_from_stdout=None,
54 workdir=None, do_step_if=None,
55 always_run=False, flunk_on_failure=True,
56 exception_on_failure=False):
57 """Run a slave-side Python script as its own build step."""
58 if workdir:
59 path_to_script = script
60 use_workdir = workdir
61 else:
62 path_to_script = self.PathJoin(self._local_slave_script_dir, script)
63 use_workdir = self.workdir
64 self.AddRunCommand(command=['python', path_to_script] + args,
65 description=description, timeout=timeout,
66 halt_on_failure=halt_on_failure,
67 is_upload_step=is_upload_step,
68 is_rebaseline_step=is_rebaseline_step,
69 get_props_from_stdout=get_props_from_stdout,
70 workdir=use_workdir,
71 do_step_if=do_step_if,
72 always_run=always_run,
73 flunk_on_failure=flunk_on_failure,
74 exception_on_failure=exception_on_failure)
75
76 # TODO(borenet): Can kwargs be used to simplify this function declaration?
77 def AddRunCommand(self, command, description='Run', timeout=None,
78 halt_on_failure=False, is_upload_step=False,
79 is_rebaseline_step=False, get_props_from_stdout=None,
80 workdir=None, do_step_if=None, always_run=False,
81 flunk_on_failure=True, exception_on_failure=False):
82 """Runs an arbitrary command, perhaps a binary we built."""
83 if description not in self.factory.dontskipsteps:
84 if description in self.factory.skipsteps:
85 return
86
87 # If a developer has marked the step as dontskip, make sure it will run.
88 if description in self.factory.dontskipsteps:
89 do_step_if = True
90
91 if not timeout:
92 timeout = self.default_timeout
93 self.factory.addStep(skia_build_step.SkiaBuildStep,
94 is_upload_step=is_upload_step,
95 is_rebaseline_step=is_rebaseline_step,
96 get_props_from_stdout=get_props_from_stdout,
97 description=description, timeout=timeout,
98 command=command, workdir=workdir or self.workdir,
99 env=self.environment_variables,
100 haltOnFailure=halt_on_failure,
101 doStepIf=do_step_if or skia_build_step.ShouldDoStep,
102 alwaysRun=always_run,
103 flunkOnFailure=flunk_on_failure,
104 exception_on_failure=exception_on_failure,
105 hideStepIf=lambda s: s.isSkipped())
106
107 # TODO(borenet): Can kwargs be used to simplify this function declaration?
108 def AddRunCommandList(self, command_list, description='Run', timeout=None,
109 halt_on_failure=False, is_upload_step=False,
110 is_rebaseline_step=False):
111 """Runs a list of arbitrary commands."""
112 # TODO(epoger): Change this so that build-step output shows each command
113 # in the list separately--that will be a lot easier to follow.
114 #
115 # TODO(epoger): For now, this wraps the total command with WithProperties()
116 # because *some* callers need it, and we can't use the string.join() command
117 # to concatenate strings that have already been wrapped with
118 # WithProperties(). Once I figure out how to make the build-step output
119 # show each command separately, maybe I can remove this wrapper.
120 self.AddRunCommand(command=WithProperties(' && '.join(command_list)),
121 description=description, timeout=timeout,
122 halt_on_failure=halt_on_failure,
123 is_upload_step=is_upload_step,
124 is_rebaseline_step=is_rebaseline_step)
OLDNEW
« no previous file with comments | « master/skia_master_scripts/chromeos_factory.py ('k') | master/skia_master_scripts/drt_canary_factory.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698