summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/print-vse-failure-logs
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/Scripts/print-vse-failure-logs')
-rwxr-xr-xWebKitTools/Scripts/print-vse-failure-logs51
1 files changed, 42 insertions, 9 deletions
diff --git a/WebKitTools/Scripts/print-vse-failure-logs b/WebKitTools/Scripts/print-vse-failure-logs
index cec806e..7580465 100755
--- a/WebKitTools/Scripts/print-vse-failure-logs
+++ b/WebKitTools/Scripts/print-vse-failure-logs
@@ -33,15 +33,14 @@
from __future__ import with_statement
import codecs
-import os.path
import os
+import re
+from webkitpy.common.checkout import scm
from webkitpy.common.system.executive import Executive
+from webkitpy.thirdparty import BeautifulSoup
-# This is just enough to make the win-ews bot useable. Others who
-# actually use Windows should feel encouraged to improve this class,
-# including just printing the text instead of the raw html.
class PrintVisualStudioExpressLogs(object):
def __init__(self):
self._executive = Executive()
@@ -55,25 +54,59 @@ class PrintVisualStudioExpressLogs(object):
build_log_paths.append(file_path)
return build_log_paths
+ def _build_order(self):
+ """Returns a list of project names in the order in which they are built."""
+ script_path = os.path.join(self._scripts_directory(), "print-msvc-project-dependencies")
+ sln_path = os.path.join(scm.find_checkout_root(), "WebKit", "win", "WebKit.vcproj", "WebKit.sln")
+ lines = self._executive.run_command([script_path, sln_path]).splitlines()
+ order = [line.strip() for line in lines if line.find("Folder") == -1]
+ order.reverse()
+ return order
+
+ def _sort_buildlogs(self, log_paths):
+ build_order = self._build_order()
+ def sort_key(log_path):
+ project_name = os.path.basename(os.path.dirname(os.path.dirname(log_path)))
+ try:
+ index = build_order.index(project_name)
+ except ValueError:
+ # If the project isn't in the list, sort it after all items that
+ # are in the list.
+ index = len(build_order)
+ # Sort first by build order, then by project name
+ return (index, project_name)
+ return sorted(log_paths, key=sort_key)
+
def _obj_directory(self):
- scripts_directory = os.path.dirname(__file__)
- build_directory_script_path = os.path.join(scripts_directory, "webkit-build-directory")
+ build_directory_script_path = os.path.join(self._scripts_directory(), "webkit-build-directory")
# FIXME: ports/webkit.py should provide the build directory in a nice API.
# NOTE: The windows VSE build does not seem to use different directories
# for Debug and Release.
build_directory = self._executive.run_command([build_directory_script_path, "--top-level"]).rstrip()
return os.path.join(build_directory, "obj")
+ def _scripts_directory(self):
+ return os.path.dirname(__file__)
+
+ def _relevant_text(self, log):
+ soup = BeautifulSoup.BeautifulSoup(log)
+ # The Output Window table is where the useful output starts in the build log.
+ output_window_table = soup.find(text=re.compile("Output Window")).findParent("table")
+ result = []
+ for table in [output_window_table] + output_window_table.findNextSiblings("table"):
+ result.extend([text.replace(" ", "") for text in table.findAll(text=True)])
+ result.append("\n")
+ return "".join(result)
+
def main(self):
- obj_directory = self._obj_directory()
- build_log_paths = self._find_buildlogs(obj_directory)
+ build_log_paths = self._sort_buildlogs(self._find_buildlogs(self._obj_directory()))
print "Found %s Visual Studio Express Build Logs:\n%s" % (len(build_log_paths), "\n".join(build_log_paths))
for build_log_path in build_log_paths:
print "%s:\n" % build_log_path
with codecs.open(build_log_path, "r", "utf-16") as build_log:
- print build_log.read()
+ print self._relevant_text(build_log)
if __name__ == '__main__':