summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-08-27 11:02:25 +0100
committerSteve Block <steveblock@google.com>2010-09-02 17:17:20 +0100
commite8b154fd68f9b33be40a3590e58347f353835f5c (patch)
tree0733ce26384183245aaa5656af26c653636fe6c1 /WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
parentda56157816334089526a7a115a85fd85a6e9a1dc (diff)
downloadexternal_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.zip
external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.gz
external_webkit-e8b154fd68f9b33be40a3590e58347f353835f5c.tar.bz2
Merge WebKit at r66079 : Initial merge by git
Change-Id: Ie2e1440fb9d487d24e52c247342c076fecaecac7
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/layout_tests/port/base.py')
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/base.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
index d226e64..af1af93 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
@@ -30,7 +30,10 @@
"""Abstract base class of Port-specific entrypoints for the layout tests
test infrastructure (the Port and Driver classes)."""
+from __future__ import with_statement
+
import cgi
+import codecs
import difflib
import errno
import os
@@ -633,8 +636,38 @@ class Port(object):
_log.error("Failed to run PrettyPatch (%s):\n%s" % (command, e.message_with_output()))
return self._pretty_patch_error_html
+ def _webkit_build_directory(self, args):
+ args = [self.script_path("webkit-build-directory")] + args
+ return self._executive.run_command(args).rstrip()
+
+ def _configuration_file_path(self):
+ build_root = self._webkit_build_directory(["--top-level"])
+ return os.path.join(build_root, "Configuration")
+
+ # Easy override for unit tests
+ def _open_configuration_file(self):
+ configuration_path = self._configuration_file_path()
+ return codecs.open(configuration_path, "r", "utf-8")
+
+ def _read_configuration(self):
+ try:
+ with self._open_configuration_file() as file:
+ return file.readline().rstrip()
+ except IOError, e:
+ return None
+
+ # FIXME: This list may be incomplete as Apple has some sekret configs.
+ _RECOGNIZED_CONFIGURATIONS = ("Debug", "Release")
+
def default_configuration(self):
- return "Release"
+ # FIXME: Unify this with webkitdir.pm configuration reading code.
+ configuration = self._read_configuration()
+ if not configuration:
+ configuration = "Release"
+ if configuration not in self._RECOGNIZED_CONFIGURATIONS:
+ _log.warn("Configuration \"%s\" found in %s is not a recognized value.\n" % (configuration, self._configuration_file_path()))
+ _log.warn("Scripts may fail. See 'set-webkit-configuration --help'.")
+ return configuration
#
# PROTECTED ROUTINES