summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitpy/tool/steps
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/tool/steps')
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py21
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/build.py2
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py1
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/options.py1
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/preparechangelog.py5
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/runtests.py16
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py26
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/update.py3
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreview_unittest.py5
9 files changed, 47 insertions, 33 deletions
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py b/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py
index 9ceb2cb..5525ea0 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py
@@ -36,27 +36,23 @@ class AbstractStep(object):
def __init__(self, tool, options):
self._tool = tool
self._options = options
- self._port = None
+ # FIXME: This should use tool.port()
def _run_script(self, script_name, args=None, quiet=False, port=WebKitPort):
log("Running %s" % script_name)
command = [port.script_path(script_name)]
if args:
command.extend(args)
- # FIXME: This should use self.port()
self._tool.executive.run_and_throw_if_fail(command, quiet)
- # FIXME: The port should live on the tool.
- def port(self):
- if self._port:
- return self._port
- self._port = WebKitPort.port(self._options.port)
- return self._port
+ def _changed_files(self, state):
+ return self.cached_lookup(state, "changed_files")
_well_known_keys = {
- "diff": lambda self, state: self._tool.scm().create_patch(self._options.git_commit),
- "changelogs": lambda self, state: self._tool.checkout().modified_changelogs(self._options.git_commit),
"bug_title": lambda self, state: self._tool.bugs.fetch_bug(state["bug_id"]).title(),
+ "changed_files": lambda self, state: self._tool.scm().changed_files(self._options.git_commit),
+ "diff": lambda self, state: self._tool.scm().create_patch(self._options.git_commit, changed_files=self._changed_files(state)),
+ "changelogs": lambda self, state: self._tool.checkout().modified_changelogs(self._options.git_commit, changed_files=self._changed_files(state)),
}
def cached_lookup(self, state, key, promise=None):
@@ -67,6 +63,11 @@ class AbstractStep(object):
state[key] = promise(self, state)
return state[key]
+ def did_modify_checkout(self, state):
+ state["diff"] = None
+ state["changelogs"] = None
+ state["changed_files"] = None
+
@classmethod
def options(cls):
return [
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/build.py b/WebKitTools/Scripts/webkitpy/tool/steps/build.py
index 456db25..0990b8b 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/build.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/build.py
@@ -41,7 +41,7 @@ class Build(AbstractStep):
]
def build(self, build_style):
- self._tool.executive.run_and_throw_if_fail(self.port().build_webkit_command(build_style=build_style), self._options.quiet)
+ self._tool.executive.run_and_throw_if_fail(self._tool.port().build_webkit_command(build_style=build_style), self._options.quiet)
def run(self, state):
if not self._options.build:
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py b/WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py
index de9b4e4..4d9646f 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/editchangelog.py
@@ -35,3 +35,4 @@ class EditChangeLog(AbstractStep):
def run(self, state):
os.chdir(self._tool.scm().checkout_root)
self._tool.user.edit_changelog(self.cached_lookup(state, "changelogs"))
+ self.did_modify_checkout(state)
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/options.py b/WebKitTools/Scripts/webkitpy/tool/steps/options.py
index 3dc1963..835fdba 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/options.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/options.py
@@ -50,7 +50,6 @@ class Options(object):
obsolete_patches = make_option("--no-obsolete", action="store_false", dest="obsolete_patches", default=True, help="Do not obsolete old patches before posting this one.")
open_bug = make_option("--open-bug", action="store_true", dest="open_bug", default=False, help="Opens the associated bug in a browser.")
parent_command = make_option("--parent-command", action="store", dest="parent_command", default=None, help="(Internal) The command that spawned this instance.")
- port = make_option("--port", action="store", dest="port", default=None, help="Specify a port (e.g., mac, qt, gtk, ...).")
quiet = make_option("--quiet", action="store_true", dest="quiet", default=False, help="Produce less console output.")
request_commit = make_option("--request-commit", action="store_true", dest="request_commit", default=False, help="Mark the patch as needing auto-commit after review.")
review = make_option("--no-review", action="store_false", dest="review", default=True, help="Do not mark the patch for review.")
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/preparechangelog.py b/WebKitTools/Scripts/webkitpy/tool/steps/preparechangelog.py
index ce04024..099dfe3 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/preparechangelog.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/preparechangelog.py
@@ -39,7 +39,6 @@ class PrepareChangeLog(AbstractStep):
@classmethod
def options(cls):
return AbstractStep.options() + [
- Options.port,
Options.quiet,
Options.email,
Options.git_commit,
@@ -62,7 +61,7 @@ class PrepareChangeLog(AbstractStep):
self._ensure_bug_url(state)
return
os.chdir(self._tool.scm().checkout_root)
- args = [self.port().script_path("prepare-ChangeLog")]
+ args = [self._tool.port().script_path("prepare-ChangeLog")]
if state.get("bug_id"):
args.append("--bug=%s" % state["bug_id"])
if self._options.email:
@@ -75,4 +74,4 @@ class PrepareChangeLog(AbstractStep):
self._tool.executive.run_and_throw_if_fail(args, self._options.quiet)
except ScriptError, e:
error("Unable to prepare ChangeLogs.")
- state["diff"] = None # We've changed the diff
+ self.did_modify_checkout(state)
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/runtests.py b/WebKitTools/Scripts/webkitpy/tool/steps/runtests.py
index aff1fd9..dcbfc44 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/runtests.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/runtests.py
@@ -37,7 +37,6 @@ class RunTests(AbstractStep):
Options.test,
Options.non_interactive,
Options.quiet,
- Options.port,
]
def run(self, state):
@@ -46,14 +45,17 @@ class RunTests(AbstractStep):
# Run the scripting unit tests first because they're quickest.
log("Running Python unit tests")
- self._tool.executive.run_and_throw_if_fail(self.port().run_python_unittests_command())
+ self._tool.executive.run_and_throw_if_fail(self._tool.port().run_python_unittests_command())
log("Running Perl unit tests")
- self._tool.executive.run_and_throw_if_fail(self.port().run_perl_unittests_command())
- log("Running JavaScriptCore tests")
- self._tool.executive.run_and_throw_if_fail(self.port().run_javascriptcore_tests_command(), quiet=True)
+ self._tool.executive.run_and_throw_if_fail(self._tool.port().run_perl_unittests_command())
+
+ javascriptcore_tests_command = self._tool.port().run_javascriptcore_tests_command()
+ if javascriptcore_tests_command:
+ log("Running JavaScriptCore tests")
+ self._tool.executive.run_and_throw_if_fail(javascriptcore_tests_command, quiet=True)
log("Running run-webkit-tests")
- args = self.port().run_webkit_tests_command()
+ args = self._tool.port().run_webkit_tests_command()
if self._options.non_interactive:
args.append("--no-launch-safari")
args.append("--exit-after-n-failures=1")
@@ -61,7 +63,7 @@ class RunTests(AbstractStep):
# FIXME: Hack to work around https://bugs.webkit.org/show_bug.cgi?id=38912
# when running the commit-queue on a mac leopard machine since compositing
# does not work reliably on Leopard due to various graphics driver/system bugs.
- if self.port().name() == "Mac" and self.port().is_leopard():
+ if self._tool.port().name() == "Mac" and self._tool.port().is_leopard():
tests_to_ignore = []
tests_to_ignore.append("compositing")
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py b/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py
index 15f275a..7eb8e3a 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/steps_unittest.py
@@ -37,39 +37,49 @@ from webkitpy.tool.steps.promptforbugortitle import PromptForBugOrTitle
class StepsTest(unittest.TestCase):
+ def _step_options(self):
+ options = MockOptions()
+ options.non_interactive = True
+ options.port = 'MOCK port'
+ options.quiet = True
+ options.test = True
+ return options
+
def _run_step(self, step, tool=None, options=None, state=None):
if not tool:
tool = MockTool()
if not options:
- options = MockOptions()
+ options = self._step_options()
if not state:
state = {}
step(tool, options).run(state)
def test_update_step(self):
- options = MockOptions()
+ tool = MockTool()
+ options = self._step_options()
options.update = True
expected_stderr = "Updating working directory\n"
- OutputCapture().assert_outputs(self, self._run_step, [Update, options], expected_stderr=expected_stderr)
+ OutputCapture().assert_outputs(self, self._run_step, [Update, tool, options], expected_stderr=expected_stderr)
def test_prompt_for_bug_or_title_step(self):
tool = MockTool()
tool.user.prompt = lambda message: 42
self._run_step(PromptForBugOrTitle, tool=tool)
- def test_runtests_leopard_commit_queue_hack(self):
+ def test_runtests_leopard_commit_queue_hack_step(self):
expected_stderr = "Running Python unit tests\nRunning Perl unit tests\nRunning JavaScriptCore tests\nRunning run-webkit-tests\n"
OutputCapture().assert_outputs(self, self._run_step, [RunTests], expected_stderr=expected_stderr)
- def test_runtests_leopard_commit_queue_hack(self):
- mock_options = MockOptions()
- mock_options.non_interactive = True
+ def test_runtests_leopard_commit_queue_hack_command(self):
+ mock_options = self._step_options()
step = RunTests(MockTool(log_executive=True), mock_options)
# FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment.
mock_port = WebKitPort()
mock_port.name = lambda: "Mac"
mock_port.is_leopard = lambda: True
- step.port = lambda: mock_port
+ tool = MockTool(log_executive=True)
+ tool.port = lambda: mock_port
+ step = RunTests(tool, mock_options)
expected_stderr = """Running Python unit tests
MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/test-webkitpy']
Running Perl unit tests
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/update.py b/WebKitTools/Scripts/webkitpy/tool/steps/update.py
index 0f450f3..cd1d4d8 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/update.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/update.py
@@ -36,11 +36,10 @@ class Update(AbstractStep):
def options(cls):
return AbstractStep.options() + [
Options.update,
- Options.port,
]
def run(self, state):
if not self._options.update:
return
log("Updating working directory")
- self._tool.executive.run_and_throw_if_fail(self.port().update_webkit_command(), quiet=True)
+ self._tool.executive.run_and_throw_if_fail(self._tool.port().update_webkit_command(), quiet=True)
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreview_unittest.py b/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreview_unittest.py
index a037422..b475378 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreview_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/updatechangelogswithreview_unittest.py
@@ -41,5 +41,8 @@ class UpdateChangeLogsWithReviewerTest(unittest.TestCase):
def test_empty_state(self):
capture = OutputCapture()
- step = UpdateChangeLogsWithReviewer(MockTool(), MockOptions())
+ options = MockOptions()
+ options.reviewer = 'MOCK reviewer'
+ options.git_commit = 'MOCK git commit'
+ step = UpdateChangeLogsWithReviewer(MockTool(), options)
capture.assert_outputs(self, step.run, [{}])