From 2ca8acdb5622b03a4ef56159477087adcf87db62 Mon Sep 17 00:00:00 2001 From: Maksymilian Osowski Date: Thu, 2 Sep 2010 15:46:38 +0100 Subject: [PATCH] Adds webkit revision to the summary and details. The revision number is taken from external/webkit/WEBKIT_MERGE_REVISION and is served to the java code by apache server. To be able to do that, the new alias directive had to be added to the run_apache2.py script. Bug: 2889572 Change-Id: Ie3d147e4d8ea9edd0144b819152121563b8bd759 --- tests/DumpRenderTree2/assets/run_apache2.py | 2 ++ .../android/dumprendertree2/Summarizer.java | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/DumpRenderTree2/assets/run_apache2.py b/tests/DumpRenderTree2/assets/run_apache2.py index 5764f0e3c0feb..e0e4be7f26f7c 100755 --- a/tests/DumpRenderTree2/assets/run_apache2.py +++ b/tests/DumpRenderTree2/assets/run_apache2.py @@ -76,6 +76,8 @@ def main(): directives += " -c \"Alias /LayoutTests " + layout_tests_path + "\"" directives += " -c \"Alias /WebKitTools/DumpRenderTree/android " + \ os.path.join(webkit_path, "WebKitTools", "DumpRenderTree", "android") + "\"" + directives += " -c \"Alias /WEBKIT_MERGE_REVISION " + \ + os.path.join(webkit_path, "WEBKIT_MERGE_REVISION") + "\"" # This directive is commented out in apache2-debian-httpd.conf for some reason # However, it is useful to browse through tests in the browser, so it's added here. diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java index ea8b097f94883..d18fb14cde0f7 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java @@ -263,6 +263,7 @@ public class Summarizer { txt.append("Date: " + dateFormat.format(mDate) + "\n"); txt.append("Build fingerprint: " + Build.FINGERPRINT + "\n"); txt.append("WebKit version: " + getWebKitVersionFromUserAgentString() + "\n"); + txt.append("WebKit revision: " + getWebKitRevision() + "\n"); txt.append("TOTAL: " + getTotalTestCount() + "\n"); if (mCrashedTestsCount > 0) { @@ -322,6 +323,24 @@ public class Summarizer { return "unknown"; } + private String getWebKitRevision() { + URL url = null; + try { + url = new URL(ForwarderManager.getHostSchemePort(false) + "WEBKIT_MERGE_REVISION"); + } catch (MalformedURLException e) { + assert false; + } + + String webkitMergeRevisionFileContents = new String(FsUtils.readDataFromUrl(url)); + Matcher matcher = + Pattern.compile("http://svn.webkit.org/repository/webkit/trunk@([0-9]+)").matcher( + webkitMergeRevisionFileContents); + if (matcher.find()) { + return matcher.group(1); + } + return "unknown"; + } + private void createTopSummaryTable(StringBuilder html) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); html.append("

" + mTestsRelativePath + "

"); @@ -329,6 +348,12 @@ public class Summarizer { html.append("

" + "Build fingerprint: " + Build.FINGERPRINT + "

"); html.append("

" + "WebKit version: " + getWebKitVersionFromUserAgentString() + "

"); + String webkitRevision = getWebKitRevision(); + html.append("

" + "WebKit revision: "); + html.append("" + webkitRevision + ""); + html.append("

"); + html.append(""); createSummaryTableRow(html, "TOTAL", getTotalTestCount()); createSummaryTableRow(html, "CRASHED", mCrashedTestsCount);