Add mechanism for enabling internal and experimental features from run-webkit-test...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Nov 2019 18:54:17 +0000 (18:54 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Nov 2019 18:54:17 +0000 (18:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=204702

Reviewed by Antoine Quint.

Add --internal-feature and --experimental-feature flags to TestRunner and run-webkit-tests.
This is useful for running existing tests with different feature enabled without modifying
anything else. For example:

run-webkit-tests --internal-feature LayoutFormattingContextRenderTreeIntegrationEnabled

* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
* Scripts/webkitpy/port/base.py:
(Port.internal_feature):
(Port):
(Port.experimental_feature):
* Scripts/webkitpy/port/driver.py:
(Driver.cmd_line):
* WebKitTestRunner/Options.cpp:
(WTR::handleOptionExperimentalFeature):
(WTR::handleOptionInternalFeature):
(WTR::OptionsHandler::OptionsHandler):
* WebKitTestRunner/Options.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
(WTR::TestController::testOptionsForTest const):
* WebKitTestRunner/TestController.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252948 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
Tools/Scripts/webkitpy/port/base.py
Tools/Scripts/webkitpy/port/driver.py
Tools/WebKitTestRunner/Options.cpp
Tools/WebKitTestRunner/Options.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h

index 0319d1f..23a7404 100644 (file)
@@ -1,3 +1,34 @@
+2019-11-29  Antti Koivisto  <antti@apple.com>
+
+        Add mechanism for enabling internal and experimental features from run-webkit-test command line
+        https://bugs.webkit.org/show_bug.cgi?id=204702
+
+        Reviewed by Antoine Quint.
+
+        Add --internal-feature and --experimental-feature flags to TestRunner and run-webkit-tests.
+        This is useful for running existing tests with different feature enabled without modifying
+        anything else. For example:
+
+        run-webkit-tests --internal-feature LayoutFormattingContextRenderTreeIntegrationEnabled
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (parse_args):
+        * Scripts/webkitpy/port/base.py:
+        (Port.internal_feature):
+        (Port):
+        (Port.experimental_feature):
+        * Scripts/webkitpy/port/driver.py:
+        (Driver.cmd_line):
+        * WebKitTestRunner/Options.cpp:
+        (WTR::handleOptionExperimentalFeature):
+        (WTR::handleOptionInternalFeature):
+        (WTR::OptionsHandler::OptionsHandler):
+        * WebKitTestRunner/Options.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+        (WTR::TestController::testOptionsForTest const):
+        * WebKitTestRunner/TestController.h:
+
 2019-11-29  Aakash Jain  <aakash_jain@apple.com>
 
         Add a unit-test to new EWS for scenario when there is flakiness with patch and also on clean tree
index e8470e9..185d84c 100755 (executable)
@@ -118,6 +118,10 @@ def parse_args(args):
             help="Use accelerated drawing (OS X only)"),
         optparse.make_option("--remote-layer-tree", action="store_true", default=False,
             help="Use the remote layer tree drawing model (OS X WebKit2 only)"),
+        optparse.make_option("--internal-feature", type="string", action="append",
+            default=[], help="Enable internal feature"),
+        optparse.make_option("--experimental-feature", type="string", action="append",
+            default=[], help="Enable experimental feature"),
     ]))
 
     option_group_definitions.append(("WebKit Options", [
index 272b76c..c74fa35 100644 (file)
@@ -1193,6 +1193,12 @@ class Port(object):
     def allowed_hosts(self):
         return self.get_option("allowed_host", [])
 
+    def internal_feature(self):
+        return self.get_option("internal_feature", [])
+
+    def experimental_feature(self):
+        return self.get_option("experimental_feature", [])
+
     def default_configuration(self):
         return self._config.default_configuration()
 
index 2a59838..db0e47a 100644 (file)
@@ -523,6 +523,14 @@ class Driver(object):
             cmd.append('--allowed-host')
             cmd.append(allowed_host)
 
+        for feature in self._port.internal_feature():
+            cmd.append('--internal-feature')
+            cmd.append(feature)
+
+        for feature in self._port.experimental_feature():
+            cmd.append('--experimental-feature')
+            cmd.append(feature)
+
         cmd.extend(self._port.get_option('additional_drt_flag', []))
         cmd.extend(self._port.additional_drt_flag())
 
index bc63ed2..828c1c9 100644 (file)
@@ -105,6 +105,18 @@ static bool handleOptionAllowedHost(Options& options, const char*, const char* h
     return true;
 }
 
+static bool handleOptionExperimentalFeature(Options& options, const char*, const char* feature)
+{
+    options.experimentalFeatures.insert(feature);
+    return true;
+}
+
+static bool handleOptionInternalFeature(Options& options, const char*, const char* feature)
+{
+    options.internalFeatures.insert(feature);
+    return true;
+}
+
 static bool handleOptionUnmatched(Options& options, const char* option, const char*)
 {
     if (option[0] && option[1] && option[0] == '-' && option[1] == '-')
@@ -129,6 +141,8 @@ OptionsHandler::OptionsHandler(Options& o)
     optionList.append(Option("--show-webview", "Show the WebView during test runs (for debugging)", handleOptionShowWebView));
     optionList.append(Option("--show-touches", "Show the touches during test runs (for debugging)", handleOptionShowTouches));
     optionList.append(Option("--world-leaks", "Check for leaks of world objects (currently, documents)", handleOptionCheckForWorldLeaks));
+    optionList.append(Option("--experimental-feature", "Enable experimental feature", handleOptionExperimentalFeature, true));
+    optionList.append(Option("--internal-feature", "Enable internal feature", handleOptionInternalFeature, true));
 
     optionList.append(Option(0, 0, handleOptionUnmatched));
 }
index 46ecb39..58fcd60 100644 (file)
@@ -51,6 +51,8 @@ struct Options {
     bool allowAnyHTTPSCertificateForAllowedHosts { false };
     std::vector<std::string> paths;
     std::set<std::string> allowedHosts;
+    std::set<std::string> internalFeatures;
+    std::set<std::string> experimentalFeatures;
 };
 
 class Option {
index 80582c4..f21e89b 100644 (file)
@@ -472,6 +472,8 @@ void TestController::initialize(int argc, const char* argv[])
     m_shouldShowTouches = options.shouldShowTouches;
     m_checkForWorldLeaks = options.checkForWorldLeaks;
     m_allowAnyHTTPSCertificateForAllowedHosts = options.allowAnyHTTPSCertificateForAllowedHosts;
+    m_internalFeatures = options.internalFeatures;
+    m_experimentalFeatures = options.experimentalFeatures;
 
     m_usingServerMode = (m_paths.size() == 1 && m_paths[0] == "-");
     if (m_usingServerMode)
@@ -1453,6 +1455,11 @@ TestOptions TestController::testOptionsForTest(const TestCommand& command) const
     options.useRemoteLayerTree = m_shouldUseRemoteLayerTree;
     options.shouldShowWebView = m_shouldShowWebView;
 
+    for (auto& feature : m_internalFeatures)
+        options.internalDebugFeatures.add(feature.c_str(), true);
+    for (auto& feature : m_experimentalFeatures)
+        options.experimentalFeatures.add(feature.c_str(), true);
+
     updatePlatformSpecificTestOptionsForTest(options, command.pathOrURL);
     updateTestOptionsFromTestHeader(options, command.pathOrURL, command.absolutePath);
     platformAddTestOptions(options);
index e99d83f..d6cb0e2 100644 (file)
@@ -500,6 +500,9 @@ private:
     bool m_createdOtherPage { false };
     std::vector<std::string> m_paths;
     std::set<std::string> m_allowedHosts;
+    std::set<std::string> m_internalFeatures;
+    std::set<std::string> m_experimentalFeatures;
+
     WKRetainPtr<WKStringRef> m_injectedBundlePath;
     WKRetainPtr<WKStringRef> m_testPluginDirectory;
 
@@ -572,7 +575,7 @@ private:
     bool m_checkForWorldLeaks { false };
 
     bool m_allowAnyHTTPSCertificateForAllowedHosts { false };
-    
+
     bool m_shouldDecideNavigationPolicyAfterDelay { false };
     bool m_shouldDecideResponsePolicyAfterDelay { false };