Changeset 160627 in webkit


Ignore:
Timestamp:
Dec 15, 2013 8:58:10 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Refactor option handling in WebKitTestRunner.
https://bugs.webkit.org/show_bug.cgi?id=123185

Patch by Tamas Gergely <tgergely.u-szeged@partner.samsung.com> on 2013-12-15
Reviewed by Darin Adler.

Option handling is refactored (according to the FIXME) that allows
to automatically generate the help message.

  • WebKitTestRunner/CMakeLists.txt:
  • WebKitTestRunner/GNUmakefile.am:
  • WebKitTestRunner/Options.cpp: Added.

(WTR::Options::Options):
(WTR::handleOptionTimeout):
(WTR::handleOptionNoTimeout):
(WTR::handleOptionNoTimeoutAtAll):
(WTR::handleOptionVerbose):
(WTR::handleOptionGcBetweenTests):
(WTR::handleOptionPixelTests):
(WTR::handleOptionPrintSupportedFeatures):
(WTR::handleOptionComplexText):
(WTR::handleOptionAcceleratedDrawing):
(WTR::handleOptionRemoteLayerTree):
(WTR::handleOptionUnmatched):
(WTR::OptionsHandler::OptionsHandler):
(WTR::Option::Option):
(WTR::Option::matches):
(WTR::OptionsHandler::parse):
(WTR::OptionsHandler::printHelp):

  • WebKitTestRunner/Options.h: Added.
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::initialize):

  • WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
Location:
trunk/Tools
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r160620 r160627  
     12013-12-15  Tamas Gergely  <tgergely.u-szeged@partner.samsung.com>
     2
     3        Refactor option handling in WebKitTestRunner.
     4        https://bugs.webkit.org/show_bug.cgi?id=123185
     5
     6        Reviewed by Darin Adler.
     7
     8        Option handling is refactored (according to the FIXME) that allows
     9        to automatically generate the help message.
     10
     11        * WebKitTestRunner/CMakeLists.txt:
     12        * WebKitTestRunner/GNUmakefile.am:
     13        * WebKitTestRunner/Options.cpp: Added.
     14        (WTR::Options::Options):
     15        (WTR::handleOptionTimeout):
     16        (WTR::handleOptionNoTimeout):
     17        (WTR::handleOptionNoTimeoutAtAll):
     18        (WTR::handleOptionVerbose):
     19        (WTR::handleOptionGcBetweenTests):
     20        (WTR::handleOptionPixelTests):
     21        (WTR::handleOptionPrintSupportedFeatures):
     22        (WTR::handleOptionComplexText):
     23        (WTR::handleOptionAcceleratedDrawing):
     24        (WTR::handleOptionRemoteLayerTree):
     25        (WTR::handleOptionUnmatched):
     26        (WTR::OptionsHandler::OptionsHandler):
     27        (WTR::Option::Option):
     28        (WTR::Option::matches):
     29        (WTR::OptionsHandler::parse):
     30        (WTR::OptionsHandler::printHelp):
     31        * WebKitTestRunner/Options.h: Added.
     32        * WebKitTestRunner/TestController.cpp:
     33        (WTR::TestController::initialize):
     34        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
     35
    1362013-12-15  Dan Bernstein  <mitz@apple.com>
    237
  • trunk/Tools/WebKitTestRunner/CMakeLists.txt

    r160404 r160627  
    77    ${WEBKIT_TESTRUNNER_DIR}/CyclicRedundancyCheck.cpp
    88    ${WEBKIT_TESTRUNNER_DIR}/GeolocationProviderMock.cpp
     9    ${WEBKIT_TESTRUNNER_DIR}/Options.cpp
    910    ${WEBKIT_TESTRUNNER_DIR}/PixelDumpSupport.cpp
    1011    ${WEBKIT_TESTRUNNER_DIR}/TestController.cpp
  • trunk/Tools/WebKitTestRunner/GNUmakefile.am

    r156164 r160627  
    2222        Tools/WebKitTestRunner/GeolocationProviderMock.cpp \
    2323        Tools/WebKitTestRunner/GeolocationProviderMock.h \
     24        Tools/WebKitTestRunner/Options.cpp \
     25        Tools/WebKitTestRunner/Options.h \
    2426        Tools/WebKitTestRunner/PixelDumpSupport.cpp \
    2527        Tools/WebKitTestRunner/PixelDumpSupport.h \
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r160459 r160627  
    2828
    2929#include "EventSenderProxy.h"
     30#include "Options.h"
    3031#include "PlatformWebView.h"
    3132#include "StringFunctions.h"
     
    267268    platformInitialize();
    268269
     270    Options options(defaultLongTimeout, defaultShortTimeout);
     271    OptionsHandler optionsHandler(options);
     272
    269273    if (argc < 2) {
    270         fputs("Usage: WebKitTestRunner [options] filename [filename2..n]\n", stderr);
    271         // FIXME: Refactor option parsing to allow us to print
    272         // an auto-generated list of options.
     274        optionsHandler.printHelp();
    273275        exit(1);
    274276    }
    275 
    276     bool printSupportedFeatures = false;
    277 
    278     for (int i = 1; i < argc; ++i) {
    279         std::string argument(argv[i]);
    280 
    281         if (argument == "--timeout" && i + 1 < argc) {
    282             m_longTimeout = atoi(argv[++i]);
    283             // Scale up the short timeout to match.
    284             m_shortTimeout = defaultShortTimeout * m_longTimeout / defaultLongTimeout;
    285             continue;
    286         }
    287 
    288         if (argument == "--no-timeout") {
    289             m_useWaitToDumpWatchdogTimer = false;
    290             continue;
    291         }
    292 
    293         if (argument == "--no-timeout-at-all") {
    294             m_useWaitToDumpWatchdogTimer = false;
    295             m_forceNoTimeout = true;
    296             continue;
    297         }
    298 
    299         if (argument == "--verbose") {
    300             m_verbose = true;
    301             continue;
    302         }
    303         if (argument == "--gc-between-tests") {
    304             m_gcBetweenTests = true;
    305             continue;
    306         }
    307         if (argument == "--pixel-tests" || argument == "-p") {
    308             m_shouldDumpPixelsForAllTests = true;
    309             continue;
    310         }
    311         if (argument == "--print-supported-features") {
    312             printSupportedFeatures = true;
    313             break;
    314         }
    315         if (argument == "--complex-text") {
    316             m_forceComplexText = true;
    317             continue;
    318         }
    319         if (argument == "--accelerated-drawing") {
    320             m_shouldUseAcceleratedDrawing = true;
    321             continue;
    322         }
    323         if (argument == "--remote-layer-tree") {
    324             m_shouldUseRemoteLayerTree = true;
    325             continue;
    326         }
    327 
    328 
    329         // Skip any other arguments that begin with '--'.
    330         if (argument.length() >= 2 && argument[0] == '-' && argument[1] == '-')
    331             continue;
    332 
    333         m_paths.push_back(argument);
    334     }
    335 
    336     if (printSupportedFeatures) {
     277    if (!optionsHandler.parse(argc, argv))
     278        exit(1);
     279
     280    m_longTimeout = options.longTimeout;
     281    m_shortTimeout = options.shortTimeout;
     282    m_useWaitToDumpWatchdogTimer = options.useWaitToDumpWatchdogTimer;
     283    m_forceNoTimeout = options.forceNoTimeout;
     284    m_verbose = options.verbose;
     285    m_gcBetweenTests = options.gcBetweenTests;
     286    m_shouldDumpPixelsForAllTests = options.shouldDumpPixelsForAllTests;
     287    m_forceComplexText = options.forceComplexText;
     288    m_shouldUseAcceleratedDrawing = options.shouldUseAcceleratedDrawing;
     289    m_shouldUseRemoteLayerTree = options.shouldUseRemoteLayerTree;
     290    m_paths = options.paths;
     291
     292    if (options.printSupportedFeatures) {
    337293        // FIXME: On Windows, DumpRenderTree uses this to expose whether it supports 3d
    338294        // transforms and accelerated compositing. When we support those features, we
  • trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj

    r159485 r160627  
    6060                8034C6621487636400AC32E9 /* AccessibilityControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8034C6611487636400AC32E9 /* AccessibilityControllerMac.mm */; };
    6161                8097338A14874A5A008156D9 /* AccessibilityNotificationHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8097338914874A5A008156D9 /* AccessibilityNotificationHandler.mm */; };
     62                841CC00F181185BF0042E9B6 /* Options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 841CC00D181185BF0042E9B6 /* Options.cpp */; };
    6263                8CCDA823151A570B0003F937 /* SampleFont.sfont in Resources */ = {isa = PBXBuildFile; fileRef = 8CCDA822151A570B0003F937 /* SampleFont.sfont */; };
    6364                A664BC7613A5F3A9009A7B25 /* libWebCoreTestSupport.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */; };
     
    175176                8097338814874A5A008156D9 /* AccessibilityNotificationHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AccessibilityNotificationHandler.h; path = mac/AccessibilityNotificationHandler.h; sourceTree = "<group>"; };
    176177                8097338914874A5A008156D9 /* AccessibilityNotificationHandler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityNotificationHandler.mm; path = mac/AccessibilityNotificationHandler.mm; sourceTree = "<group>"; };
     178                841CC00D181185BF0042E9B6 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Options.cpp; sourceTree = "<group>"; };
     179                841CC00E181185BF0042E9B6 /* Options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Options.h; sourceTree = "<group>"; };
    177180                8CCDA822151A570B0003F937 /* SampleFont.sfont */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = SampleFont.sfont; path = fonts/SampleFont.sfont; sourceTree = "<group>"; };
    178181                8DD76FA10486AA7600D96B5E /* WebKitTestRunner */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WebKitTestRunner; sourceTree = BUILT_PRODUCTS_DIR; };
     
    281284                        isa = PBXGroup;
    282285                        children = (
     286                                841CC00D181185BF0042E9B6 /* Options.cpp */,
     287                                841CC00E181185BF0042E9B6 /* Options.h */,
    283288                                BC9192021333E4CD003011DC /* cg */,
    284289                                BC7933FE118F7C74005EA8E2 /* mac */,
     
    638643                                3164C8F015D1ADA100EF1FE0 /* WebNotificationProvider.cpp in Sources */,
    639644                                4429FC5F1627089600F66D8B /* WorkQueueManager.cpp in Sources */,
     645                                841CC00F181185BF0042E9B6 /* Options.cpp in Sources */,
    640646                        );
    641647                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.