summaryrefslogtreecommitdiffstats
path: root/Tools/Scripts/webkitpy/common
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/webkitpy/common')
-rw-r--r--Tools/Scripts/webkitpy/common/checkout/changelog.py6
-rw-r--r--Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py9
-rw-r--r--Tools/Scripts/webkitpy/common/checkout/scm.py16
-rw-r--r--Tools/Scripts/webkitpy/common/checkout/scm_unittest.py10
-rw-r--r--Tools/Scripts/webkitpy/common/config/build.py6
-rw-r--r--Tools/Scripts/webkitpy/common/config/build_unittest.py4
-rw-r--r--Tools/Scripts/webkitpy/common/config/committers.py10
-rw-r--r--Tools/Scripts/webkitpy/common/net/bugzilla/bug.py1
-rw-r--r--Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py3
-rw-r--r--Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py7
-rw-r--r--Tools/Scripts/webkitpy/common/net/testoutput.py4
-rw-r--r--Tools/Scripts/webkitpy/common/net/testoutput_unittest.py11
-rw-r--r--Tools/Scripts/webkitpy/common/net/testoutputset_unittest.py7
-rw-r--r--Tools/Scripts/webkitpy/common/prettypatch_unittest.py13
-rw-r--r--Tools/Scripts/webkitpy/common/system/executive_mock.py8
-rw-r--r--Tools/Scripts/webkitpy/common/system/executive_unittest.py13
16 files changed, 95 insertions, 33 deletions
diff --git a/Tools/Scripts/webkitpy/common/checkout/changelog.py b/Tools/Scripts/webkitpy/common/checkout/changelog.py
index c81318c..ccdf9ca 100644
--- a/Tools/Scripts/webkitpy/common/checkout/changelog.py
+++ b/Tools/Scripts/webkitpy/common/checkout/changelog.py
@@ -43,6 +43,9 @@ class ChangeLogEntry(object):
# e.g. 2009-06-03 Eric Seidel <eric@webkit.org>
date_line_regexp = r'^(?P<date>\d{4}-\d{2}-\d{2})\s+(?P<name>.+?)\s+<(?P<email>[^<>]+)>$'
+ # e.g. == Rolled over to ChangeLog-2011-02-16 ==
+ rolled_over_regexp = r'^== Rolled over to ChangeLog-\d{4}-\d{2}-\d{2} ==$'
+
def __init__(self, contents, committer_list=CommitterList()):
self._contents = contents
self._committer_list = committer_list
@@ -101,6 +104,7 @@ class ChangeLog(object):
unicode strings. Use codecs.open or StringIO(unicode())
to pass file objects to this class."""
date_line_regexp = re.compile(ChangeLogEntry.date_line_regexp)
+ rolled_over_regexp = re.compile(ChangeLogEntry.rolled_over_regexp)
entry_lines = []
# The first line should be a date line.
first_line = changelog_file.readline()
@@ -111,7 +115,7 @@ class ChangeLog(object):
for line in changelog_file:
# If we've hit the next entry, return.
- if date_line_regexp.match(line):
+ if date_line_regexp.match(line) or rolled_over_regexp.match(line):
# Remove the extra newline at the end
return ChangeLogEntry(''.join(entry_lines[:-1]))
entry_lines.append(line)
diff --git a/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py b/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py
index 299d509..cef33d8 100644
--- a/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py
+++ b/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py
@@ -54,6 +54,8 @@ class ChangeLogTest(unittest.TestCase):
* DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj:
'''
+ _rolled_over_footer = '== Rolled over to ChangeLog-2009-06-16 =='
+
# More example text than we need. Eventually we need to support parsing this all and write tests for the parsing.
_example_changelog = u"""2009-08-17 Tor Arne Vestb\xf8 <vestbo@webkit.org>
@@ -99,6 +101,13 @@ class ChangeLogTest(unittest.TestCase):
self.assertEquals(latest_entry.reviewer_text(), u"Tor Arne Vestb\xf8")
self.assertTrue(latest_entry.reviewer()) # Make sure that our UTF8-based lookup of Tor works.
+ def test_latest_entry_parse_single_entry(self):
+ changelog_contents = u"%s\n%s" % (self._example_entry, self._rolled_over_footer)
+ changelog_file = StringIO(changelog_contents)
+ latest_entry = ChangeLog.parse_latest_entry_from_file(changelog_file)
+ self.assertEquals(latest_entry.contents(), self._example_entry)
+ self.assertEquals(latest_entry.author_name(), "Peter Kasting")
+
@staticmethod
def _write_tmp_file_with_contents(byte_array):
assert(isinstance(byte_array, str))
diff --git a/Tools/Scripts/webkitpy/common/checkout/scm.py b/Tools/Scripts/webkitpy/common/checkout/scm.py
index 3fa2db5..70f65b5 100644
--- a/Tools/Scripts/webkitpy/common/checkout/scm.py
+++ b/Tools/Scripts/webkitpy/common/checkout/scm.py
@@ -747,20 +747,12 @@ class Git(SCM):
return "git"
def prepend_svn_revision(self, diff):
- revision = None
- tries = 0
- while not revision and tries < 10:
- # If the git checkout is not tracking an SVN repo, then svn_revision_from_git_commit throws.
- try:
- revision = self.svn_revision_from_git_commit('HEAD~' + str(tries))
- except:
- return diff
- tries += 1
-
- if not revision:
+ git_log = self.run(['git', 'log', '-25'])
+ match = re.search("^\s*git-svn-id:.*@(?P<svn_revision>\d+)\ ", git_log, re.MULTILINE)
+ if not match:
return diff
- return "Subversion Revision: " + str(revision) + '\n' + diff
+ return "Subversion Revision: " + str(match.group('svn_revision')) + '\n' + diff
def create_patch(self, git_commit=None, changed_files=None):
"""Returns a byte array (str()) representing the patch file.
diff --git a/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py b/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py
index decfae0..79b354d 100644
--- a/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py
+++ b/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py
@@ -1138,6 +1138,16 @@ class GitSVNTest(SCMTest):
self.assertTrue(re.search(r'test_file_commit1', patch))
self.assertTrue(re.search(r'Subversion Revision: 5', patch))
+ def test_create_patch_after_merge(self):
+ run_command(['git', 'checkout', '-b', 'dummy-branch', 'trunk~3'])
+ self._one_local_commit()
+ run_command(['git', 'merge', 'trunk'])
+
+ scm = detect_scm_system(self.git_checkout_path)
+ patch = scm.create_patch()
+ self.assertTrue(re.search(r'test_file_commit1', patch))
+ self.assertTrue(re.search(r'Subversion Revision: 5', patch))
+
def test_create_patch_with_changed_files(self):
self._one_local_commit_plus_working_copy_changes()
scm = detect_scm_system(self.git_checkout_path)
diff --git a/Tools/Scripts/webkitpy/common/config/build.py b/Tools/Scripts/webkitpy/common/config/build.py
index 2b27c85..355fa96 100644
--- a/Tools/Scripts/webkitpy/common/config/build.py
+++ b/Tools/Scripts/webkitpy/common/config/build.py
@@ -83,10 +83,10 @@ def _should_file_trigger_build(target_platform, file):
]
patterns = [
# Patterns that shouldn't trigger builds on any bots.
+ (r"(?:^|/)ChangeLog.*$", []),
(r"(?:^|/)Makefile$", []),
(r"/ARM", []),
(r"/CMake.*", []),
- (r"/ChangeLog.*$", []),
(r"/LICENSE[^/]+$", []),
(r"ARM(?:v7)?\.(?:cpp|h)$", []),
(r"MIPS\.(?:cpp|h)$", []),
@@ -94,10 +94,10 @@ def _should_file_trigger_build(target_platform, file):
(r"\.(?:bkl|mk)$", []),
# Patterns that should trigger builds on only some bots.
- (r"/GNUmakefile\.am$", ["gtk"]),
+ (r"(?:^|/)GNUmakefile\.am$", ["gtk"]),
(r"/\w+Chromium\w*\.(?:cpp|h|mm)$", ["chromium"]),
(r"Mac\.(?:cpp|h|mm)$", ["mac"]),
- (r"\.exp$", ["mac"]),
+ (r"\.exp(?:\.in)?$", ["mac"]),
(r"\.gypi?", ["chromium"]),
(r"\.order$", ["mac"]),
(r"\.pr[io]$", ["qt"]),
diff --git a/Tools/Scripts/webkitpy/common/config/build_unittest.py b/Tools/Scripts/webkitpy/common/config/build_unittest.py
index e07d42f..1e075be 100644
--- a/Tools/Scripts/webkitpy/common/config/build_unittest.py
+++ b/Tools/Scripts/webkitpy/common/config/build_unittest.py
@@ -27,12 +27,15 @@ from webkitpy.common.config import build
class ShouldBuildTest(unittest.TestCase):
_should_build_tests = [
+ (["ChangeLog", "Source/WebCore/ChangeLog", "Source/WebKit2/ChangeLog-2011-02-11"], []),
+ (["GNUmakefile.am", "Source/WebCore/GNUmakefile.am"], ["gtk"]),
(["Websites/bugs.webkit.org/foo", "Source/WebCore/bar"], ["*"]),
(["Websites/bugs.webkit.org/foo"], []),
(["Source/JavaScriptCore/JavaScriptCore.xcodeproj/foo"], ["mac-leopard", "mac-snowleopard"]),
(["Source/JavaScriptGlue/foo", "Source/WebCore/bar"], ["*"]),
(["Source/JavaScriptGlue/foo"], ["mac-leopard", "mac-snowleopard"]),
(["LayoutTests/foo"], ["*"]),
+ (["LayoutTests/canvas/philip/tests/size.attributes.parse.exp-expected.txt", "LayoutTests/canvas/philip/tests/size.attributes.parse.exp.html"], ["*"]),
(["LayoutTests/platform/chromium-linux/foo"], ["chromium-linux"]),
(["LayoutTests/platform/chromium-win/fast/compact/001-expected.txt"], ["chromium-win"]),
(["LayoutTests/platform/mac-leopard/foo"], ["mac-leopard"]),
@@ -42,6 +45,7 @@ class ShouldBuildTest(unittest.TestCase):
(["LayoutTests/platform/win-xp/foo"], ["win"]),
(["LayoutTests/platform/win-wk2/foo"], ["win"]),
(["LayoutTests/platform/win/foo"], ["win"]),
+ (["Source/WebCore.exp.in", "Source/WebKit/mac/WebKit.exp"], ["mac"]),
(["Source/WebCore/mac/foo"], ["chromium-mac", "mac-leopard", "mac-snowleopard"]),
(["Source/WebCore/win/foo"], ["chromium-win", "win"]),
(["Source/WebCore/platform/graphics/gpu/foo"], ["mac-leopard", "mac-snowleopard"]),
diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py
index 5c571ab..76f4741 100644
--- a/Tools/Scripts/webkitpy/common/config/committers.py
+++ b/Tools/Scripts/webkitpy/common/config/committers.py
@@ -83,15 +83,15 @@ committers_unable_to_review = [
Committer("Balazs Kelemen", "kbalazs@webkit.org", "kbalazs"),
Committer("Ben Murdoch", "benm@google.com", "benm"),
Committer("Benjamin C Meyer", ["ben@meyerhome.net", "ben@webkit.org"], "icefox"),
+ Committer("Benjamin Kalman", ["kalman@chromium.org", "kalman@google.com"], "kalman"),
Committer("Benjamin Otte", ["otte@gnome.org", "otte@webkit.org"], "otte"),
- Committer("Benjamin Poulain", ["benjamin.poulain@nokia.com", "ikipou@gmail.com"]),
Committer("Brent Fulgham", "bfulgham@webkit.org", "bfulgham"),
Committer("Brett Wilson", "brettw@chromium.org", "brettx"),
Committer("Brian Weinstein", "bweinstein@apple.com", "bweinstein"),
Committer("Cameron McCormack", "cam@webkit.org", "heycam"),
Committer("Carlos Garcia Campos", ["cgarcia@igalia.com", "carlosgc@gnome.org", "carlosgc@webkit.org"], "KaL"),
Committer("Carol Szabo", "carol.szabo@nokia.com"),
- Committer("Chang Shu", ["Chang.Shu@nokia.com", "cshu@webkit.org"], "cshu"),
+ Committer("Chang Shu", ["cshu@webkit.org", "Chang.Shu@nokia.com"], "cshu"),
Committer("Chris Evans", "cevans@google.com"),
Committer("Chris Petersen", "cpetersen@apple.com", "cpetersen"),
Committer("Chris Rogers", "crogers@google.com", "crogers"),
@@ -104,6 +104,7 @@ committers_unable_to_review = [
Committer("Dirk Pranke", "dpranke@chromium.org", "dpranke"),
Committer("Drew Wilson", "atwilson@chromium.org", "atwilson"),
Committer("Eli Fidler", "eli@staikos.net", "QBin"),
+ Committer("Emil A Eklund", "eae@chromium.org", "eae"),
Committer("Enrica Casucci", "enrica@apple.com"),
Committer("Erik Arvidsson", "arv@chromium.org", "arv"),
Committer("Eric Roman", "eroman@chromium.org", "eroman"),
@@ -121,6 +122,7 @@ committers_unable_to_review = [
Committer("Gyuyoung Kim", ["gyuyoung.kim@samsung.com", "gyuyoung@gmail.com", "gyuyoung@webkit.org"], "gyuyoung"),
Committer("Hans Wennborg", "hans@chromium.org", "hwennborg"),
Committer("Hayato Ito", "hayato@chromium.org", "hayato"),
+ Committer("Helder Correia", "helder@sencha.com", "helder"),
Committer("Hin-Chung Lam", ["hclam@google.com", "hclam@chromium.org"]),
Committer("Ilya Tikhonovsky", "loislo@chromium.org", "loislo"),
Committer("Ivan Krsti\u0107", "ike@apple.com"),
@@ -129,6 +131,8 @@ committers_unable_to_review = [
Committer("James Hawkins", ["jhawkins@chromium.org", "jhawkins@google.com"], "jhawkins"),
Committer("James Simonsen", "simonjam@chromium.org", "simonjam"),
Committer("Jay Civelli", "jcivelli@chromium.org", "jcivelli"),
+ Committer("Jeff Miller", "jeffm@apple.com", "jeffm"),
+ Committer("Jenn Braithwaite", "jennb@chromium.org", "jennb"),
Committer("Jens Alfke", ["snej@chromium.org", "jens@apple.com"]),
Committer("Jer Noble", "jer.noble@apple.com", "jernoble"),
Committer("Jeremy Moskovich", ["playmobil@google.com", "jeremy@chromium.org"], "jeremymos"),
@@ -184,6 +188,7 @@ committers_unable_to_review = [
Committer("Pierre d'Herbemont", ["pdherbemont@free.fr", "pdherbemont@apple.com"], "pdherbemont"),
Committer("Pierre-Olivier Latour", "pol@apple.com", "pol"),
Committer("Pratik Solanki", "psolanki@apple.com", "psolanki"),
+ Committer("Qi Zhang", ["qi.2.zhang@nokia.com", "qi.zhang02180@gmail.com"], "qi"),
Committer("Renata Hodovan", "reni@webkit.org", "reni"),
Committer("Robert Hogan", ["robert@webkit.org", "robert@roberthogan.net", "lists@roberthogan.net"], "mwenge"),
Committer("Roland Steiner", "rolandsteiner@chromium.org"),
@@ -230,6 +235,7 @@ reviewers_list = [
Reviewer("Antonio Gomes", ["tonikitoo@webkit.org", "agomes@rim.com"], "tonikitoo"),
Reviewer("Antti Koivisto", ["koivisto@iki.fi", "antti@apple.com", "antti.j.koivisto@nokia.com"], "anttik"),
Reviewer("Ariya Hidayat", ["ariya.hidayat@gmail.com", "ariya@sencha.com", "ariya@webkit.org"], "ariya"),
+ Reviewer("Benjamin Poulain", ["benjamin@webkit.org", "benjamin.poulain@nokia.com", "ikipou@gmail.com"], "benjaminp"),
Reviewer("Beth Dakin", "bdakin@apple.com", "dethbakin"),
Reviewer("Brady Eidson", "beidson@apple.com", "bradee-oh"),
Reviewer("Cameron Zwarich", ["zwarich@apple.com", "cwzwarich@apple.com", "cwzwarich@webkit.org"]),
diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py
index af258eb..a751a7e 100644
--- a/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py
+++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py
@@ -44,6 +44,7 @@ class Bug(object):
return self.bug_dictionary["id"]
def title(self):
+ # FIXME: Do we need to HTML unescape the title?
return self.bug_dictionary["title"]
def reporter_email(self):
diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py
index 76cd31d..9dd165c 100644
--- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py
+++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py
@@ -268,8 +268,9 @@ class BuildBot(object):
"SnowLeopard.*Build",
"SnowLeopard.*\(Test",
"SnowLeopard.*\(WebKit2 Test",
- "Leopard",
+ "Leopard.*Release",
"Windows.*Build",
+ "WinCE",
"EFL",
"GTK.*32",
"GTK.*64.*Debug", # Disallow the 64-bit Release bot which is broken.
diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py
index f158827..6addb56 100644
--- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py
+++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py
@@ -240,7 +240,6 @@ class BuildBotTest(unittest.TestCase):
{'name': u'GTK Linux 64-bit Release', },
{'name': u'Qt Linux Release', },
{'name': u'Qt Linux Release minimal', },
- {'name': u'Qt Linux ARMv5 Release', },
{'name': u'Qt Linux ARMv7 Release', },
{'name': u'Qt Windows 32-bit Release', },
{'name': u'Qt Windows 32-bit Debug', },
@@ -256,8 +255,9 @@ class BuildBotTest(unittest.TestCase):
"SnowLeopard.*Build",
"SnowLeopard.*\(Test",
"SnowLeopard.*\(WebKit2 Test",
- "Leopard",
+ "Leopard.*Release",
"Windows.*Build",
+ "WinCE",
"EFL",
"GTK.*32",
"GTK.*64.*Debug", # Disallow the 64-bit Release bot which is broken.
@@ -267,8 +267,6 @@ class BuildBotTest(unittest.TestCase):
expected_builders = [
{'name': u'Leopard Intel Release (Build)', },
{'name': u'Leopard Intel Release (Tests)', },
- {'name': u'Leopard Intel Debug (Build)', },
- {'name': u'Leopard Intel Debug (Tests)', },
{'name': u'SnowLeopard Intel Release (Build)', },
{'name': u'SnowLeopard Intel Release (Tests)', },
{'name': u'SnowLeopard Intel Release (WebKit2 Tests)', },
@@ -279,7 +277,6 @@ class BuildBotTest(unittest.TestCase):
{'name': u'GTK Linux 64-bit Debug', },
{'name': u'Qt Linux Release', },
{'name': u'Qt Linux Release minimal', },
- {'name': u'Qt Linux ARMv5 Release', },
{'name': u'Qt Linux ARMv7 Release', },
{'name': u'Qt Windows 32-bit Release', },
{'name': u'Qt Windows 32-bit Debug', },
diff --git a/Tools/Scripts/webkitpy/common/net/testoutput.py b/Tools/Scripts/webkitpy/common/net/testoutput.py
index 37c1445..7e181ed 100644
--- a/Tools/Scripts/webkitpy/common/net/testoutput.py
+++ b/Tools/Scripts/webkitpy/common/net/testoutput.py
@@ -48,13 +48,13 @@ class TestOutput(object):
def _extract_platform(self, filename):
"""Calculates the platform from the name of the file if it isn't known already"""
- path = re.split(os.path.sep, filename)
+ path = filename.split(os.path.sep)
if 'platform' in path:
return path[path.index('platform') + 1]
return None
def _extract_test_name(self, filename):
- path = re.split(os.path.sep, filename)
+ path = filename.split(os.path.sep)
if 'LayoutTests' in path:
path = path[1 + path.index('LayoutTests'):]
if 'layout-test-results' in path:
diff --git a/Tools/Scripts/webkitpy/common/net/testoutput_unittest.py b/Tools/Scripts/webkitpy/common/net/testoutput_unittest.py
index ad38ca6..6b820c6 100644
--- a/Tools/Scripts/webkitpy/common/net/testoutput_unittest.py
+++ b/Tools/Scripts/webkitpy/common/net/testoutput_unittest.py
@@ -22,7 +22,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import os
import re
+import sys
import testoutput
import unittest
@@ -60,10 +62,19 @@ class FakeTestOutput(testoutput.TestOutput):
class TestOutputTest(unittest.TestCase):
def _check_name(self, filename, expected_test_name):
+ # FIXME: should consider using MockFileSystem here so as to not
+ # have to worry about platform-specific path separators.
+ if sys.platform == 'win32':
+ filename = filename.replace('/', os.path.sep)
+ expected_test_name = expected_test_name.replace('/', os.path.sep)
r = testoutput.TextTestOutput(None, FakeFile(filename))
self.assertEquals(expected_test_name, r.name())
def _check_platform(self, filename, expected_platform):
+ # FIXME: should consider using MockFileSystem here so as to not
+ # have to worry about platform-specific path separators.
+ if sys.platform == 'win32':
+ filename = filename.replace('/', os.path.sep)
r = testoutput.TextTestOutput(None, FakeFile(filename))
self.assertEquals(expected_platform, r.platform())
diff --git a/Tools/Scripts/webkitpy/common/net/testoutputset_unittest.py b/Tools/Scripts/webkitpy/common/net/testoutputset_unittest.py
index a70a539..f33850c 100644
--- a/Tools/Scripts/webkitpy/common/net/testoutputset_unittest.py
+++ b/Tools/Scripts/webkitpy/common/net/testoutputset_unittest.py
@@ -22,6 +22,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import sys
+
from webkitpy.common.system.zip_mock import MockZip
import testoutputset
import unittest
@@ -72,6 +74,11 @@ class TestOutputSetTest(unittest.TestCase):
self.assertEquals(2, len(b.outputs_for('fast/dom/test')))
def test_can_infer_platform_from_path_if_none_provided(self):
+ # FIXME: unclear what the right behavior on win32 is.
+ # https://bugs.webkit.org/show_bug.cgi?id=54525.
+ if sys.platform == 'win32':
+ return
+
zip = MockZip()
zip.insert('platform/win/some-test-expected.png', '<image data>')
zip.insert('platform/win/some-test-expected.checksum', 'abc123')
diff --git a/Tools/Scripts/webkitpy/common/prettypatch_unittest.py b/Tools/Scripts/webkitpy/common/prettypatch_unittest.py
index 1307856..6a3c79a 100644
--- a/Tools/Scripts/webkitpy/common/prettypatch_unittest.py
+++ b/Tools/Scripts/webkitpy/common/prettypatch_unittest.py
@@ -34,6 +34,13 @@ from webkitpy.common.prettypatch import PrettyPatch
class PrettyPatchTest(unittest.TestCase):
+ def check_ruby(self):
+ executive = Executive()
+ try:
+ result = executive.run_command(['ruby', '--version'])
+ except OSError, e:
+ return False
+ return True
_diff_with_multiple_encodings = """
Index: utf8_test
@@ -59,12 +66,18 @@ Index: latin1_test
return webkit_root
def test_pretty_diff_encodings(self):
+ if not self.check_ruby():
+ return
+
pretty_patch = PrettyPatch(Executive(), self._webkit_root())
pretty = pretty_patch.pretty_diff(self._diff_with_multiple_encodings)
self.assertTrue(pretty) # We got some output
self.assertTrue(isinstance(pretty, str)) # It's a byte array, not unicode
def test_pretty_print_empty_string(self):
+ if not self.check_ruby():
+ return
+
# Make sure that an empty diff does not hang the process.
pretty_patch = PrettyPatch(Executive(), self._webkit_root())
self.assertEqual(pretty_patch.pretty_diff(""), "")
diff --git a/Tools/Scripts/webkitpy/common/system/executive_mock.py b/Tools/Scripts/webkitpy/common/system/executive_mock.py
index 943b70c..367732c 100644
--- a/Tools/Scripts/webkitpy/common/system/executive_mock.py
+++ b/Tools/Scripts/webkitpy/common/system/executive_mock.py
@@ -35,8 +35,9 @@ from webkitpy.common.system import executive
class MockExecutive2(object):
def __init__(self, output='', exit_code=0, exception=None,
- run_command_fn=None):
+ run_command_fn=None, stderr=''):
self._output = output
+ self._stderr = stderr
self._exit_code = exit_code
self._exception = exception
self._run_command_fn = run_command_fn
@@ -51,7 +52,7 @@ class MockExecutive2(object):
pass
def run_command(self, arg_list, error_handler=None, return_exit_code=False,
- decode_output=False):
+ decode_output=False, return_stderr=False):
if self._exception:
raise self._exception
if return_exit_code:
@@ -63,5 +64,6 @@ class MockExecutive2(object):
exit_code=self._exit_code,
output=self._output)
error_handler(script_error)
-
+ if return_stderr:
+ return self._output + self._stderr
return self._output
diff --git a/Tools/Scripts/webkitpy/common/system/executive_unittest.py b/Tools/Scripts/webkitpy/common/system/executive_unittest.py
index a43b4dc..1dadc36 100644
--- a/Tools/Scripts/webkitpy/common/system/executive_unittest.py
+++ b/Tools/Scripts/webkitpy/common/system/executive_unittest.py
@@ -123,10 +123,12 @@ class ExecutiveTest(unittest.TestCase):
executive.kill_process(process.pid)
# Note: Can't use a ternary since signal.SIGKILL is undefined for sys.platform == "win32"
if sys.platform == "win32":
- expected_exit_code = 1
+ # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
+ # We seem to get either 0 or 1 here for some reason.
+ self.assertTrue(process.wait() in (0, 1))
else:
expected_exit_code = -signal.SIGKILL
- self.assertEqual(process.wait(), expected_exit_code)
+ self.assertEqual(process.wait(), expected_exit_code)
# Killing again should fail silently.
executive.kill_process(process.pid)
@@ -153,11 +155,14 @@ class ExecutiveTest(unittest.TestCase):
# Note: Can't use a ternary since signal.SIGTERM is undefined for sys.platform == "win32"
if sys.platform == "cygwin":
expected_exit_code = 0 # os.kill results in exit(0) for this process.
+ self.assertEqual(process.wait(), expected_exit_code)
elif sys.platform == "win32":
- expected_exit_code = 1
+ # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
+ # We seem to get either 0 or 1 here for some reason.
+ self.assertTrue(process.wait() in (0, 1))
else:
expected_exit_code = -signal.SIGTERM
- self.assertEqual(process.wait(), expected_exit_code)
+ self.assertEqual(process.wait(), expected_exit_code)
# Killing again should fail silently.
executive.kill_all(never_ending_command()[0])