Update tools to reflect movement of TestExpectations

Also fix SVN URL in test_expectations*.py to use src.chromium.org after blink
fork.

Also fix test_expectations_history_unittest.py to use correct time zone. Commit
time stamps are in UTC, so we need to specify date ranges in UTC, rather than
local time, to ensure consistent behaviour in all locations.

BUG=230264

Review URL: https://codereview.chromium.org/14316009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194752 0039d316-1c4b-4281-b951-d872f2087c98
parent 60d0b8ef
...@@ -59,8 +59,8 @@ getting layout test names from Webkit SVN as well as test description. ...@@ -59,8 +59,8 @@ getting layout test names from Webkit SVN as well as test description.
** TestExpectations: ** TestExpectations:
A class to model the content of test expectation file for analysis. A class to model the content of test expectation file for analysis.
The raw test expectation file can be found in The location of the test expectations file can be found in
|DEFAULT_TEST_EXPECTATION_LOCATION|. It is necessary to parse this |TEST_EXPECTATIONS_LOCATIONS|. It is necessary to parse this
file and store meaningful information for the analysis (joining with file and store meaningful information for the analysis (joining with
existing layout tests using a test name). Instance variable existing layout tests using a test name). Instance variable
|all_test_expectation_info| is used. A test name such as |all_test_expectation_info| is used. A test name such as
......
...@@ -8,11 +8,10 @@ import urllib2 ...@@ -8,11 +8,10 @@ import urllib2
from webkitpy.layout_tests.models.test_expectations import * from webkitpy.layout_tests.models.test_expectations import *
# Default Webkit SVN location for chromium test expectation file. # Default location for chromium test expectation file.
# TODO(imasaki): support multiple test expectations files. # TODO(imasaki): support multiple test expectations files.
DEFAULT_TEST_EXPECTATION_LOCATION = ( DEFAULT_TEST_EXPECTATIONS_LOCATION = (
'http://svn.webkit.org/repository/webkit/trunk/' 'http://src.chromium.org/blink/trunk/LayoutTests/TestExpectations')
'LayoutTests/platform/chromium/TestExpectations')
# The following is from test expectation syntax. The detail can be found in # The following is from test expectation syntax. The detail can be found in
# http://www.chromium.org/developers/testing/webkit-layout-tests#TOC-Test-Expectations # http://www.chromium.org/developers/testing/webkit-layout-tests#TOC-Test-Expectations
...@@ -51,7 +50,7 @@ class TestExpectations(object): ...@@ -51,7 +50,7 @@ class TestExpectations(object):
'Platforms': ['SNOWLEOPARD', 'ANDROID'], 'TIMEOUT': True, 'PASS': True}]} 'Platforms': ['SNOWLEOPARD', 'ANDROID'], 'TIMEOUT': True, 'PASS': True}]}
""" """
def __init__(self, url=DEFAULT_TEST_EXPECTATION_LOCATION): def __init__(self, url=DEFAULT_TEST_EXPECTATIONS_LOCATION):
"""Read the test expectation file from the specified URL and parse it. """Read the test expectation file from the specified URL and parse it.
Args: Args:
......
...@@ -12,14 +12,15 @@ import sys ...@@ -12,14 +12,15 @@ import sys
import time import time
import pysvn import pysvn
# Default Webkit SVN location for chromium test expectation file. TEST_EXPECTATIONS_ROOT = 'http://src.chromium.org/blink/trunk/'
# A map from earliest revision to path.
# TODO(imasaki): support multiple test expectation files. # TODO(imasaki): support multiple test expectation files.
DEFAULT_TEST_EXPECTATION_LOCATION = ( TEST_EXPECTATIONS_LOCATIONS = {
'http://svn.webkit.org/repository/webkit/trunk/' 148348: 'LayoutTests/TestExpectations',
'LayoutTests/platform/chromium/TestExpectations') 119317: 'LayoutTests/platform/chromium/TestExpectations',
LEGACY_TEST_EXPECTATION_LOCATION = ( 0: 'LayoutTests/platform/chromium/test_expectations.txt'}
'http://svn.webkit.org/repository/webkit/trunk/' TEST_EXPECTATIONS_DEFAULT_PATH = (
'LayoutTests/platform/chromium/test_expectations.txt') TEST_EXPECTATIONS_ROOT + TEST_EXPECTATIONS_LOCATIONS[148348])
class TestExpectationsHistory(object): class TestExpectationsHistory(object):
"""A class to represent history of the test expectation file. """A class to represent history of the test expectation file.
...@@ -30,9 +31,15 @@ class TestExpectationsHistory(object): ...@@ -30,9 +31,15 @@ class TestExpectationsHistory(object):
about the test expectation file. about the test expectation file.
""" """
@staticmethod
def GetTestExpectationsPathForRevision(revision):
for i in sorted(TEST_EXPECTATIONS_LOCATIONS.keys(), reverse=True):
if revision >= i:
return TEST_EXPECTATIONS_ROOT + TEST_EXPECTATIONS_LOCATIONS[i]
@staticmethod @staticmethod
def GetDiffBetweenTimes(start, end, testname_list, def GetDiffBetweenTimes(start, end, testname_list,
te_location=DEFAULT_TEST_EXPECTATION_LOCATION): te_location=TEST_EXPECTATIONS_DEFAULT_PATH):
"""Get difference between time period for the specified test names. """Get difference between time period for the specified test names.
Given the time period, this method first gets the revision number. Then, Given the time period, this method first gets the revision number. Then,
...@@ -87,13 +94,10 @@ class TestExpectationsHistory(object): ...@@ -87,13 +94,10 @@ class TestExpectationsHistory(object):
new_rev = logs[i + 1].revision.number new_rev = logs[i + 1].revision.number
# Parsing the actual diff. # Parsing the actual diff.
# test_expectations.txt was renamed to TestExpectations at r119317. new_path = TestExpectationsHistory.GetTestExpectationsPathForRevision(
new_path = DEFAULT_TEST_EXPECTATION_LOCATION new_rev);
if new_rev < 119317: old_path = TestExpectationsHistory.GetTestExpectationsPathForRevision(
new_path = LEGACY_TEST_EXPECTATION_LOCATION old_rev);
old_path = DEFAULT_TEST_EXPECTATION_LOCATION
if old_rev < 119317:
old_path = LEGACY_TEST_EXPECTATION_LOCATION
text = client.diff('/tmp', text = client.diff('/tmp',
url_or_path=old_path, url_or_path=old_path,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from datetime import datetime from datetime import datetime
import time import calendar
import unittest import unittest
...@@ -33,11 +33,14 @@ class TestTestExpectationsHistory(unittest.TestCase): ...@@ -33,11 +33,14 @@ class TestTestExpectationsHistory(unittest.TestCase):
return True return True
return False return False
# These tests use the following commit.
# commit 235788e3a4fc71342a5c9fefe67ce9537706ce35
# Author: rniwa@webkit.org
# Date: Sat Aug 20 06:19:11 2011 +0000
def testGetDiffBetweenTimes(self): def testGetDiffBetweenTimes(self):
t = (2011, 8, 20, 0, 0, 0, 0, 0, 0) ptime = calendar.timegm((2011, 8, 20, 0, 0, 0, 0, 0, 0))
ctime = time.mktime(t) ctime = calendar.timegm((2011, 8, 21, 0, 0, 0, 0, 0, 0))
t = (2011, 8, 19, 0, 0, 0, 0, 0, 0)
ptime = time.mktime(t)
testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html' testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html'
testname_list = [testname] testname_list = [testname]
result_list = TestExpectationsHistory.GetDiffBetweenTimes( result_list = TestExpectationsHistory.GetDiffBetweenTimes(
...@@ -45,10 +48,8 @@ class TestTestExpectationsHistory(unittest.TestCase): ...@@ -45,10 +48,8 @@ class TestTestExpectationsHistory(unittest.TestCase):
self.assertTrue(self.AssertTestName(result_list, testname)) self.assertTrue(self.AssertTestName(result_list, testname))
def testGetDiffBetweenTimesOnly1Diff(self): def testGetDiffBetweenTimesOnly1Diff(self):
ptime = datetime.strptime('2011-08-19-23', '%Y-%m-%d-%H') ptime = calendar.timegm((2011, 8, 20, 6, 0, 0, 0, 0, 0))
ptime = time.mktime(ptime.timetuple()) ctime = calendar.timegm((2011, 8, 20, 7, 0, 0, 0, 0, 0))
ctime = datetime.strptime('2011-08-20-00', '%Y-%m-%d-%H')
ctime = time.mktime(ctime.timetuple())
testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html' testname = 'fast/css/getComputedStyle/computed-style-without-renderer.html'
testname_list = [testname] testname_list = [testname]
result_list = TestExpectationsHistory.GetDiffBetweenTimes( result_list = TestExpectationsHistory.GetDiffBetweenTimes(
...@@ -56,10 +57,8 @@ class TestTestExpectationsHistory(unittest.TestCase): ...@@ -56,10 +57,8 @@ class TestTestExpectationsHistory(unittest.TestCase):
self.assertTrue(self.AssertTestName(result_list, testname)) self.assertTrue(self.AssertTestName(result_list, testname))
def testGetDiffBetweenTimesOnly1DiffWithGobackSeveralDays(self): def testGetDiffBetweenTimesOnly1DiffWithGobackSeveralDays(self):
ptime = datetime.strptime('2011-09-11-18', '%Y-%m-%d-%H') ptime = calendar.timegm((2011, 9, 12, 1, 0, 0, 0, 0, 0))
ptime = time.mktime(ptime.timetuple()) ctime = calendar.timegm((2011, 9, 12, 2, 0, 0, 0, 0, 0))
ctime = datetime.strptime('2011-09-11-19', '%Y-%m-%d-%H')
ctime = time.mktime(ctime.timetuple())
testname = 'media/video-zoom-controls.html' testname = 'media/video-zoom-controls.html'
testname_list = [testname] testname_list = [testname]
result_list = TestExpectationsHistory.GetDiffBetweenTimes( result_list = TestExpectationsHistory.GetDiffBetweenTimes(
......
# This file should almost always be empty. Normally Chromium test expectations # This file should almost always be empty. Normally Chromium test expectations
# are only put here temporarily, and moved to # are only put here temporarily, and moved to
# src/third_party/WebKit/LayoutTests/platform/chromium/TestExpectations # src/third_party/WebKit/LayoutTests/TestExpectations where they will remain
# where they will remain until they are rebaselined. # until they are rebaselined.
# #
# #
# If you are landing a Chromium CL that would break webkit layout tests, # If you are landing a Chromium CL that would break webkit layout tests,
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
# #
# 2. BEFORE landing your Chromium CL, land a WebKit CL adding those same # 2. BEFORE landing your Chromium CL, land a WebKit CL adding those same
# expected failures to # expected failures to
# src/third_party/WebKit/LayoutTests/platform/chromium/TestExpectations . # src/third_party/WebKit/LayoutTests/TestExpectations . If you are unable to do
# If you are unable to do this yourself, please get a WebKit Committer to do # this yourself, please get a WebKit Committer to do it for you, or at least
# it for you, or at least coordinate with a current WebKit Gardener to make # coordinate with a current WebKit Gardener to make sure she is aware of the
# sure she is aware of the pending breakages. # pending breakages.
# #
# 3. AFTER you have landed the WebKit test_expectations CL, you can land your # 3. AFTER you have landed the WebKit test_expectations CL, you can land your
# Chromium CL. Be sure to include your expected failures in this file, so # Chromium CL. Be sure to include your expected failures in this file, so
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
# Every time Chromium's "WebKit Gardener" rolls the WebKit DEPS within # Every time Chromium's "WebKit Gardener" rolls the WebKit DEPS within
# Chromium, he will delete ALL expectations within this file. (By then, they # Chromium, he will delete ALL expectations within this file. (By then, they
# will be redundant, because you already landed those same expectations in # will be redundant, because you already landed those same expectations in
# src/third_party/WebKit/LayoutTests/platform/chromium/TestExpectations . # src/third_party/WebKit/LayoutTests/TestExpectations . Right?)
# Right?)
# #
# EVERYTHING BELOW THIS LINE WILL BE DELETED AT EVERY WEBKIT DEPS ROLL # EVERYTHING BELOW THIS LINE WILL BE DELETED AT EVERY WEBKIT DEPS ROLL
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment