Created
October 21, 2011 14:45
-
-
Save Smith1123/1304022 to your computer and use it in GitHub Desktop.
patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py b/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py | |
index ad4745c..29d438d 100644 | |
--- a/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py | |
+++ b/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py | |
@@ -54,6 +54,7 @@ class SingleTestRunner: | |
self._timeout = test_input.timeout | |
self._worker_name = worker_name | |
self._test_name = test_input.test_name | |
+ self._should_run_pixel_test = test_input.should_run_pixel_test | |
self._is_reftest = False | |
self._is_mismatch_reftest = False | |
@@ -95,6 +96,9 @@ class SingleTestRunner: | |
self._port.expected_audio(self._test_name)) | |
def _should_fetch_expected_checksum(self): | |
+ if self._port.driver_name() == "WebKitTestRunner" and self._port.get_option('skip_pixel_test_if_no_baseline') and | |
+ self._port.get_option('pixel_tests'): | |
+ return self._should_run_pixel_test | |
return (self._options.pixel_tests and | |
not (self._options.new_baseline or self._options.reset_results)) | |
@@ -109,6 +113,12 @@ class SingleTestRunner: | |
return DriverInput(self._test_name, self._timeout, image_hash) | |
def run(self): | |
+ if self._port.driver_name() == "WebKitTestRunner" and self._port.get_option('skip_pixel_test_if_no_baseline') and | |
+ self._port.get_option('pixel_tests'): | |
+ image = self._port.expected_image(self._test_name) | |
+ if image != None: | |
+ self._should_run_pixel_test = True | |
+ self._options.pixel_tests = True | |
if self._options.new_baseline or self._options.reset_results: | |
if self._is_reftest: | |
# Returns a dummy TestResult. We don't have to rebase for reftests. | |
diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_input.py b/Tools/Scripts/webkitpy/layout_tests/models/test_input.py | |
index d5602d6..18e4e42 100644 | |
--- a/Tools/Scripts/webkitpy/layout_tests/models/test_input.py | |
+++ b/Tools/Scripts/webkitpy/layout_tests/models/test_input.py | |
@@ -32,13 +32,14 @@ | |
class TestInput: | |
"""Groups information about a test for easy passing of data.""" | |
- def __init__(self, test_name, timeout): | |
+ def __init__(self, test_name, timeout, should_run_pixel_test=False): | |
"""Holds the input parameters for a test. | |
Args: | |
test: name of test (not an absolute path!) | |
timeout: Timeout in msecs the driver should use while running the test | |
""" | |
self.test_name = test_name | |
+ self.should_run_pixel_test = should_run_pixel_test | |
self.timeout = timeout | |
def __repr__(self): | |
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/webkit.py b/Tools/Scripts/webkitpy/layout_tests/port/webkit.py | |
index ea157cd..2dffb9a 100644 | |
--- a/Tools/Scripts/webkitpy/layout_tests/port/webkit.py | |
+++ b/Tools/Scripts/webkitpy/layout_tests/port/webkit.py | |
@@ -436,7 +436,8 @@ class WebKitDriver(Driver): | |
def cmd_line(self): | |
cmd = self._command_wrapper(self._port.get_option('wrapper')) | |
cmd.append(self._port._path_to_driver()) | |
- if self._port.get_option('pixel_tests'): | |
+ if self._port.get_option('pixel_tests') or | |
+ (self._port.get_option('skip_pixel_test_if_no_baseline') and self._port.get_option('pixel_tests')): | |
cmd.append('--pixel-tests') | |
if self._port.get_option('gc_between_tests'): | |
cmd.append('--gc-between-tests') | |
diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py | |
index 7245f9b..f005c6c 100755 | |
--- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py | |
+++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py | |
@@ -83,6 +83,10 @@ def run(port, options, args, regular_output=sys.stderr, | |
manager = Manager(port, options, printer) | |
manager.print_config() | |
+ if options.skip_pixel_test_if_no_baseline and not (port.driver_name() == "WebKitTestRunner"): | |
+ _log.error("--skip-pixel-test-if-no-baseline is only supperted in WebKitTestRunner") | |
+ return -1 | |
+ | |
printer.print_update("Collecting tests ...") | |
try: | |
manager.collect_tests(args) | |
@@ -157,6 +161,9 @@ def _set_up_derived_options(port, options): | |
warnings.append("--no-http is ignored since --force is also provided") | |
options.http = True | |
+ if options.skip_pixel_test_if_no_baseline and not options.pixel_tests: | |
+ warnings.append("--skip-pixel-test-if-no-baseline is only supported with -p (--pixel-tests)") | |
+ | |
return warnings | |
@@ -285,6 +292,8 @@ def parse_args(args=None): | |
optparse.make_option("--no-new-test-results", action="store_false", | |
dest="new_test_results", default=True, | |
help="Don't create new baselines when no expected results exist"), | |
+ optparse.make_option("--skip-pixel-test-if-no-baseline", action="store_true", | |
+ dest="skip_pixel_test_if_no_baseline", help="Enable pixel-to-pixel PNG comparisons on WebKit2"), | |
optparse.make_option("--skip-failing-tests", action="store_true", | |
default=False, help="Skip tests that are expected to fail. " | |
"Note: When using this option, you might miss new crashes " | |
diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp | |
index fac63cd..8734907 100644 | |
--- a/Tools/WebKitTestRunner/TestController.cpp | |
+++ b/Tools/WebKitTestRunner/TestController.cpp | |
@@ -478,7 +478,7 @@ bool TestController::runTest(const char* test) | |
m_currentInvocation = adoptPtr(new TestInvocation(pathOrURL)); | |
if (m_dumpPixels) | |
- m_currentInvocation->setIsPixelTest(expectedPixelHash); | |
+ m_currentInvocation->setIsPixelTest(expectedPixelHash); | |
m_currentInvocation->invoke(); | |
m_currentInvocation.clear(); | |
diff --git a/Tools/WebKitTestRunner/TestInvocation.cpp b/Tools/WebKitTestRunner/TestInvocation.cpp | |
index 451d666..31e29af 100644 | |
--- a/Tools/WebKitTestRunner/TestInvocation.cpp | |
+++ b/Tools/WebKitTestRunner/TestInvocation.cpp | |
@@ -105,6 +105,8 @@ TestInvocation::~TestInvocation() | |
void TestInvocation::setIsPixelTest(const std::string& expectedPixelHash) | |
{ | |
+ if (!expectedPixelHash.length()) | |
+ return; | |
m_dumpPixels = true; | |
m_expectedPixelHash = expectedPixelHash; | |
} | |
diff --git a/Tools/WebKitTestRunner/TestInvocation.h b/Tools/WebKitTestRunner/TestInvocation.h | |
index 5ff7ea0..9165205 100644 | |
--- a/Tools/WebKitTestRunner/TestInvocation.h | |
+++ b/Tools/WebKitTestRunner/TestInvocation.h | |
@@ -39,7 +39,7 @@ public: | |
~TestInvocation(); | |
void setIsPixelTest(const std::string& expectedPixelHash); | |
- | |
+ | |
void invoke(); | |
void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); | |
WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment