Commit c2257ae5 authored by kinuko@chromium.org's avatar kinuko@chromium.org

2010-06-03 Kinuko Yasuda <kinuko@chromium.org>

        Reviewed by Shinichiro Hamaji.

        Clean up chromium-specific code from json_results_generator.py.
        https://bugs.webkit.org/show_bug.cgi?id=39665

        * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
        * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
        * Scripts/webkitpy/layout_tests/port/base.py:
        * Scripts/webkitpy/layout_tests/port/chromium.py:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60690 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 07954685
2010-06-03 Kinuko Yasuda <kinuko@chromium.org>
Reviewed by Shinichiro Hamaji.
Clean up chromium-specific code from json_results_generator.py.
https://bugs.webkit.org/show_bug.cgi?id=39665
* Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py:
* Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py:
* Scripts/webkitpy/layout_tests/port/base.py:
* Scripts/webkitpy/layout_tests/port/chromium.py:
2010-06-04 Tony Gentilcore <tonyg@chromium.org>
Reviewed by Adam Barth.
......
......@@ -77,6 +77,7 @@ class JSONLayoutResultsGenerator(json_results_generator.JSONResultsGenerator):
self._test_timings = dict(
(path_to_name(test_tuple.filename), test_tuple.test_run_time)
for test_tuple in test_timings)
self._svn_repositories = port.test_repository_paths()
self._generate_json_output()
......
......@@ -38,6 +38,8 @@ import time
import urllib2
import xml.dom.minidom
from webkitpy.common.checkout import scm
from webkitpy.common.system.executive import ScriptError
from webkitpy.layout_tests.layout_package import test_expectations
import webkitpy.thirdparty.simplejson as simplejson
......@@ -46,6 +48,7 @@ _log = logging.getLogger("webkitpy.layout_tests.layout_package."
class JSONResultsGenerator(object):
"""A JSON results generator for generic tests."""
MAX_NUMBER_OF_BUILD_RESULTS_TO_LOG = 750
# Min time (seconds) that will be added to the JSON.
......@@ -60,8 +63,6 @@ class JSONResultsGenerator(object):
RESULTS = "results"
TIMES = "times"
BUILD_NUMBERS = "buildNumbers"
WEBKIT_SVN = "webkitRevision"
CHROME_SVN = "chromeRevision"
TIME = "secondsSinceEpoch"
TESTS = "tests"
......@@ -102,7 +103,6 @@ class JSONResultsGenerator(object):
all_tests: List of all the tests that were run. This should not
include skipped tests.
"""
self._port = port
self._builder_name = builder_name
self._build_name = build_name
self._build_number = build_number
......@@ -114,6 +114,7 @@ class JSONResultsGenerator(object):
self._passed_tests = passed_tests
self._skipped_tests = skipped_tests
self._all_tests = all_tests
self._svn_repositories = port.test_repository_paths()
self._generate_json_output()
......@@ -125,26 +126,20 @@ class JSONResultsGenerator(object):
results_file.write(json)
results_file.close()
# FIXME: Callers should use scm.py instead.
def _get_svn_revision(self, in_directory):
"""Returns the svn revision for the given directory.
Args:
in_directory: The directory where svn is to be run.
"""
if os.path.exists(os.path.join(in_directory, '.svn')):
# Note: Not thread safe: http://bugs.python.org/issue2320
output = subprocess.Popen(["svn", "info", "--xml"],
cwd=in_directory,
shell=(sys.platform == 'win32'),
stdout=subprocess.PIPE).communicate()[0]
try:
dom = xml.dom.minidom.parseString(output)
return dom.getElementsByTagName('entry')[0].getAttribute(
'revision')
except xml.parsers.expat.ExpatError:
return ""
return ""
try:
scm_system = scm.detect_scm_system(in_directory)
return scm_system.__class__.value_from_svn_info(in_directory,
'Revision')
except (AttributeError, ScriptError):
# We're not in a svn directory, that's ok.
return ""
def _get_archived_json_results(self):
"""Reads old results JSON file if it exists.
......@@ -312,23 +307,11 @@ class JSONResultsGenerator(object):
self._insert_item_into_raw_list(results_for_builder,
self._build_number, self.BUILD_NUMBERS)
# These next two branches test to see which source repos we can
# pull revisions from.
if hasattr(self._port, 'path_from_webkit_base'):
path_to_webkit = self._port.path_from_webkit_base('WebCore')
# Include SVN revisions for the given repositories.
for (name, path) in self._svn_repositories:
self._insert_item_into_raw_list(results_for_builder,
self._get_svn_revision(path_to_webkit),
self.WEBKIT_SVN)
if hasattr(self._port, 'path_from_chromium_base'):
try:
path_to_chrome = self._port.path_from_chromium_base()
self._insert_item_into_raw_list(results_for_builder,
self._get_svn_revision(path_to_chrome),
self.CHROME_SVN)
except AssertionError:
# We're not in a Chromium checkout, that's ok.
pass
self._get_svn_revision(path),
name + 'Revision')
self._insert_item_into_raw_list(results_for_builder,
int(time.time()),
......
......@@ -537,6 +537,14 @@ class Port(object):
expectations, determining search paths, and logging information."""
raise NotImplementedError('Port.version')
def test_repository_paths(self):
"""Returns a list of (repository_name, repository_path) tuples
of its depending code base. By default it returns a list that only
contains a ('webkit', <webkitRepossitoryPath>) tuple.
"""
return [('webkit', self.layout_tests_dir())]
_WDIFF_DEL = '##WDIFF_DEL##'
_WDIFF_ADD = '##WDIFF_ADD##'
_WDIFF_END = '##WDIFF_END##'
......
......@@ -232,6 +232,13 @@ class ChromiumPort(base.Port):
raise ValueError('Unsupported test_platform_name: %s' %
test_platform_name)
def test_repository_paths(self):
# Note: for JSON file's backward-compatibility we use 'chrome' rather
# than 'chromium' here.
repos = super(ChromiumPort, self).test_repository_paths()
repos.append(('chrome', self.path_from_chromium_base()))
return repos
#
# PROTECTED METHODS
#
......
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