Changeset 84534 in webkit


Ignore:
Timestamp:
Apr 21, 2011 12:08:53 PM (13 years ago)
Author:
weinig@apple.com
Message:

2011-04-21 Sam Weinig <sam@webkit.org>

Reviewed by Simon Fraser.

Add way to garbage collect between each test when running layout tests
https://bugs.webkit.org/show_bug.cgi?id=59126

  • DumpRenderTree/mac/DumpRenderTree.mm: (initializeGlobalsFromCommandLineOptions): (runTest):
  • Scripts/old-run-webkit-tests:
  • WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::didReceiveMessage):
  • WebKitTestRunner/TestController.cpp: (WTR::TestController::TestController): (WTR::TestController::initialize): (WTR::TestController::resetStateToConsistentValues):
  • WebKitTestRunner/TestController.h:
Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r84525 r84534  
     12011-04-21  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add way to garbage collect between each test when running layout tests
     6        https://bugs.webkit.org/show_bug.cgi?id=59126
     7
     8        * DumpRenderTree/mac/DumpRenderTree.mm:
     9        (initializeGlobalsFromCommandLineOptions):
     10        (runTest):
     11        * Scripts/old-run-webkit-tests:
     12        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     13        (WTR::InjectedBundle::didReceiveMessage):
     14        * WebKitTestRunner/TestController.cpp:
     15        (WTR::TestController::TestController):
     16        (WTR::TestController::initialize):
     17        (WTR::TestController::resetStateToConsistentValues):
     18        * WebKitTestRunner/TestController.h:
     19
    1202011-04-21  Ojan Vafai  <ojan@chromium.org>
    221
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r84104 r84534  
    143143static int dumpTree = YES;
    144144static int forceComplexText;
     145static int gcBetweenTests;
    145146static BOOL printSeparators;
    146147static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
     
    587588        {"threaded", no_argument, &threaded, YES},
    588589        {"complex-text", no_argument, &forceComplexText, YES},
     590        {"gc-between-tests", no_argument, &gcBetweenTests, YES},
    589591        {NULL, 0, NULL, 0}
    590592    };
     
    12031205    if (ignoreWebCoreNodeLeaks)
    12041206        [WebCoreStatistics stopIgnoringWebCoreNodeLeaks];
     1207
     1208    if (gcBetweenTests)
     1209        [WebCoreStatistics garbageCollectJavaScriptObjects];
    12051210}
    12061211
  • trunk/Tools/Scripts/old-run-webkit-tests

    r84377 r84534  
    167167my $testsPerDumpTool = 1000;
    168168my $threaded = 0;
     169my $gcBetweenTests = 0;
    169170# DumpRenderTree has an internal timeout of 30 seconds, so this must be > 30.
    170171my $timeoutSeconds = 35;
     
    282283  --complex-text                  Use the complex text code path for all text (Mac OS X and Windows only)
    283284  -c|--configuration config       Set DumpRenderTree build configuration
     285  --gc-between-tests              Force garbage collection between each test
    284286  -g|--guard-malloc               Enable malloc guard
    285287  --exit-after-n-failures N       Exit after the first N failures (includes crashes) instead of running all tests
     
    332334    'exit-after-n-failures=i' => \$exitAfterNFailures,
    333335    'exit-after-n-crashes-or-timeouts=i' => \$exitAfterNCrashesOrTimeouts,
     336    'gc-between-tests' => \$gcBetweenTests,
    334337    'guard-malloc|g' => \$guardMalloc,
    335338    'help|h' => \$showHelp,
     
    644647push @toolArgs, "--threaded" if $threaded;
    645648push @toolArgs, "--complex-text" if $complexText;
     649push @toolArgs, "--gc-between-tests" if $gcBetweenTests;
    646650push @toolArgs, "-";
    647651
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r82649 r84534  
    142142        return;
    143143    } else if (WKStringIsEqualToUTF8CString(messageName, "Reset")) {
     144        ASSERT(messageBody);
     145        ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
     146        WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
     147
     148        WKRetainPtr<WKStringRef> shouldGCKey(AdoptWK, WKStringCreateWithUTF8CString("ShouldGC"));
     149        bool shouldGC = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, shouldGCKey.get())));
     150
     151        if (shouldGC)
     152            WKBundleGarbageCollectJavaScriptObjects(m_bundle);
     153
    144154        m_state = Idle;
    145155        m_dumpPixels = false;
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r84206 r84534  
    3030#include "StringFunctions.h"
    3131#include "TestInvocation.h"
    32 #include <cstdio>
    3332#include <WebKit2/WKContextPrivate.h>
     33#include <WebKit2/WKNumber.h>
    3434#include <WebKit2/WKPageGroup.h>
    3535#include <WebKit2/WKPreferencesPrivate.h>
    3636#include <WebKit2/WKRetainPtr.h>
     37#include <cstdio>
    3738#include <wtf/PassOwnPtr.h>
    3839
     
    6162    , m_printSeparators(false)
    6263    , m_usingServerMode(false)
     64    , m_gcBetweenTests(false)
    6365    , m_state(Initial)
    6466    , m_doneResetting(false)
     
    216218            continue;
    217219        }
     220        if (argument == "--gc-between-tests") {
     221            m_gcBetweenTests = true;
     222            continue;
     223        }
    218224        if (argument == "--print-supported-features") {
    219225            printSupportedFeatures = true;
     
    349355    m_state = Resetting;
    350356
    351     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("Reset"));
    352     WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), 0);
     357    WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("Reset"));
     358    WKRetainPtr<WKMutableDictionaryRef> resetMessageBody = adoptWK(WKMutableDictionaryCreate());
     359
     360    WKRetainPtr<WKStringRef> shouldGCKey = adoptWK(WKStringCreateWithUTF8CString("ShouldGC"));
     361    WKRetainPtr<WKBooleanRef> shouldGCValue = adoptWK(WKBooleanCreate(m_gcBetweenTests));
     362    WKDictionaryAddItem(resetMessageBody.get(), shouldGCKey.get(), shouldGCValue.get());
     363
     364    WKContextPostMessageToInjectedBundle(TestController::shared().context(), messageName.get(), resetMessageBody.get());
    353365
    354366    // FIXME: This function should also ensure that there is only one page open.
  • trunk/Tools/WebKitTestRunner/TestController.h

    r80009 r84534  
    100100    bool m_printSeparators;
    101101    bool m_usingServerMode;
     102    bool m_gcBetweenTests;
    102103    std::vector<std::string> m_paths;
    103104    WKRetainPtr<WKStringRef> m_injectedBundlePath;
Note: See TracChangeset for help on using the changeset viewer.