Diff
Modified: trunk/Tools/ChangeLog (287291 => 287292)
--- trunk/Tools/ChangeLog 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/ChangeLog 2021-12-21 01:31:08 UTC (rev 287292)
@@ -1,3 +1,43 @@
+2021-12-20 Simon Fraser <[email protected]>
+
+ Make it possible to enable log channels in WebKitTestRunner and DumpRenderTree
+ https://bugs.webkit.org/show_bug.cgi?id=234525
+
+ Reviewed by Wenson Hsieh.
+
+ Support a "--WebCoreLogging" argument to DumpRenderTree to enable the WebCore
+ log channels.
+
+ Support "--WebCoreLogging" and "--WebKitLogging" arguments to WebKitTestRunner to enable the WebCore
+ and WebKit log channels.
+
+ DRT requires the double dash format, so I chose to have both use double dashes
+ for consistency (although this is inconsistent with the single dash format used
+ by AppKit and UIKit apps).
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (initializeGlobalsFromCommandLineOptions):
+ (prepareConsistentTestingEnvironment):
+ * WebKitTestRunner/Options.cpp:
+ (WTR::handleOptionLogChannels):
+ (WTR::OptionsHandler::OptionsHandler):
+ * WebKitTestRunner/Options.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::initialize):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::TestController::cocoaPlatformInitialize):
+ * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+ (WTR::TestController::platformInitialize):
+ * WebKitTestRunner/ios/TestControllerIOS.mm:
+ (WTR::TestController::platformInitialize):
+ * WebKitTestRunner/mac/TestControllerMac.mm:
+ (WTR::TestController::platformInitialize):
+ * WebKitTestRunner/win/TestControllerWin.cpp:
+ (WTR::TestController::platformInitialize):
+ * WebKitTestRunner/wpe/TestControllerWPE.cpp:
+ (WTR::TestController::platformInitialize):
+
2021-12-20 Dewei Zhu <[email protected]>
'run-benchmark' should launch browsers in a relative clean state.
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (287291 => 287292)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2021-12-21 01:31:08 UTC (rev 287292)
@@ -273,6 +273,8 @@
static int printTestCount;
static int checkForWorldLeaks;
static BOOL printSeparators;
+static std::set<std::string> allowedHosts;
+static std::string webCoreLogging;
static RetainPtr<CFStringRef>& persistentUserStyleSheetLocation()
{
@@ -280,8 +282,6 @@
return persistentUserStyleSheetLocation;
}
-static std::set<std::string> allowedHosts;
-
static RetainPtr<WebHistoryItem>& prevTestBFItem()
{
static NeverDestroyed<RetainPtr<WebHistoryItem>> _prevTestBFItem; // current b/f item at the end of the previous test.
@@ -1005,6 +1005,7 @@
{"show-webview", no_argument, &showWebView, YES},
{"print-test-count", no_argument, &printTestCount, YES},
{"world-leaks", no_argument, &checkForWorldLeaks, NO},
+ {"webcore-logging", required_argument, nullptr, 'w'},
{nullptr, 0, nullptr, 0}
};
@@ -1018,6 +1019,8 @@
case 'a': // "allowed-host"
allowedHosts.insert(optarg);
break;
+ case 'w': // "webcore-logging"
+ webCoreLogging = optarg;
}
}
}
@@ -1125,6 +1128,9 @@
static NeverDestroyed<RetainPtr<id>> assertion = [[NSProcessInfo processInfo] beginActivityWithOptions:options reason:@"DumpRenderTree should not be subject to process suppression"];
ASSERT_UNUSED(assertion, assertion.get());
#endif
+
+ if (webCoreLogging.length())
+ [[NSUserDefaults standardUserDefaults] setValue:[NSString stringWithUTF8String:webCoreLogging.c_str()] forKey:@"WebCoreLogging"];
}
const char crashedMessage[] = "#CRASHED\n";
Modified: trunk/Tools/WebKitTestRunner/Options.cpp (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/Options.cpp 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/Options.cpp 2021-12-21 01:31:08 UTC (rev 287292)
@@ -144,6 +144,18 @@
return parseFeature(feature, options.features);
}
+static bool handleOptionWebCoreLogging(Options& options, const char*, const char* channels)
+{
+ options.webCoreLogChannels = channels;
+ return true;
+}
+
+static bool handleOptionWebKitLogging(Options& options, const char*, const char* channels)
+{
+ options.webKitLogChannels = channels;
+ return true;
+}
+
static bool handleOptionUnmatched(Options& options, const char* option, const char*)
{
if (option[0] && option[1] && option[0] == '-' && option[1] == '-')
@@ -175,6 +187,8 @@
#if ENABLE(ACCESSIBILITY_ISOLATED_TREE)
optionList.append(Option("--accessibility-isolated-tree", "Enable accessibility isolated tree mode for tests", handleOptionAccessibilityIsolatedTreeMode));
#endif
+ optionList.append(Option("--webcore-logging", "Enable WebCore log channels", handleOptionWebCoreLogging, true));
+ optionList.append(Option("--webkit-logging", "Enable WebKit log channels", handleOptionWebKitLogging, true));
optionList.append(Option(0, 0, handleOptionUnmatched));
}
Modified: trunk/Tools/WebKitTestRunner/Options.h (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/Options.h 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/Options.h 2021-12-21 01:31:08 UTC (rev 287292)
@@ -52,6 +52,8 @@
bool enableAllExperimentalFeatures { true };
std::vector<std::string> paths;
std::set<std::string> allowedHosts;
+ std::string webCoreLogChannels;
+ std::string webKitLogChannels;
TestFeatures features;
};
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2021-12-21 01:31:08 UTC (rev 287292)
@@ -528,8 +528,6 @@
WTF::setProcessPrivileges(allPrivileges());
WebCoreTestSupport::populateJITOperations();
- platformInitialize();
-
Options options;
OptionsHandler optionsHandler(options);
@@ -540,6 +538,8 @@
if (!optionsHandler.parse(argc, argv))
exit(1);
+ platformInitialize(options);
+
m_useWaitToDumpWatchdogTimer = options.useWaitToDumpWatchdogTimer;
m_forceNoTimeout = options.forceNoTimeout;
m_verbose = options.verbose;
Modified: trunk/Tools/WebKitTestRunner/TestController.h (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/TestController.h 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2021-12-21 01:31:08 UTC (rev 287292)
@@ -56,6 +56,7 @@
class PlatformWebView;
class TestInvocation;
class TestOptions;
+struct Options;
struct TestCommand;
class AsyncTask {
@@ -384,7 +385,7 @@
bool handleControlCommand(const char* command);
- void platformInitialize();
+ void platformInitialize(const Options&);
void platformInitializeDataStore(WKPageConfigurationRef, const TestOptions&);
void platformDestroy();
WKContextRef platformAdjustContext(WKContextRef, WKContextConfigurationRef);
@@ -396,7 +397,7 @@
bool platformResetStateToConsistentValues(const TestOptions&);
#if PLATFORM(COCOA)
- void cocoaPlatformInitialize();
+ void cocoaPlatformInitialize(const Options&);
void cocoaResetStateToConsistentValues(const TestOptions&);
void setApplicationBundleIdentifier(const std::string&);
void clearApplicationBundleIdentifierTestingOverride();
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2021-12-21 01:31:08 UTC (rev 287292)
@@ -27,6 +27,7 @@
#import "TestController.h"
#import "CrashReporterInfo.h"
+#import "Options.h"
#import "PlatformWebView.h"
#import "StringFunctions.h"
#import "TestInvocation.h"
@@ -103,7 +104,7 @@
}();
}
-void TestController::cocoaPlatformInitialize()
+void TestController::cocoaPlatformInitialize(const Options& options)
{
const char* dumpRenderTreeTemp = libraryPathForTesting();
if (!dumpRenderTreeTemp)
@@ -115,6 +116,12 @@
NSDictionary *resourceLogPlist = @{ @"version": @(1) };
if (![resourceLogPlist writeToFile:fullBrowsingSessionResourceLog atomically:YES])
WTFCrash();
+
+ if (options.webCoreLogChannels.length())
+ [[NSUserDefaults standardUserDefaults] setValue:[NSString stringWithUTF8String:options.webCoreLogChannels.c_str()] forKey:@"WebCoreLogging"];
+
+ if (options.webKitLogChannels.length())
+ [[NSUserDefaults standardUserDefaults] setValue:[NSString stringWithUTF8String:options.webKitLogChannels.c_str()] forKey:@"WebKitLogging"];
}
WKContextRef TestController::platformContext()
Modified: trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp 2021-12-21 01:31:08 UTC (rev 287292)
@@ -44,7 +44,7 @@
RunLoop::main().stop();
}
-void TestController::platformInitialize()
+void TestController::platformInitialize(const Options&)
{
}
Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2021-12-21 01:31:08 UTC (rev 287292)
@@ -98,10 +98,10 @@
[selectionView _removeAllAnimations:YES];
}
-void TestController::platformInitialize()
+void TestController::platformInitialize(const Options& options)
{
setUpIOSLayoutTestCommunication();
- cocoaPlatformInitialize();
+ cocoaPlatformInitialize(options);
[UIApplication sharedApplication].idleTimerDisabled = YES;
[[UIScreen mainScreen] _setScale:2.0];
Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm 2021-12-21 01:31:08 UTC (rev 287292)
@@ -111,12 +111,12 @@
});
}
-void TestController::platformInitialize()
+void TestController::platformInitialize(const Options& options)
{
poseAsClass("WebKitTestRunnerPasteboard", "NSPasteboard");
poseAsClass("WebKitTestRunnerEvent", "NSEvent");
- cocoaPlatformInitialize();
+ cocoaPlatformInitialize(options);
[NSSound _setAlertType:0];
Modified: trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/win/TestControllerWin.cpp 2021-12-21 01:31:08 UTC (rev 287292)
@@ -104,7 +104,7 @@
{
}
-void TestController::platformInitialize()
+void TestController::platformInitialize(const Options&)
{
// Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
// testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
Modified: trunk/Tools/WebKitTestRunner/wpe/TestControllerWPE.cpp (287291 => 287292)
--- trunk/Tools/WebKitTestRunner/wpe/TestControllerWPE.cpp 2021-12-21 01:31:04 UTC (rev 287291)
+++ trunk/Tools/WebKitTestRunner/wpe/TestControllerWPE.cpp 2021-12-21 01:31:08 UTC (rev 287292)
@@ -44,7 +44,7 @@
{
}
-void TestController::platformInitialize()
+void TestController::platformInitialize(const Options&)
{
}