Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ca8acdb authored by Maksymilian Osowski's avatar Maksymilian Osowski
Browse files

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: 28895725
Change-Id: Ie3d147e4d8ea9edd0144b819152121563b8bd759
parent eaa511fd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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.
+25 −0
Original line number Diff line number Diff line
@@ -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("<h1>" + mTestsRelativePath + "</h1>");
@@ -329,6 +348,12 @@ public class Summarizer {
        html.append("<h3>" + "Build fingerprint: " + Build.FINGERPRINT + "</h3>");
        html.append("<h3>" + "WebKit version: " + getWebKitVersionFromUserAgentString() + "</h3>");

        String webkitRevision = getWebKitRevision();
        html.append("<h3>" + "WebKit revision: ");
        html.append("<a href=\"http://trac.webkit.org/browser/trunk?rev=" + webkitRevision +
                "\" target=\"_blank\"><span class=\"path\">" + webkitRevision + "</span></a>");
        html.append("</h3>");

        html.append("<table class=\"summary\">");
        createSummaryTableRow(html, "TOTAL", getTotalTestCount());
        createSummaryTableRow(html, "CRASHED", mCrashedTestsCount);