Title: [285168] trunk/Tools
Revision
285168
Author
timothy_hor...@apple.com
Date
2021-11-02 10:50:02 -0700 (Tue, 02 Nov 2021)

Log Message

dumpAsText() tests don't get the ref-test treatment when using --self-compare-with-header
https://bugs.webkit.org/show_bug.cgi?id=232611

Reviewed by Jonathan Bedard.

One oversight in r285132: a test can disable pixel dumping by calling
dumpAsText(). This causes --self-compare-with-header to fall over because
it expects every test to have pixel results (and that is the whole point).

Add an un-overrideable `--force-dump-pixels` TestCommand argument,
and adopt it for self-comparison tests.

* Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
(SingleTestRunner._run_self_comparison_test):
* Scripts/webkitpy/port/driver.py:
(DriverInput.__init__):
(DriverInput.__repr__):
(Driver._command_from_driver_input):
* TestRunnerShared/TestCommand.cpp:
(WTR::parseInputLine):
* TestRunnerShared/TestCommand.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::runTest):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::dumpResults):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/TestInvocation.h:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (285167 => 285168)


--- trunk/Tools/ChangeLog	2021-11-02 17:25:46 UTC (rev 285167)
+++ trunk/Tools/ChangeLog	2021-11-02 17:50:02 UTC (rev 285168)
@@ -1,3 +1,33 @@
+2021-11-02  Tim Horton  <timothy_hor...@apple.com>
+
+        dumpAsText() tests don't get the ref-test treatment when using --self-compare-with-header
+        https://bugs.webkit.org/show_bug.cgi?id=232611
+
+        Reviewed by Jonathan Bedard.
+
+        One oversight in r285132: a test can disable pixel dumping by calling
+        dumpAsText(). This causes --self-compare-with-header to fall over because
+        it expects every test to have pixel results (and that is the whole point).
+
+        Add an un-overrideable `--force-dump-pixels` TestCommand argument,
+        and adopt it for self-comparison tests.
+
+        * Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
+        (SingleTestRunner._run_self_comparison_test):
+        * Scripts/webkitpy/port/driver.py:
+        (DriverInput.__init__):
+        (DriverInput.__repr__):
+        (Driver._command_from_driver_input):
+        * TestRunnerShared/TestCommand.cpp:
+        (WTR::parseInputLine):
+        * TestRunnerShared/TestCommand.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::runTest):
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::dumpResults):
+        (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+        * WebKitTestRunner/TestInvocation.h:
+
 2021-11-02  Kate Cheney  <katherine_che...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=232593

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py (285167 => 285168)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py	2021-11-02 17:25:46 UTC (rev 285167)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py	2021-11-02 17:50:02 UTC (rev 285168)
@@ -342,6 +342,7 @@
     def _run_self_comparison_test(self, header):
         driver_input = self._driver_input()
         driver_input.should_run_pixel_test = True
+        driver_input.force_dump_pixels = True
 
         reference_output = self._driver.run_test(driver_input, self._stop_when_done)
         driver_input.self_comparison_header = header

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (285167 => 285168)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2021-11-02 17:25:46 UTC (rev 285167)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2021-11-02 17:50:02 UTC (rev 285168)
@@ -46,7 +46,7 @@
 
 
 class DriverInput(object):
-    def __init__(self, test_name, timeout, image_hash, should_run_pixel_test, should_dump_jsconsolelog_in_stderr=None, args=None, self_comparison_header=None):
+    def __init__(self, test_name, timeout, image_hash, should_run_pixel_test, should_dump_jsconsolelog_in_stderr=None, args=None, self_comparison_header=None, force_dump_pixels=False):
         self.test_name = test_name
         self.timeout = timeout  # in ms
         self.image_hash = image_hash
@@ -54,9 +54,10 @@
         self.should_dump_jsconsolelog_in_stderr = should_dump_jsconsolelog_in_stderr
         self.args = args or []
         self.self_comparison_header = self_comparison_header
+        self.force_dump_pixels = force_dump_pixels
 
     def __repr__(self):
-        return "DriverInput(test_name='{}', timeout={}, image_hash={}, should_run_pixel_test={}, should_dump_jsconsolelog_in_stderr={}, self_comparison_header={}'".format(self.test_name, self.timeout, self.image_hash, self.should_run_pixel_test, self.should_dump_jsconsolelog_in_stderr, self.self_comparison_header)
+        return "DriverInput(test_name='{}', timeout={}, image_hash={}, should_run_pixel_test={}, should_dump_jsconsolelog_in_stderr={}, self_comparison_header={}, force_dump_pixels={}'".format(self.test_name, self.timeout, self.image_hash, self.should_run_pixel_test, self.should_dump_jsconsolelog_in_stderr, self.self_comparison_header, self.force_dump_pixels)
 
 
 class DriverOutput(object):
@@ -636,6 +637,8 @@
             command += "'--dump-jsconsolelog-in-stderr"
         if driver_input.self_comparison_header:
             command += "'--self-compare-with-header'%s" % driver_input.self_comparison_header
+        if driver_input.force_dump_pixels:
+            command += "'--force-dump-pixels"
 
         # --pixel-test must be the last argument, because the hash is optional,
         # and any argument put in its place will be incorrectly consumed as the hash.

Modified: trunk/Tools/TestRunnerShared/TestCommand.cpp (285167 => 285168)


--- trunk/Tools/TestRunnerShared/TestCommand.cpp	2021-11-02 17:25:46 UTC (rev 285167)
+++ trunk/Tools/TestRunnerShared/TestCommand.cpp	2021-11-02 17:50:02 UTC (rev 285168)
@@ -107,6 +107,8 @@
             result.dumpJSConsoleLogInStdErr = true;
         else if (arg == std::string("--absolutePath"))
             result.absolutePath = tokenizer.next();
+        else if (arg == "--force-dump-pixels")
+            result.forceDumpPixels = true;
         else
             die(inputLine);
     }

Modified: trunk/Tools/TestRunnerShared/TestCommand.h (285167 => 285168)


--- trunk/Tools/TestRunnerShared/TestCommand.h	2021-11-02 17:25:46 UTC (rev 285167)
+++ trunk/Tools/TestRunnerShared/TestCommand.h	2021-11-02 17:50:02 UTC (rev 285168)
@@ -38,6 +38,7 @@
     std::string selfComparisonHeader;
     WTF::Seconds timeout;
     bool shouldDumpPixels { false };
+    bool forceDumpPixels { false };
     bool dumpJSConsoleLogInStdErr { false };
 };
 

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (285167 => 285168)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2021-11-02 17:25:46 UTC (rev 285167)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2021-11-02 17:50:02 UTC (rev 285168)
@@ -1480,6 +1480,9 @@
     if (command.shouldDumpPixels || m_shouldDumpPixelsForAllTests)
         m_currentInvocation->setIsPixelTest(command.expectedPixelHash);
 
+    if (command.forceDumpPixels)
+        m_currentInvocation->setForceDumpPixels(true);
+
     if (command.timeout > 0_s)
         m_currentInvocation->setCustomTimeout(command.timeout);
 

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (285167 => 285168)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2021-11-02 17:25:46 UTC (rev 285167)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2021-11-02 17:50:02 UTC (rev 285168)
@@ -829,7 +829,7 @@
     }
 
     if (WKStringIsEqualToUTF8CString(messageName, "SetDumpPixels")) {
-        m_dumpPixels = booleanValue(messageBody);
+        m_dumpPixels = booleanValue(messageBody) || m_forceDumpPixels;
         return nullptr;
     }
     if (WKStringIsEqualToUTF8CString(messageName, "GetDumpPixels"))

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (285167 => 285168)


--- trunk/Tools/WebKitTestRunner/TestInvocation.h	2021-11-02 17:25:46 UTC (rev 285167)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h	2021-11-02 17:50:02 UTC (rev 285168)
@@ -51,6 +51,7 @@
     const TestOptions& options() const { return m_options; }
 
     void setIsPixelTest(const std::string& expectedPixelHash);
+    void setForceDumpPixels(bool forceDumpPixels) { m_forceDumpPixels = forceDumpPixels; }
 
     void setCustomTimeout(Seconds duration) { m_timeout = duration; }
     void setDumpJSConsoleLogInStdErr(bool value) { m_dumpJSConsoleLogInStdErr = value; }
@@ -164,6 +165,7 @@
     bool m_waitUntilDone { false };
     bool m_dumpFrameLoadCallbacks { false };
     bool m_dumpPixels { false };
+    bool m_forceDumpPixels { false };
     bool m_pixelResultIsPending { false };
     bool m_shouldDumpResourceLoadStatistics { false };
     bool m_canOpenWindows { true };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to