haikuwebkit/Source/WTF/wtf/LoggingAccumulator.h

39 lines
1.6 KiB
C
Raw Permalink Normal View History

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. Source/WebCore: * 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: Source/WTF: 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. Tools: 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: LayoutTests: 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: Canonical link: https://commits.webkit.org/175384@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-02 23:14:01 +00:00
/*
* 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;