Diff
Modified: trunk/LayoutTests/ChangeLog (200345 => 200346)
--- trunk/LayoutTests/ChangeLog 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/LayoutTests/ChangeLog 2016-05-02 23:14:01 UTC (rev 200346)
@@ -1,3 +1,18 @@
+2016-05-02 Brady Eidson <beid...@apple.com>
+
+ Add the ability to accumulate logs for specific logging channels to help diagnose test timeouts.
+ https://bugs.webkit.org/show_bug.cgi?id=157274
+
+ Reviewed by Alex Christensen.
+
+ For the tests that are known flakes that are not imported, add the "accumulate IndexedDB logs" command.
+
+ * storage/indexeddb/modern/resources/256-open-databases.js:
+ * storage/indexeddb/modern/resources/abort-requests-cancelled.js:
+ * storage/indexeddb/modern/resources/autoincrement-abort.js:
+ * storage/indexeddb/resources/intversion-open-in-upgradeneeded.js:
+ * storage/indexeddb/resources/odd-strings.js:
+
2016-05-02 Per Arne Vollan <pe...@outlook.com>
[Win] Enable IndexedDB.
Modified: trunk/LayoutTests/storage/indexeddb/modern/resources/256-open-databases.js (200345 => 200346)
--- trunk/LayoutTests/storage/indexeddb/modern/resources/256-open-databases.js 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/256-open-databases.js 2016-05-02 23:14:01 UTC (rev 200346)
@@ -1,5 +1,8 @@
description("This test makes sure that if you open 128 unique databases, close your connections to them, and then open 128 other unique databases, that it works.");
+if (window.testRunner)
+ testRunner.accummulateLogsForChannel("IndexedDB");
+
var databaseConnections = new Array;
for (var i = 0; i < 128; ++i) {
Modified: trunk/LayoutTests/storage/indexeddb/modern/resources/abort-requests-cancelled.js (200345 => 200346)
--- trunk/LayoutTests/storage/indexeddb/modern/resources/abort-requests-cancelled.js 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/abort-requests-cancelled.js 2016-05-02 23:14:01 UTC (rev 200346)
@@ -1,8 +1,10 @@
description("This test makes sure that un-handled requests in a transaction receive onerror callbacks when the transaction is aborted.");
+if (window.testRunner)
+ testRunner.accummulateLogsForChannel("IndexedDB");
+
indexedDBTest(prepareDatabase);
-
function done()
{
finishJSTest();
Modified: trunk/LayoutTests/storage/indexeddb/modern/resources/autoincrement-abort.js (200345 => 200346)
--- trunk/LayoutTests/storage/indexeddb/modern/resources/autoincrement-abort.js 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/autoincrement-abort.js 2016-05-02 23:14:01 UTC (rev 200346)
@@ -3,9 +3,11 @@
But it then aborts that transaction. \
Then it opens a new one and puts something in it, double checking that the key generator was reverted when the above transaction was aborted.");
+if (window.testRunner)
+ testRunner.accummulateLogsForChannel("IndexedDB");
+
indexedDBTest(prepareDatabase);
-
function done()
{
finishJSTest();
Modified: trunk/LayoutTests/storage/indexeddb/resources/intversion-open-in-upgradeneeded.js (200345 => 200346)
--- trunk/LayoutTests/storage/indexeddb/resources/intversion-open-in-upgradeneeded.js 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/LayoutTests/storage/indexeddb/resources/intversion-open-in-upgradeneeded.js 2016-05-02 23:14:01 UTC (rev 200346)
@@ -5,6 +5,9 @@
description("Test calling db.open in upgradeneeded.");
+if (window.testRunner)
+ testRunner.accummulateLogsForChannel("IndexedDB");
+
function test()
{
removeVendorPrefixes();
Modified: trunk/LayoutTests/storage/indexeddb/resources/odd-strings.js (200345 => 200346)
--- trunk/LayoutTests/storage/indexeddb/resources/odd-strings.js 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/LayoutTests/storage/indexeddb/resources/odd-strings.js 2016-05-02 23:14:01 UTC (rev 200346)
@@ -5,6 +5,9 @@
description("Test IndexedDB odd value datatypes");
+if (window.testRunner)
+ testRunner.accummulateLogsForChannel("IndexedDB");
+
function test()
{
removeVendorPrefixes();
Modified: trunk/Source/WTF/ChangeLog (200345 => 200346)
--- trunk/Source/WTF/ChangeLog 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WTF/ChangeLog 2016-05-02 23:14:01 UTC (rev 200346)
@@ -1,3 +1,25 @@
+2016-05-02 Brady Eidson <beid...@apple.com>
+
+ Add the ability to accumulate logs for specific logging channels to help diagnose test timeouts.
+ https://bugs.webkit.org/show_bug.cgi?id=157274
+
+ Reviewed by Alex Christensen.
+
+ This patch changes WTFLog to add the logging string to the logging accumulator if the logging channel says so.
+ It also adds support for using this new accumulation mechanism.
+
+ * WTF.xcodeproj/project.pbxproj:
+
+ * wtf/Assertions.cpp:
+ (WTF::resetAccumulatedLogs):
+ (WTF::getAndResetAccumulatedLogs):
+ * wtf/Assertions.h:
+
+ * wtf/LoggingAccumulator.h: Added. Expose functions to get accumulated logs and to reset the accumulation.
+
+ * wtf/text/WTFString.cpp:
+ (WTF::String::format): Update to handle %@ on CF (Well, really ObjC) platforms.
+
2016-05-02 Per Arne Vollan <pe...@outlook.com>
[Win] Enable IndexedDB.
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (200345 => 200346)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2016-05-02 23:14:01 UTC (rev 200346)
@@ -100,6 +100,7 @@
2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0F118115C85004DBA70 /* RunLoop.cpp */; };
2CDED0F418115C85004DBA70 /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CDED0F218115C85004DBA70 /* RunLoop.h */; };
430B47891AAAAC1A001223DA /* StringCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 430B47871AAAAC1A001223DA /* StringCommon.h */; };
+ 513E170B1CD7D5BF00E3650B /* LoggingAccumulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 513E170A1CD7D5BF00E3650B /* LoggingAccumulator.h */; };
553071CA1C40427200384898 /* TinyLRUCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 553071C91C40427200384898 /* TinyLRUCache.h */; };
70A993FE1AD7151300FA615B /* SymbolRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70A993FC1AD7151300FA615B /* SymbolRegistry.cpp */; };
70A993FF1AD7151300FA615B /* SymbolRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A993FD1AD7151300FA615B /* SymbolRegistry.h */; };
@@ -411,6 +412,7 @@
2CDED0F118115C85004DBA70 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
2CDED0F218115C85004DBA70 /* RunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoop.h; sourceTree = "<group>"; };
430B47871AAAAC1A001223DA /* StringCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringCommon.h; sourceTree = "<group>"; };
+ 513E170A1CD7D5BF00E3650B /* LoggingAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggingAccumulator.h; sourceTree = "<group>"; };
553071C91C40427200384898 /* TinyLRUCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TinyLRUCache.h; sourceTree = "<group>"; };
5D247B6214689B8600E78B76 /* libWTF.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
5D247B6E14689C4700E78B76 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
@@ -835,6 +837,7 @@
0FE164681B6FFC9600400E7C /* Lock.cpp */,
0FE164691B6FFC9600400E7C /* Lock.h */,
A8A472C3151A825A004123FF /* Locker.h */,
+ 513E170A1CD7D5BF00E3650B /* LoggingAccumulator.h */,
A8A472C6151A825A004123FF /* MainThread.cpp */,
A8A472C7151A825B004123FF /* MainThread.h */,
1A233C7C17DAA6E300A93ACF /* MallocPtr.h */,
@@ -1249,6 +1252,7 @@
A8A47415151A825B004123FF /* RandomNumber.h in Headers */,
A8A47416151A825B004123FF /* RandomNumberSeed.h in Headers */,
0F725CAC1C50461600AD943A /* RangeSet.h in Headers */,
+ 513E170B1CD7D5BF00E3650B /* LoggingAccumulator.h in Headers */,
0F87105A16643F190090B0AD /* RawPointer.h in Headers */,
A8A47417151A825B004123FF /* RedBlackTree.h in Headers */,
26299B6E17A9E5B800ADEBE5 /* Ref.h in Headers */,
Modified: trunk/Source/WTF/wtf/Assertions.cpp (200345 => 200346)
--- trunk/Source/WTF/wtf/Assertions.cpp 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WTF/wtf/Assertions.cpp 2016-05-02 23:14:01 UTC (rev 200346)
@@ -35,14 +35,18 @@
#include "Assertions.h"
#include "Compiler.h"
+#include <mutex>
+#include <stdio.h>
+#include <string.h>
+#include <wtf/Lock.h>
+#include <wtf/Locker.h>
+#include <wtf/LoggingAccumulator.h>
#include <wtf/StdLibExtras.h>
#include <wtf/StringExtras.h>
#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
-#include <stdio.h>
-#include <string.h>
-
#if HAVE(SIGNAL_H)
#include <signal.h>
#endif
@@ -76,6 +80,14 @@
extern "C" {
+static void logToStderr(const char* buffer)
+{
+#if USE(APPLE_SYSTEM_LOG)
+ asl_log(0, 0, ASL_LEVEL_NOTICE, "%s", buffer);
+#endif
+ fputs(buffer, stderr);
+}
+
WTF_ATTRIBUTE_PRINTF(1, 0)
static void vprintf_stderr_common(const char* format, va_list args)
{
@@ -96,10 +108,7 @@
CFStringGetCString(str, buffer, length, kCFStringEncodingUTF8);
-#if USE(APPLE_SYSTEM_LOG)
- asl_log(0, 0, ASL_LEVEL_NOTICE, "%s", buffer);
-#endif
- fputs(buffer, stderr);
+ logToStderr(buffer);
free(buffer);
CFRelease(str);
@@ -412,15 +421,83 @@
printCallSite(file, line, function);
}
+class WTFLoggingAccumulator {
+public:
+ void accumulate(const String&);
+ void resetAccumulatedLogs();
+ String getAndResetAccumulatedLogs();
+
+private:
+ Lock accumulatorLock;
+ StringBuilder loggingAccumulator;
+};
+
+void WTFLoggingAccumulator::accumulate(const String& log)
+{
+ Locker<Lock> locker(accumulatorLock);
+ loggingAccumulator.append(log);
+}
+
+void WTFLoggingAccumulator::resetAccumulatedLogs()
+{
+ Locker<Lock> locker(accumulatorLock);
+ loggingAccumulator.clear();
+}
+
+String WTFLoggingAccumulator::getAndResetAccumulatedLogs()
+{
+ Locker<Lock> locker(accumulatorLock);
+ String result = loggingAccumulator.toString();
+ loggingAccumulator.clear();
+ return result;
+}
+
+static WTFLoggingAccumulator& loggingAccumulator()
+{
+ static WTFLoggingAccumulator* accumulator;
+ static std::once_flag initializeAccumulatorOnce;
+ std::call_once(initializeAccumulatorOnce, [] {
+ accumulator = new WTFLoggingAccumulator;
+ });
+
+ return *accumulator;
+}
+
void WTFLog(WTFLogChannel* channel, const char* format, ...)
{
- if (channel->state != WTFLogChannelOn)
+ if (channel->state == WTFLogChannelOff)
return;
+ if (channel->state == WTFLogChannelOn) {
+ va_list args;
+ va_start(args, format);
+ vprintf_stderr_with_trailing_newline(format, args);
+ va_end(args);
+ return;
+ }
+
+ ASSERT(channel->state == WTFLogChannelOnWithAccumulation);
+
va_list args;
va_start(args, format);
- vprintf_stderr_with_trailing_newline(format, args);
+
+#if COMPILER(CLANG)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
+ String loggingString = String::format(format, args);
+#if COMPILER(CLANG)
+#pragma clang diagnostic pop
+#endif
+
va_end(args);
+
+ if (!loggingString.endsWith('\n'))
+ loggingString.append('\n');
+
+ loggingAccumulator().accumulate(loggingString);
+
+ logToStderr(loggingString.utf8().data());
}
void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...)
@@ -430,7 +507,16 @@
va_list args;
va_start(args, format);
- vprintf_stderr_with_trailing_newline(format, args);
+
+#if COMPILER(CLANG)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
+ WTFLog(channel, format, args);
+#if COMPILER(CLANG)
+#pragma clang diagnostic pop
+#endif
+
va_end(args);
printCallSite(file, line, function);
@@ -503,3 +589,17 @@
}
} // extern "C"
+
+namespace WTF {
+
+void resetAccumulatedLogs()
+{
+ loggingAccumulator().resetAccumulatedLogs();
+}
+
+String getAndResetAccumulatedLogs()
+{
+ return loggingAccumulator().getAndResetAccumulatedLogs();
+}
+
+} // namespace WTF
Modified: trunk/Source/WTF/wtf/Assertions.h (200345 => 200346)
--- trunk/Source/WTF/wtf/Assertions.h 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WTF/wtf/Assertions.h 2016-05-02 23:14:01 UTC (rev 200346)
@@ -130,7 +130,7 @@
#define NO_RETURN_DUE_TO_CRASH
#endif
-typedef enum { WTFLogChannelOff, WTFLogChannelOn } WTFLogChannelState;
+typedef enum { WTFLogChannelOff, WTFLogChannelOn, WTFLogChannelOnWithAccumulation } WTFLogChannelState;
typedef struct {
WTFLogChannelState state;
Added: trunk/Source/WTF/wtf/LoggingAccumulator.h (0 => 200346)
--- trunk/Source/WTF/wtf/LoggingAccumulator.h (rev 0)
+++ trunk/Source/WTF/wtf/LoggingAccumulator.h 2016-05-02 23:14:01 UTC (rev 200346)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+WTF_EXPORT_PRIVATE void resetAccumulatedLogs();
+WTF_EXPORT_PRIVATE String getAndResetAccumulatedLogs();
+
+} // namespace WTF
+
+using WTF::resetAccumulatedLogs;
+using WTF::getAndResetAccumulatedLogs;
Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (200345 => 200346)
--- trunk/Source/WTF/wtf/text/WTFString.cpp 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp 2016-05-02 23:14:01 UTC (rev 200346)
@@ -463,6 +463,24 @@
va_list args;
va_start(args, format);
+#if USE(CF) && !OS(WINDOWS)
+ if (strstr(format, "%@")) {
+ RetainPtr<CFStringRef> cfFormat = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, format, kCFStringEncodingUTF8));
+
+#if COMPILER(CLANG)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
+ RetainPtr<CFStringRef> result = adoptCF(CFStringCreateWithFormatAndArguments(kCFAllocatorDefault, nullptr, cfFormat.get(), args));
+#if COMPILER(CLANG)
+#pragma clang diagnostic pop
+#endif
+
+ va_end(args);
+ return result.get();
+ }
+#endif // USE(CF) && !OS(WINDOWS)
+
// Do the format once to get the length.
#if COMPILER(MSVC)
int result = _vscprintf(format, args);
Modified: trunk/Source/WebCore/ChangeLog (200345 => 200346)
--- trunk/Source/WebCore/ChangeLog 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WebCore/ChangeLog 2016-05-02 23:14:01 UTC (rev 200346)
@@ -1,3 +1,22 @@
+2016-05-02 Brady Eidson <beid...@apple.com>
+
+ Add the ability to accumulate logs for specific logging channels to help diagnose test timeouts.
+ https://bugs.webkit.org/show_bug.cgi?id=157274
+
+ Reviewed by Alex Christensen.
+
+ * platform/Logging.cpp:
+ (WebCore::setLogChannelToAccumulate): Set the given log channel to accumulate logging,
+ and dirty the initializeLoggingChannelsIfNecessary flag.
+ (WebCore::initializeLoggingChannelsIfNecessary): Change from being a one-time-only call to a
+ one-time-for-each-time-somebody-calls-setLogChannelToAccumulate call.
+ * platform/Logging.h:
+
+ * testing/js/WebCoreTestSupport.cpp:
+ (WebCoreTestSupport::setLogChannelToAccumulate):
+ (WebCoreTestSupport::initializeLoggingChannelsIfNecessary):
+ * testing/js/WebCoreTestSupport.h:
+
2016-05-02 Simon Fraser <simon.fra...@apple.com>
Sort the project file.
Modified: trunk/Source/WebCore/platform/Logging.cpp (200345 => 200346)
--- trunk/Source/WebCore/platform/Logging.cpp 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WebCore/platform/Logging.cpp 2016-05-02 23:14:01 UTC (rev 200346)
@@ -57,13 +57,25 @@
return channel->state != WTFLogChannelOff;
}
+static bool logChannelsNeedInitialization = true;
+
+void setLogChannelToAccumulate(const String& name)
+{
+ WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
+ if (!channel)
+ return;
+
+ channel->state = WTFLogChannelOnWithAccumulation;
+ logChannelsNeedInitialization = true;
+}
+
void initializeLoggingChannelsIfNecessary()
{
- static bool haveInitializedLoggingChannels = false;
- if (haveInitializedLoggingChannels)
+ if (!logChannelsNeedInitialization)
return;
- haveInitializedLoggingChannels = true;
+ logChannelsNeedInitialization = false;
+
WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, logLevelString().utf8().data());
}
Modified: trunk/Source/WebCore/platform/Logging.h (200345 => 200346)
--- trunk/Source/WebCore/platform/Logging.h 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WebCore/platform/Logging.h 2016-05-02 23:14:01 UTC (rev 200346)
@@ -97,6 +97,7 @@
String logLevelString();
bool isLogChannelEnabled(const String& name);
+WEBCORE_EXPORT void setLogChannelToAccumulate(const String& name);
WEBCORE_EXPORT void initializeLoggingChannelsIfNecessary();
#ifndef NDEBUG
void registerNotifyCallback(const String& notifyID, std::function<void()> callback);
Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp (200345 => 200346)
--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp 2016-05-02 23:14:01 UTC (rev 200346)
@@ -31,6 +31,7 @@
#include "Internals.h"
#include "JSDocument.h"
#include "JSInternals.h"
+#include "Logging.h"
#include "Page.h"
#include "WheelEventTestTrigger.h"
#include <_javascript_Core/APICast.h>
@@ -97,4 +98,20 @@
page->clearTrigger();
}
+void setLogChannelToAccumulate(const String& name)
+{
+#if !LOG_DISABLED
+ WebCore::setLogChannelToAccumulate(name);
+#else
+ UNUSED_PARAM(name);
+#endif
}
+
+void initializeLoggingChannelsIfNecessary()
+{
+#if !LOG_DISABLED
+ WebCore::initializeLoggingChannelsIfNecessary();
+#endif
+}
+
+}
Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.h (200345 => 200346)
--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.h 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.h 2016-05-02 23:14:01 UTC (rev 200346)
@@ -35,6 +35,10 @@
#define TEST_SUPPORT_EXPORT
#endif
+namespace WTF {
+class String;
+}
+
namespace WebCore {
class Frame;
}
@@ -47,6 +51,9 @@
void setTestCallbackAndStartNotificationTimer(WebCore::Frame&, JSContextRef, JSObjectRef) TEST_SUPPORT_EXPORT;
void clearWheelEventTestTrigger(WebCore::Frame&) TEST_SUPPORT_EXPORT;
+void setLogChannelToAccumulate(const WTF::String& name) TEST_SUPPORT_EXPORT;
+void initializeLoggingChannelsIfNecessary() TEST_SUPPORT_EXPORT;
+
} // namespace WebCore
#endif
Modified: trunk/Tools/ChangeLog (200345 => 200346)
--- trunk/Tools/ChangeLog 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Tools/ChangeLog 2016-05-02 23:14:01 UTC (rev 200346)
@@ -1,3 +1,27 @@
+2016-05-02 Brady Eidson <beid...@apple.com>
+
+ Add the ability to accumulate logs for specific logging channels to help diagnose test timeouts.
+ https://bugs.webkit.org/show_bug.cgi?id=157274
+
+ Reviewed by Alex Christensen.
+
+ Add the new accumulate method to DRT's TestRunner, dump the accumulated logs if there's a timeout,
+ and reset them in between tests:
+ * DumpRenderTree/TestRunner.cpp:
+ (accummulateLogsForChannel):
+ (TestRunner::staticFunctions):
+ (TestRunner::waitToDumpWatchdogTimerFired):
+ (TestRunner::setAccummulateLogsForChannel):
+ * DumpRenderTree/TestRunner.h:
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetWebViewToConsistentStateBeforeTesting):
+
+ Also add the new method to WKTR's TestRunner, but just stubbed for now:
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::accummulateLogsForChannel):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
2016-05-02 Srinivasan Vijayaraghavan <svijayaragha...@apple.com>
Add fail-fast option to run-_javascript_core-tests
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (200345 => 200346)
--- trunk/Tools/DumpRenderTree/TestRunner.cpp 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp 2016-05-02 23:14:01 UTC (rev 200346)
@@ -30,6 +30,7 @@
#include "config.h"
#include "TestRunner.h"
+#include "WebCoreTestSupport.h"
#include "WorkQueue.h"
#include "WorkQueueItem.h"
#include <_javascript_Core/APICast.h>
@@ -37,6 +38,7 @@
#include <_javascript_Core/JSCTestRunnerUtils.h>
#include <_javascript_Core/JSObjectRef.h>
#include <_javascript_Core/JSRetainPtr.h>
+#include <WebCore/Logging.h>
#include <cstring>
#include <locale.h>
#include <runtime/ArrayBufferView.h>
@@ -45,9 +47,11 @@
#include <stdio.h>
#include <wtf/Assertions.h>
#include <wtf/CurrentTime.h>
+#include <wtf/LoggingAccumulator.h>
#include <wtf/MathExtras.h>
#include <wtf/RefPtr.h>
#include <wtf/StdLibExtras.h>
+#include <wtf/text/WTFString.h>
#if PLATFORM(MAC) && !PLATFORM(IOS)
#include <Carbon/Carbon.h>
@@ -1968,6 +1972,20 @@
return JSC::setNeverInline(context, arguments[0]);
}
+static JSValueRef accummulateLogsForChannel(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ JSRetainPtr<JSStringRef> channel(Adopt, JSValueToStringCopy(context, arguments[0], exception));
+ ASSERT(!*exception);
+
+ TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+ controller->setAccummulateLogsForChannel(channel.get());
+
+ return JSValueMakeUndefined(context);
+}
+
static void testRunnerObjectFinalize(JSObjectRef object)
{
TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(object));
@@ -2172,6 +2190,7 @@
{ "failNextNewCodeBlock", failNextNewCodeBlock, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "numberOfDFGCompiles", numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "neverInlineFunction", neverInlineFunction, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "accummulateLogsForChannel", accummulateLogsForChannel, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
@@ -2222,6 +2241,13 @@
{
const char* message = "FAIL: Timed out waiting for notifyDone to be called\n";
fprintf(stdout, "%s", message);
+
+ auto accumulatedLogs = getAndResetAccumulatedLogs();
+ if (!accumulatedLogs.isEmpty()) {
+ const char* message = "Logs accumulated during test run:\n";
+ fprintf(stdout, "%s%s\n", message, accumulatedLogs.utf8().data());
+ }
+
notifyDone();
}
@@ -2252,3 +2278,12 @@
{
m_shouldPaintBrokenImage = shouldPaintBrokenImage;
}
+
+void TestRunner::setAccummulateLogsForChannel(JSStringRef channel)
+{
+ size_t maxLength = JSStringGetMaximumUTF8CStringSize(channel);
+ auto buffer = std::make_unique<char[]>(maxLength + 1);
+ JSStringGetUTF8CString(channel, buffer.get(), maxLength + 1);
+
+ WebCoreTestSupport::setLogChannelToAccumulate({ buffer.get() });
+}
Modified: trunk/Tools/DumpRenderTree/TestRunner.h (200345 => 200346)
--- trunk/Tools/DumpRenderTree/TestRunner.h 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Tools/DumpRenderTree/TestRunner.h 2016-05-02 23:14:01 UTC (rev 200346)
@@ -135,6 +135,8 @@
void setTextAutosizingEnabled(bool);
#endif
+ void setAccummulateLogsForChannel(JSStringRef);
+
// Legacy here refers to the old TestRunner API for handling web notifications, not the legacy web notification API.
void ignoreLegacyWebNotificationPermissionRequests();
// Legacy here refers to the old TestRunner API for handling web notifications, not the legacy web notification API.
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (200345 => 200346)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2016-05-02 23:14:01 UTC (rev 200346)
@@ -58,6 +58,7 @@
#import <CoreFoundation/CoreFoundation.h>
#import <_javascript_Core/HeapStatistics.h>
#import <_javascript_Core/Options.h>
+#import <WebCore/Logging.h>
#import <WebKit/DOMElement.h>
#import <WebKit/DOMExtensions.h>
#import <WebKit/DOMRange.h>
@@ -86,6 +87,7 @@
#import <getopt.h>
#import <wtf/Assertions.h>
#import <wtf/FastMalloc.h>
+#import <wtf/LoggingAccumulator.h>
#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/RetainPtr.h>
#import <wtf/Threading.h>
@@ -1894,6 +1896,9 @@
#endif
[mainFrame _clearOpener];
+
+ resetAccumulatedLogs();
+ WebCoreTestSupport::initializeLoggingChannelsIfNecessary();
}
#if PLATFORM(IOS)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (200345 => 200346)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2016-05-02 23:14:01 UTC (rev 200346)
@@ -223,5 +223,7 @@
void runUIScript(DOMString script, object callback);
void clearTestRunnerCallbacks();
+
+ void accummulateLogsForChannel(DOMString channel);
};
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (200345 => 200346)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2016-05-02 23:14:01 UTC (rev 200346)
@@ -601,6 +601,11 @@
callbackMap().clear();
}
+void TestRunner::accummulateLogsForChannel(JSStringRef)
+{
+ // FIXME: Implement getting the call to all processes.
+}
+
void TestRunner::addChromeInputField(JSValueRef callback)
{
cacheTestRunnerCallback(AddChromeInputFieldCallbackID, callback);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (200345 => 200346)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2016-05-02 23:07:21 UTC (rev 200345)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2016-05-02 23:14:01 UTC (rev 200346)
@@ -320,6 +320,8 @@
void clearTestRunnerCallbacks();
+ void accummulateLogsForChannel(JSStringRef channel);
+
private:
TestRunner();