Title: [210446] trunk/Tools
Revision
210446
Author
[email protected]
Date
2017-01-06 10:50:18 -0800 (Fri, 06 Jan 2017)

Log Message

Support webkit-test-runner key-value pairs in http tests
https://bugs.webkit.org/show_bug.cgi?id=149812

Patch by Antoine Quint <[email protected]> on 2017-01-06
Reviewed by Alex Christensen.

We pass the absolute path for a test through to WKTR so that we can parse
tests that are running as URLs for webkit-test-runner options.

* DumpRenderTree/DumpRenderTreeCommon.cpp:
(parseInputLine):

Explicitly skip the --absolute-path option in DRT or else we'd crash.

* Scripts/webkitpy/port/driver.py:
(Driver._command_from_driver_input):

Pass the absolute path to the file through the CLI.

* WebKitTestRunner/TestController.cpp:
(WTR::updateTestOptionsFromTestHeader):
(WTR::TestController::testOptionsForTest):
(WTR::parseInputLine):
(WTR::TestController::runTest):
* WebKitTestRunner/TestController.h:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (210445 => 210446)


--- trunk/Tools/ChangeLog	2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/ChangeLog	2017-01-06 18:50:18 UTC (rev 210446)
@@ -1,3 +1,30 @@
+2017-01-06  Antoine Quint  <[email protected]>
+
+        Support webkit-test-runner key-value pairs in http tests
+        https://bugs.webkit.org/show_bug.cgi?id=149812
+
+        Reviewed by Alex Christensen.
+
+        We pass the absolute path for a test through to WKTR so that we can parse
+        tests that are running as URLs for webkit-test-runner options.
+
+        * DumpRenderTree/DumpRenderTreeCommon.cpp:
+        (parseInputLine):
+
+        Explicitly skip the --absolute-path option in DRT or else we'd crash.
+
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._command_from_driver_input):
+
+        Pass the absolute path to the file through the CLI.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::updateTestOptionsFromTestHeader):
+        (WTR::TestController::testOptionsForTest):
+        (WTR::parseInputLine):
+        (WTR::TestController::runTest):
+        * WebKitTestRunner/TestController.h:
+
 2017-01-06  Tim Horton  <[email protected]>
 
         Warning about unconnectable outlets when opening a MiniBrowser window

Modified: trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp (210445 => 210446)


--- trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp	2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp	2017-01-06 18:50:18 UTC (rev 210446)
@@ -104,6 +104,8 @@
                 result.expectedPixelHash = tokenizer.next();
         } else if (arg == "--dump-jsconsolelog-in-stderr")
             result.dumpJSConsoleLogInStdErr = true;
+        else if (arg == std::string("--absolutePath"))
+            tokenizer.next();
         else
             die(inputLine);
     }

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (210445 => 210446)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2017-01-06 18:50:18 UTC (rev 210446)
@@ -474,6 +474,8 @@
             command = driver_input.test_name
         elif self.is_web_platform_test(driver_input.test_name) or (self.is_http_test(driver_input.test_name) and (self._port.get_option('webkit_test_runner') or sys.platform == "cygwin")):
             command = self.test_to_uri(driver_input.test_name)
+            command += "'--absolutePath'"
+            command += self._port.abspath_for_test(driver_input.test_name)
         else:
             command = self._port.abspath_for_test(driver_input.test_name)
             if sys.platform == 'cygwin':

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (210445 => 210446)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-01-06 18:50:18 UTC (rev 210446)
@@ -920,11 +920,15 @@
     return false;
 }
 
-static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std::string& pathOrURL)
+static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std::string& pathOrURL, const std::string& absolutePath)
 {
-    // Gross. Need to reduce conversions between all the string types and URLs.
-    WKRetainPtr<WKURLRef> wkURL(AdoptWK, createTestURL(pathOrURL.c_str()));
-    std::string filename = testPath(wkURL.get());
+    std::string filename = absolutePath;
+    if (filename.empty()) {
+        // Gross. Need to reduce conversions between all the string types and URLs.
+        WKRetainPtr<WKURLRef> wkURL(AdoptWK, createTestURL(pathOrURL.c_str()));
+        filename = testPath(wkURL.get());
+    }
+
     if (filename.empty())
         return;
 
@@ -982,15 +986,15 @@
     }
 }
 
-TestOptions TestController::testOptionsForTest(const std::string& pathOrURL) const
+TestOptions TestController::testOptionsForTest(const TestCommand& command) const
 {
-    TestOptions options(pathOrURL);
+    TestOptions options(command.pathOrURL);
 
     options.useRemoteLayerTree = m_shouldUseRemoteLayerTree;
     options.shouldShowWebView = m_shouldShowWebView;
 
-    updatePlatformSpecificTestOptionsForTest(options, pathOrURL);
-    updateTestOptionsFromTestHeader(options, pathOrURL);
+    updatePlatformSpecificTestOptionsForTest(options, command.pathOrURL);
+    updateTestOptionsFromTestHeader(options, command.pathOrURL, command.absolutePath);
 
     return options;
 }
@@ -1021,14 +1025,6 @@
     platformConfigureViewForTest(test);
 }
 
-struct TestCommand {
-    std::string pathOrURL;
-    bool shouldDumpPixels { false };
-    std::string expectedPixelHash;
-    int timeout { 0 };
-    bool dumpJSConsoleLogInStdErr { false };
-};
-
 class CommandTokenizer {
 public:
     explicit CommandTokenizer(const std::string& input)
@@ -1101,6 +1097,8 @@
                 result.expectedPixelHash = tokenizer.next();
         } else if (arg == std::string("--dump-jsconsolelog-in-stderr"))
             result.dumpJSConsoleLogInStdErr = true;
+        else if (arg == std::string("--absolutePath"))
+            result.absolutePath = tokenizer.next();
         else
             die(inputLine);
     }
@@ -1114,7 +1112,7 @@
 
     m_state = RunningTest;
     
-    TestOptions options = testOptionsForTest(command.pathOrURL);
+    TestOptions options = testOptionsForTest(command);
 
     WKRetainPtr<WKURLRef> wkURL(AdoptWK, createTestURL(command.pathOrURL.c_str()));
     m_currentInvocation = std::make_unique<TestInvocation>(wkURL.get(), options);

Modified: trunk/Tools/WebKitTestRunner/TestController.h (210445 => 210446)


--- trunk/Tools/WebKitTestRunner/TestController.h	2017-01-06 18:48:29 UTC (rev 210445)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2017-01-06 18:50:18 UTC (rev 210446)
@@ -44,6 +44,7 @@
 class OriginSettings;
 class PlatformWebView;
 class EventSenderProxy;
+struct TestCommand;
 struct TestOptions;
 
 // FIXME: Rename this TestRunner?
@@ -177,7 +178,7 @@
     void initializeTestPluginDirectory();
 
     void ensureViewSupportsOptionsForTest(const TestInvocation&);
-    TestOptions testOptionsForTest(const std::string& pathOrURL) const;
+    TestOptions testOptionsForTest(const TestCommand&) const;
     void updatePlatformSpecificTestOptionsForTest(TestOptions&, const std::string& pathOrURL) const;
 
     void updateWebViewSizeForTest(const TestInvocation&);
@@ -353,6 +354,15 @@
     WorkQueueManager m_workQueueManager;
 };
 
+struct TestCommand {
+    std::string pathOrURL;
+    std::string absolutePath;
+    bool shouldDumpPixels { false };
+    std::string expectedPixelHash;
+    int timeout { 0 };
+    bool dumpJSConsoleLogInStdErr { false };
+};
+
 } // namespace WTR
 
 #endif // TestController_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to