Changeset 124581 in webkit


Ignore:
Timestamp:
Aug 3, 2012 1:20:19 AM (12 years ago)
Author:
kbalazs@webkit.org
Message:

All ports should support per test switching of pixel testing
https://bugs.webkit.org/show_bug.cgi?id=92398

Reviewed by Dirk Pranke.

Teach all test drivers to accept a per test control of whether
to dump pixels. Drivers now accept a -p/--pixel-test argument
on the standart input that means that running the current
test as pixel test is allowed (even if the expected hash is
missing). Removed the --pixel-tests command line option since
there is no need for it anymore.

  • DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:
  • DumpRenderTree/DumpRenderTree.gypi:
  • DumpRenderTree/DumpRenderTree.h:

(TestCommand::TestCommand):
(TestCommand):

  • DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
  • DumpRenderTree/DumpRenderTreeCommon.cpp: Added.

(CommandTokenizer):
(CommandTokenizer::CommandTokenizer):
(CommandTokenizer::pump):
(CommandTokenizer::next):
(CommandTokenizer::hasNext):
(die):
(parseInputLine):
Common logic to parse the input line from the standard input (or from the command line
in standalone mode). Made it somewhat general so we can easily add more arguments if
there is a need.

  • DumpRenderTree/chromium/DumpRenderTree.cpp:

(runTest):
(main):

  • DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp.
  • DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h.
  • DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp.
  • DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h.

Renamed these files with a Chromium suffix because they were clashing with the common ones used by other ports after adding the root
DumpRenderTree directory to the include path.

  • DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp:
  • DumpRenderTree/chromium/TestShell.cpp:

(TestShell::TestShell):
(TestShell::runFileTest):
(TestShell::dump):

  • DumpRenderTree/chromium/TestShell.h:

(TestParams::TestParams):
(TestShell):

  • DumpRenderTree/efl/CMakeLists.txt:
  • DumpRenderTree/efl/DumpRenderTree.cpp:

(parseCommandLineOptions):
(runTest):
(shouldDumpPixelsAndCompareWithExpected):
(main):

  • DumpRenderTree/gtk/DumpRenderTree.cpp:

(initializeGlobalsFromCommandLineOptions):
(dump):
(runTest):
(main):

  • DumpRenderTree/mac/DumpRenderTree.mm:

(initializeGlobalsFromCommandLineOptions):
(dumpRenderTree):
(dump):
(runTest):

  • DumpRenderTree/qt/DumpRenderTree.pro:
  • DumpRenderTree/qt/DumpRenderTreeQt.cpp:

(WebCore::DumpRenderTree::DumpRenderTree):
(WebCore::DumpRenderTree::open):
(WebCore::DumpRenderTree::processLine):
(WebCore::DumpRenderTree::dump):

  • DumpRenderTree/qt/DumpRenderTreeQt.h:

(DumpRenderTree):

  • DumpRenderTree/qt/main.cpp:

(isOption):
(printUsage):
(main):

  • DumpRenderTree/win/DumpRenderTree.cpp:

(dump):
(runTest):
(dllLauncherEntryPoint):

  • DumpRenderTree/win/DumpRenderTree.vcproj:
  • DumpRenderTree/wscript:
  • DumpRenderTree/wx/DumpRenderTreeWx.cpp:

(dump):
(runTest):
(MyApp::OnInit):

  • GNUmakefile.am:
  • Scripts/old-run-webkit-tests:
  • Scripts/old-run-webkit-tests:

Pass --pixel-test before the hash.

  • Scripts/webkitpy/layout_tests/port/base.py:

(Port.should_run_as_pixel_test): Removed now that all ports supports it.

  • Scripts/webkitpy/layout_tests/port/driver.py:

(Driver.cmd_line): Don't pass --pixel-tests anymore.
(Driver._command_from_driver_input):

  • Scripts/webkitpy/layout_tests/port/qt.py:

(QtPort.should_run_as_pixel_test):

  • Scripts/webkitpy/layout_tests/port/test.py:

(TestPort.should_run_as_pixel_test):

  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::TestController):
(WTR::TestController::initialize):
(WTR::TestCommand::TestCommand):
(TestCommand):
(WTR):
(CommandTokenizer):
(WTR::CommandTokenizer::CommandTokenizer):
(WTR::CommandTokenizer::pump):
(WTR::CommandTokenizer::next):
(WTR::CommandTokenizer::hasNext):
(WTR::die):
(WTR::parseInputLine):
(WTR::TestController::runTest):

  • WebKitTestRunner/TestController.h:

(TestController):
Duplicate the logic for parsing the command line because
unfortunately there is no way to share code between
WebKitTestRunner and DumpRenderTree.

Location:
trunk/Tools
Files:
1 added
29 edited
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r124579 r124581  
     12012-08-03  Balazs Kelemen  <kbalazs@webkit.org>
     2
     3        All ports should support per test switching of pixel testing
     4        https://bugs.webkit.org/show_bug.cgi?id=92398
     5
     6        Reviewed by Dirk Pranke.
     7
     8        Teach all test drivers to accept a per test control of whether
     9        to dump pixels. Drivers now accept a -p/--pixel-test argument
     10        on the standart input that means that running the current
     11        test as pixel test is allowed (even if the expected hash is
     12        missing). Removed the --pixel-tests command line option since
     13        there is no need for it anymore.
     14
     15        * DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:
     16        * DumpRenderTree/DumpRenderTree.gypi:
     17        * DumpRenderTree/DumpRenderTree.h:
     18        (TestCommand::TestCommand):
     19        (TestCommand):
     20        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
     21        * DumpRenderTree/DumpRenderTreeCommon.cpp: Added.
     22        (CommandTokenizer):
     23        (CommandTokenizer::CommandTokenizer):
     24        (CommandTokenizer::pump):
     25        (CommandTokenizer::next):
     26        (CommandTokenizer::hasNext):
     27        (die):
     28        (parseInputLine):
     29        Common logic to parse the input line from the standard input (or from the command line
     30        in standalone mode). Made it somewhat general so we can easily add more arguments if
     31        there is a need.
     32
     33        * DumpRenderTree/chromium/DumpRenderTree.cpp:
     34        (runTest):
     35        (main):
     36
     37        * DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.cpp.
     38        * DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityController.h.
     39        * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.cpp.
     40        * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h: Renamed from Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElement.h.
     41        Renamed these files with a Chromium suffix because they were clashing with the common ones used by other ports after adding the root
     42        DumpRenderTree directory to the include path.
     43
     44        * DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp:
     45        * DumpRenderTree/chromium/TestShell.cpp:
     46        (TestShell::TestShell):
     47        (TestShell::runFileTest):
     48        (TestShell::dump):
     49        * DumpRenderTree/chromium/TestShell.h:
     50        (TestParams::TestParams):
     51        (TestShell):
     52        * DumpRenderTree/efl/CMakeLists.txt:
     53        * DumpRenderTree/efl/DumpRenderTree.cpp:
     54        (parseCommandLineOptions):
     55        (runTest):
     56        (shouldDumpPixelsAndCompareWithExpected):
     57        (main):
     58        * DumpRenderTree/gtk/DumpRenderTree.cpp:
     59        (initializeGlobalsFromCommandLineOptions):
     60        (dump):
     61        (runTest):
     62        (main):
     63        * DumpRenderTree/mac/DumpRenderTree.mm:
     64        (initializeGlobalsFromCommandLineOptions):
     65        (dumpRenderTree):
     66        (dump):
     67        (runTest):
     68        * DumpRenderTree/qt/DumpRenderTree.pro:
     69        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
     70        (WebCore::DumpRenderTree::DumpRenderTree):
     71        (WebCore::DumpRenderTree::open):
     72        (WebCore::DumpRenderTree::processLine):
     73        (WebCore::DumpRenderTree::dump):
     74        * DumpRenderTree/qt/DumpRenderTreeQt.h:
     75        (DumpRenderTree):
     76        * DumpRenderTree/qt/main.cpp:
     77        (isOption):
     78        (printUsage):
     79        (main):
     80        * DumpRenderTree/win/DumpRenderTree.cpp:
     81        (dump):
     82        (runTest):
     83        (dllLauncherEntryPoint):
     84        * DumpRenderTree/win/DumpRenderTree.vcproj:
     85        * DumpRenderTree/wscript:
     86        * DumpRenderTree/wx/DumpRenderTreeWx.cpp:
     87        (dump):
     88        (runTest):
     89        (MyApp::OnInit):
     90        * GNUmakefile.am:
     91
     92        * Scripts/old-run-webkit-tests:
     93        * Scripts/old-run-webkit-tests:
     94        Pass --pixel-test before the hash.
     95
     96        * Scripts/webkitpy/layout_tests/port/base.py:
     97        (Port.should_run_as_pixel_test): Removed now that all ports supports it.
     98        * Scripts/webkitpy/layout_tests/port/driver.py:
     99        (Driver.cmd_line): Don't pass --pixel-tests anymore.
     100        (Driver._command_from_driver_input):
     101        * Scripts/webkitpy/layout_tests/port/qt.py:
     102        (QtPort.should_run_as_pixel_test):
     103        * Scripts/webkitpy/layout_tests/port/test.py:
     104        (TestPort.should_run_as_pixel_test):
     105
     106        * WebKitTestRunner/TestController.cpp:
     107        (WTR::TestController::TestController):
     108        (WTR::TestController::initialize):
     109        (WTR::TestCommand::TestCommand):
     110        (TestCommand):
     111        (WTR):
     112        (CommandTokenizer):
     113        (WTR::CommandTokenizer::CommandTokenizer):
     114        (WTR::CommandTokenizer::pump):
     115        (WTR::CommandTokenizer::next):
     116        (WTR::CommandTokenizer::hasNext):
     117        (WTR::die):
     118        (WTR::parseInputLine):
     119        (WTR::TestController::runTest):
     120        * WebKitTestRunner/TestController.h:
     121        (TestController):
     122        Duplicate the logic for parsing the command line because
     123        unfortunately there is no way to share code between
     124        WebKitTestRunner and DumpRenderTree.
     125
    11262012-08-03  Ilya Tikhonovsky  <loislo@chromium.org>
    2127
  • trunk/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp

    r124467 r124581  
    134134                '<(chromium_src_dir)',
    135135                '<(source_dir)/WebKit/chromium/public',
     136                '<(tools_dir)/DumpRenderTree',
    136137                '<(DEPTH)',
    137138            ],
  • trunk/Tools/DumpRenderTree/DumpRenderTree.gypi

    r124319 r124581  
    5555        ],
    5656        'test_runner_files': [
    57             'chromium/TestRunner/AccessibilityController.cpp',
    58             'chromium/TestRunner/AccessibilityController.h',
    59             'chromium/TestRunner/AccessibilityUIElement.cpp',
    60             'chromium/TestRunner/AccessibilityUIElement.h',
     57            'DumpRenderTree.h',
     58            'DumpRenderTreeCommon.cpp',
     59            'chromium/TestRunner/AccessibilityControllerChromium.cpp',
     60            'chromium/TestRunner/AccessibilityControllerChromium.h',
     61            'chromium/TestRunner/AccessibilityUIElementChromium.cpp',
     62            'chromium/TestRunner/AccessibilityUIElementChromium.h',
    6163            'chromium/TestRunner/CppBoundClass.cpp',
    6264            'chromium/TestRunner/CppBoundClass.h',
  • trunk/Tools/DumpRenderTree/DumpRenderTree.h

    r124319 r124581  
    6666void displayWebView();
    6767
     68struct TestCommand {
     69    TestCommand() : shouldDumpPixels(false) { }
     70
     71    std::string pathOrURL;
     72    bool shouldDumpPixels;
     73    std::string expectedPixelHash;
     74};
     75
     76TestCommand parseInputLine(const std::string&);
     77
    6878#endif // DumpRenderTree_h
  • trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj

    r124319 r124581  
    9090                9340994C08540CAE007F3BC8 /* DumpRenderTreePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */; };
    9191                9340995108540CAE007F3BC8 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9335435F03D75502008635CE /* WebKit.framework */; };
     92                9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */; };
    9293                A817090008B163EF00CCB9FB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; };
    9394                A817090408B164D300CCB9FB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A817090308B164D300CCB9FB /* JavaScriptCore.framework */; };
     
    290291                9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
    291292                9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; };
     293                9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DumpRenderTreeCommon.cpp; sourceTree = "<group>"; };
    292294                A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = DumpRenderTree.h; sourceTree = "<group>"; };
    293295                A817090308B164D300CCB9FB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
     
    422424                        isa = PBXGroup;
    423425                        children = (
     426                                9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */,
    424427                                32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */,
    425428                                1422A2750AF6F4BD00E1A883 /* Delegates */,
     
    956959                                3A5626CB131CA02A002BE6D9 /* StorageTrackerDelegate.mm in Sources */,
    957960                                80045AEE147718E7008290A8 /* AccessibilityNotificationHandler.mm in Sources */,
     961                                9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */,
    958962                        );
    959963                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp

    r124319 r124581  
    3030
    3131#include "config.h"
     32#include "DumpRenderTree.h"
    3233
    3334#include "MockWebKitPlatformSupport.h"
     
    4546static const char optionDumpAllPixels[] = "--dump-all-pixels";
    4647static const char optionNotree[] = "--notree";
    47 static const char optionPixelTests[] = "--pixel-tests";
    4848static const char optionThreaded[] = "--threaded";
    4949static const char optionDebugRenderTree[] = "--debug-render-tree";
     
    8686};
    8787
    88 static void runTest(TestShell& shell, TestParams& params, const string& testName)
     88static void runTest(TestShell& shell, TestParams& params, const string& inputLine)
    8989{
    9090    int oldTimeoutMsec = shell.layoutTestTimeout();
    91     params.pixelHash = "";
    92     string pathOrURL = testName;
    93     string::size_type separatorPosition = pathOrURL.find("'");
    94     if (separatorPosition != string::npos) {
    95         params.pixelHash = pathOrURL.substr(separatorPosition + 1);
    96         pathOrURL.erase(separatorPosition);
    97     }
    98     params.testUrl = webkit_support::CreateURLForPathOrURL(pathOrURL);
     91    TestCommand command = parseInputLine(inputLine);
     92    params.testUrl = webkit_support::CreateURLForPathOrURL(command.pathOrURL);
     93    params.pixelHash = command.shouldDumpPixels;
    9994    webkit_support::SetCurrentDirectoryForFileURL(params.testUrl);
    10095    v8::V8::SetFlagsFromString(shell.javaScriptFlags().c_str(), shell.javaScriptFlags().length());
     
    109104          shell.setDumpWhenFinished(isLastLoad);
    110105          shell.resetTestController();
    111           shell.runFileTest(params);
     106          shell.runFileTest(params, command.shouldDumpPixels);
    112107      }
    113108    } else {
    114109      shell.resetTestController();
    115       shell.runFileTest(params);
     110      shell.runFileTest(params, command.shouldDumpPixels);
    116111    }
    117112    shell.setLayoutTestTimeout(oldTimeoutMsec);
     
    147142        else if (argument == optionNotree)
    148143            params.dumpTree = false;
    149         else if (argument == optionPixelTests)
    150             params.dumpPixels = true;
    151144        else if (argument == optionDebugRenderTree)
    152145            params.debugRenderTree = true;
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp

    r124580 r124581  
    3030
    3131#include "config.h"
    32 #include "AccessibilityController.h"
     32#include "AccessibilityControllerChromium.h"
    3333
    3434#include "WebAccessibilityObject.h"
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.h

    r124580 r124581  
    2929 */
    3030
    31 #ifndef AccessibilityController_h
    32 #define AccessibilityController_h
     31#ifndef AccessibilityControllerChromium_h
     32#define AccessibilityControllerChromium_h
    3333
    34 #include "AccessibilityUIElement.h"
     34#include "AccessibilityUIElementChromium.h"
    3535#include "CppBoundClass.h"
    3636
     
    8282};
    8383
    84 #endif // AccessibilityController_h
     84#endif // AccessibilityControllerChromium_h
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp

    r124580 r124581  
    3030
    3131#include "config.h"
    32 #include "AccessibilityUIElement.h"
     32#include "AccessibilityUIElementChromium.h"
    3333
    3434#include "WebAccessibilityObject.h"
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.h

    r124580 r124581  
    2929 */
    3030
    31 #ifndef AccessibilityUIElement_h
    32 #define AccessibilityUIElement_h
     31#ifndef AccessibilityUIElementChromium_h
     32#define AccessibilityUIElementChromium_h
    3333
    3434#include "CppBoundClass.h"
     
    165165};
    166166
    167 #endif // AccessibilityUIElement_h
     167#endif // AccessibilityUIElementChromium_h
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp

    r124195 r124581  
    3232#include "TestInterfaces.h"
    3333
    34 #include "AccessibilityController.h"
     34#include "AccessibilityControllerChromium.h"
    3535#include "EventSender.h"
    3636#include "GamepadController.h"
  • trunk/Tools/DumpRenderTree/chromium/TestShell.cpp

    r124319 r124581  
    107107    , m_focusedWidget(0)
    108108    , m_devTools(0)
     109    , m_dumpPixelsForCurrentTest(false)
    109110    , m_allowExternalPages(false)
    110111    , m_acceleratedCompositingForVideoEnabled(false)
     
    233234}
    234235
    235 void TestShell::runFileTest(const TestParams& params)
     236void TestShell::runFileTest(const TestParams& params, bool shouldDumpPixels)
    236237{
    237238    ASSERT(params.testUrl.isValid());
     239    m_dumpPixelsForCurrentTest = shouldDumpPixels;
    238240    m_testIsPreparing = true;
    239241    m_params = params;
    240242    string testUrl = m_params.testUrl.spec();
     243
     244    m_layoutTestController->setShouldGeneratePixelResults(shouldDumpPixels);
    241245
    242246    if (testUrl.find("loading/") != string::npos
     
    604608        m_printer.handleTextFooter();
    605609
    606     if (m_params.dumpPixels && shouldGeneratePixelResults) {
     610    if (m_dumpPixelsForCurrentTest && shouldGeneratePixelResults) {
    607611        // Image output: we write the image data to the file given on the
    608612        // command line (for the dump pixels argument), and the MD5 sum to
  • trunk/Tools/DumpRenderTree/chromium/TestShell.h

    r124319 r124581  
    3232#define TestShell_h
    3333
    34 #include "AccessibilityController.h"
     34#include "AccessibilityControllerChromium.h"
    3535#include "GamepadController.h"
    3636#include "LayoutTestController.h"
     
    6464struct TestParams {
    6565    bool dumpTree;
    66     bool dumpPixels;
    6766    bool debugRenderTree;
    6867    bool debugLayerTree;
     
    7372    TestParams()
    7473        : dumpTree(true)
    75         , dumpPixels(false)
    7674        , debugRenderTree(false)
    7775        , debugLayerTree(false)
     
    104102
    105103    void bindJSObjectsToWindow(WebKit::WebFrame*);
    106     void runFileTest(const TestParams&);
     104    void runFileTest(const TestParams&, bool shouldDumpPixelTests);
    107105    void callJSGC();
    108106    void resetTestController();
     
    225223
    226224    TestParams m_params;
     225    bool m_dumpPixelsForCurrentTest;
    227226    int m_timeout; // timeout value in millisecond
    228227    bool m_allowExternalPages;
  • trunk/Tools/DumpRenderTree/efl/CMakeLists.txt

    r124319 r124581  
    11SET(DumpRenderTree_SOURCES
     2    ${TOOLS_DIR}/DumpRenderTree/DumpRenderTreeCommon.cpp
    23    ${TOOLS_DIR}/DumpRenderTree/CyclicRedundancyCheck.cpp
    34    ${TOOLS_DIR}/DumpRenderTree/GCController.cpp
  • trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp

    r124319 r124581  
    6666volatile bool done = false;
    6767
    68 static int dumpPixels = false;
     68static bool dumpPixelsForCurrentTest;
    6969static int dumpTree = true;
    7070static int printSeparators = true;
     
    194194    static const option options[] = {
    195195        {"notree", no_argument, &dumpTree, false},
    196         {"pixel-tests", no_argument, &dumpPixels, true},
    197196        {"tree", no_argument, &dumpTree, true},
    198197        {"gui", no_argument, &useX11Window, true},
     
    212211}
    213212
    214 static String getFinalTestURL(const String& testURL)
    215 {
    216     const size_t hashSeparatorPos = testURL.find("'");
    217     if (hashSeparatorPos != notFound)
    218         return getFinalTestURL(testURL.left(hashSeparatorPos));
    219 
    220     // Convert the path into a full file URL if it does not look
    221     // like an HTTP/S URL (doesn't start with http:// or https://).
    222     if (!testURL.startsWith("http://") && !testURL.startsWith("https://")) {
    223         char* cFilePath = ecore_file_realpath(testURL.utf8().data());
    224         const String filePath = String::fromUTF8(cFilePath);
    225         free(cFilePath);
    226 
    227         if (ecore_file_exists(filePath.utf8().data()))
    228             return String("file://") + filePath;
    229     }
    230 
    231     return testURL;
    232 }
    233 
    234 static String getExpectedPixelHash(const String& testURL)
    235 {
    236     const size_t hashSeparatorPos = testURL.find("'");
    237     return (hashSeparatorPos != notFound) ? testURL.substring(hashSeparatorPos + 1) : String();
    238 }
    239 
    240213static inline bool isGlobalHistoryTest(const String& cTestPathOrURL)
    241214{
     
    269242}
    270243
    271 static void runTest(const char* cTestPathOrURL)
    272 {
    273     const String testPathOrURL = String::fromUTF8(cTestPathOrURL);
    274     ASSERT(!testPathOrURL.isEmpty());
    275 
    276     const String testURL = getFinalTestURL(testPathOrURL);
    277     const String expectedPixelHash = getExpectedPixelHash(testPathOrURL);
     244static void runTest(const char* inputLine)
     245{
     246    TestCommand command = parseInputLine(inputLine);
     247    const String testURL(command.pathOrURL.c_str());
     248    ASSERT(!testURL.isEmpty());
     249    dumpPixelsForCurrentTest = command.shouldDumpPixels;
     250    const String expectedPixelHash(command.expectedPixelHash.c_str());
    278251
    279252    browser->resetDefaultsToConsistentValues();
     
    353326static bool shouldDumpPixelsAndCompareWithExpected()
    354327{
    355     return dumpPixels && gLayoutTestController->generatePixelResults() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive();
     328    return dumpPixelsForCurrentTest && gLayoutTestController->generatePixelResults() && !gLayoutTestController->dumpDOMAsWebArchive() && !gLayoutTestController->dumpSourceAsWebArchive();
    356329}
    357330
     
    462435        runTestingServerLoop();
    463436    } else {
    464         printSeparators = (optind < argc - 1 || (dumpPixels && dumpTree));
     437        printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree));
    465438        for (int i = optind; i != argc; ++i)
    466439            runTest(argv[i]);
  • trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp

    r124319 r124581  
    7474volatile bool done;
    7575static bool printSeparators;
    76 static int dumpPixels;
     76static bool dumpPixelsForCurrentTest;
    7777static int dumpTree = 1;
    7878static int useTimeoutWatchdog = 1;
     
    545545    struct option options[] = {
    546546        {"notree", no_argument, &dumpTree, false},
    547         {"pixel-tests", no_argument, &dumpPixels, true},
    548547        {"tree", no_argument, &dumpTree, true},
    549548        {"no-timeout", no_argument, &useTimeoutWatchdog, false},
     
    625624    }
    626625
    627     if (dumpPixels
     626    if (dumpPixelsForCurrentTest
    628627     && gLayoutTestController->generatePixelResults()
    629628     && !gLayoutTestController->dumpDOMAsWebArchive()
     
    688687}
    689688
    690 static void runTest(const string& testPathOrURL)
     689static void runTest(const string& inputLine)
    691690{
    692691    ASSERT(!testPathOrURL.empty());
    693692
    694     // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows.
    695     string testURL(testPathOrURL);
    696     string expectedPixelHash;
    697     size_t separatorPos = testURL.find("'");
    698     if (separatorPos != string::npos) {
    699         testURL = string(testPathOrURL, 0, separatorPos);
    700         expectedPixelHash = string(testPathOrURL, separatorPos + 1);
    701     }
     693    TestCommand command = parseInputLine(inputLine);
     694    string& testURL = command.pathOrURL;
     695    dumpPixelsForCurrentTest = command.shouldDumpPixels;
    702696
    703697    // Convert the path into a full file URL if it does not look
     
    713707    resetDefaultsToConsistentValues();
    714708
    715     gLayoutTestController = LayoutTestController::create(testURL, expectedPixelHash);
     709    gLayoutTestController = LayoutTestController::create(testURL, command.expectedPixelHash);
    716710    topLoadingFrame = 0;
    717711    done = false;
     
    14481442        runTestingServerLoop();
    14491443    } else {
    1450         printSeparators = (optind < argc-1 || (dumpPixels && dumpTree));
     1444        printSeparators = (optind < argc-1 || (dumpPixelsForCurrentTest && dumpTree));
    14511445        for (int i = optind; i != argc; ++i)
    14521446            runTest(argv[i]);
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r124512 r124581  
    141141StorageTrackerDelegate *storageDelegate;
    142142
    143 static int dumpPixels;
     143static bool dumpPixelsForCurrentTest;
    144144static int threaded;
    145145static int dumpTree = YES;
     
    782782    struct option options[] = {
    783783        {"notree", no_argument, &dumpTree, NO},
    784         {"pixel-tests", no_argument, &dumpPixels, YES},
    785784        {"tree", no_argument, &dumpTree, YES},
    786785        {"threaded", no_argument, &threaded, YES},
     
    851850    prepareConsistentTestingEnvironment();
    852851    addTestPluginsToPluginSearchPath(argv[0]);
    853     if (dumpPixels)
     852    if (dumpPixelsForCurrentTest)
    854853        installSignalHandlers();
    855854
     
    876875        runTestingServerLoop();
    877876    } else {
    878         printSeparators = (optind < argc-1 || (dumpPixels && dumpTree));
     877        printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree));
    879878        for (int i = optind; i != argc; ++i)
    880879            runTest(argv[i]);
     
    11971196    }
    11981197
    1199     if (dumpPixels && gLayoutTestController->generatePixelResults())
     1198    if (dumpPixelsForCurrentTest && gLayoutTestController->generatePixelResults())
    12001199        // FIXME: when isPrinting is set, dump the image with page separators.
    12011200        dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash());
     
    12781277}
    12791278
    1280 static void runTest(const string& testPathOrURL)
    1281 {
    1282     ASSERT(!testPathOrURL.empty());
    1283    
    1284     // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows.
    1285     string pathOrURL(testPathOrURL);
    1286     string expectedPixelHash;
    1287    
    1288     size_t separatorPos = pathOrURL.find("'");
    1289     if (separatorPos != string::npos) {
    1290         pathOrURL = string(testPathOrURL, 0, separatorPos);
    1291         expectedPixelHash = string(testPathOrURL, separatorPos + 1);
    1292     }
     1279static void runTest(const string& inputLine)
     1280{
     1281    ASSERT(!inputLine.empty());
     1282
     1283    TestCommand command = parseInputLine(inputLine);
     1284    const string& pathOrURL = command.pathOrURL;
     1285    dumpPixelsForCurrentTest = command.shouldDumpPixels;
    12931286
    12941287    NSString *pathOrURLString = [NSString stringWithUTF8String:pathOrURL.c_str()];
     
    13121305    resetWebViewToConsistentStateBeforeTesting();
    13131306
    1314     gLayoutTestController = LayoutTestController::create(testURL, expectedPixelHash);
     1307    gLayoutTestController = LayoutTestController::create(testURL, command.expectedPixelHash);
    13151308    topLoadingFrame = nil;
    13161309    ASSERT(!draggingInfo); // the previous test should have called eventSender.mouseUp to drop!
  • trunk/Tools/DumpRenderTree/qt/DumpRenderTree.pro

    r124447 r124581  
    2727HEADERS += \
    2828    $$PWD/../WorkQueue.h \
     29    $$PWD/../DumpRenderTree.h \
    2930    DumpRenderTreeQt.h \
    3031    EventSenderQt.h \
     
    3839SOURCES += \
    3940    $$PWD/../WorkQueue.cpp \
     41    $$PWD/../DumpRenderTreeCommon.cpp \
    4042    DumpRenderTreeQt.cpp \
    4143    EventSenderQt.cpp \
  • trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp

    r124319 r124581  
    3131
    3232#include "config.h"
     33#include "DumpRenderTree.h"
    3334
    3435#include "DumpRenderTreeQt.h"
     
    389390
    390391DumpRenderTree::DumpRenderTree()
    391     : m_dumpPixelsForAllTests(false)
    392     , m_stdin(0)
     392    : m_stdin(0)
    393393    , m_enableTextOutput(false)
    394394    , m_standAloneMode(false)
     
    605605        layoutTestController()->showWebInspector();
    606606
    607     if (isDumpAsTextTest(url)) {
     607    if (isDumpAsTextTest(url))
    608608        layoutTestController()->dumpAsText();
    609         setDumpPixelsForAllTests(false);
    610     }
    611609
    612610    if (isGlobalHistoryTest(url))
     
    691689void DumpRenderTree::processLine(const QString &input)
    692690{
    693     QString line = input;
    694 
    695     m_dumpPixelsForCurrentTest = false;
    696     m_expectedHash = QString();
    697     // single quote marks the pixel dump hash
    698     int indexOfFirstSeparator = line.indexOf('\'');
    699     int indexOfSecondSeparator = line.indexOf('\'', indexOfFirstSeparator + 1);
    700     if (indexOfFirstSeparator > -1) {
    701         int indexOfPixelHash = indexOfFirstSeparator + 1;
    702 
    703         // NRWT passes --pixel-test if we should dump pixels for the test.
    704         const QString expectedArg(QLatin1String("--pixel-test"));
    705         QString argTest = line.mid(indexOfFirstSeparator + 1, expectedArg.length());
    706         if (argTest == expectedArg) {
    707             m_dumpPixelsForCurrentTest = true;
    708             indexOfPixelHash = indexOfSecondSeparator == -1 ? -1 : indexOfSecondSeparator + 1;
    709         }
    710         if (indexOfPixelHash != -1 && indexOfPixelHash < line.size())
    711             m_expectedHash = line.mid(indexOfPixelHash);
    712         line.remove(indexOfFirstSeparator, line.length());
    713     }
    714 
    715     if (line.startsWith(QLatin1String("http:"))
    716             || line.startsWith(QLatin1String("https:"))
    717             || line.startsWith(QLatin1String("file:"))
    718             || line == QLatin1String("about:blank")) {
    719         open(QUrl(line));
     691    TestCommand command = parseInputLine(std::string(input.toLatin1().constData()));
     692    QString pathOrURL = QLatin1String(command.pathOrURL.c_str());
     693    m_dumpPixelsForCurrentTest = command.shouldDumpPixels;
     694    m_expectedHash = QLatin1String(command.expectedPixelHash.c_str());
     695
     696    if (pathOrURL.startsWith(QLatin1String("http:"))
     697            || pathOrURL.startsWith(QLatin1String("https:"))
     698            || pathOrURL.startsWith(QLatin1String("file:"))
     699            || pathOrURL == QLatin1String("about:blank")) {
     700        open(QUrl(pathOrURL));
    720701    } else {
    721         QFileInfo fi(line);
     702        QFileInfo fi(pathOrURL);
    722703
    723704        if (!fi.exists()) {
     
    726707            // Try to be smart about where the test is located
    727708            if (currentDir.dirName() == QLatin1String("LayoutTests"))
    728                 fi = QFileInfo(currentDir, line.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1"));
    729             else if (!line.contains(QLatin1String("LayoutTests")))
    730                 fi = QFileInfo(currentDir, line.prepend(QLatin1String("LayoutTests/")));
     709                fi = QFileInfo(currentDir, pathOrURL.replace(QRegExp(".*?LayoutTests/(.*)"), "\\1"));
     710            else if (!pathOrURL.contains(QLatin1String("LayoutTests")))
     711                fi = QFileInfo(currentDir, pathOrURL.prepend(QLatin1String("LayoutTests/")));
    731712
    732713            if (!fi.exists()) {
     
    740721
    741722    fflush(stdout);
    742 }
    743 
    744 void DumpRenderTree::setDumpPixelsForAllTests(bool dump)
    745 {
    746     m_dumpPixelsForAllTests = dump;
    747723}
    748724
     
    962938    fputs("#EOF\n", stderr);
    963939
    964     if ((m_dumpPixelsForAllTests || m_dumpPixelsForCurrentTest) && !m_controller->shouldDumpAsText()) {
     940    if (m_dumpPixelsForCurrentTest && !m_controller->shouldDumpAsText()) {
    965941        QImage image;
    966942        if (!m_controller->isPrinting()) {
  • trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h

    r123871 r124581  
    8383    bool isGraphicsBased() { return m_graphicsBased; }
    8484
    85     void setDumpPixelsForAllTests(bool);
    86 
    8785    void closeRemainingWindows();
    8886    void resetToConsistentStateBeforeTesting(const QUrl&);
     
    143141    LayoutTestController *m_controller;
    144142
    145     bool m_dumpPixelsForAllTests;
    146143    bool m_dumpPixelsForCurrentTest;
    147144    QString m_expectedHash;
  • trunk/Tools/DumpRenderTree/qt/main.cpp

    r124215 r124581  
    6767}
    6868
    69 // We only support -v or --pixel-tests or --stdout or --stderr or -, all the others will be
     69// We only support -v or --stdout or --stderr or -, all the others will be
    7070// pass as test case name (even -abc.html is a valid test case name)
    7171bool isOption(const QString& str)
    7272{
    73     return str == QString("-v") || str == QString("--pixel-tests")
     73    return str == QString("-v")
    7474           || str == QString("--stdout") || str == QString("--stderr")
    7575           || str == QString("--timeout") || str == QString("--no-timeout")
     
    9090void printUsage()
    9191{
    92     fprintf(stderr, "Usage: DumpRenderTree [-v|--pixel-tests] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n");
    93     fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath\n");
     92    fprintf(stderr, "Usage: DumpRenderTree [-v] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n");
     93    fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v] dirpath\n");
    9494    fflush(stderr);
    9595}
     
    159159    WebCore::DumpRenderTree dumper;
    160160
    161     int index = args.indexOf(QLatin1String("--pixel-tests"));
    162     if (index != -1) {
    163         dumper.setDumpPixelsForAllTests(true);
    164         args.removeAt(index);
    165     }
    166 
    167     index = args.indexOf(QLatin1String("--stdout"));
     161    int index = args.indexOf(QLatin1String("--stdout"));
    168162    if (index != -1) {
    169163        QString fileName = takeOptionValue(args, index);
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r124319 r124581  
    8181
    8282static bool dumpTree = true;
    83 static bool dumpPixels;
     83static bool dumpPixelsForCurrentTest;
    8484static bool dumpAllPixels;
    8585static bool printSeparators;
     
    760760    }
    761761
    762     if (dumpPixels
     762    if (dumpPixelsForCurrentTest
    763763     && gLayoutTestController->generatePixelResults()
    764764     && !gLayoutTestController->dumpDOMAsWebArchive()
     
    949949}
    950950
    951 static void runTest(const string& testPathOrURL)
    952 {
     951static void runTest(const string& inputLine)
     952{
     953    TestCommand command = parseInputLine(inputLine);
     954    const string& pathOrURL = command.pathOrURL;
     955    dumpPixelsForCurrentTest = command.shouldDumpPixels;
     956
    953957    static BSTR methodBStr = SysAllocString(TEXT("GET"));
    954958
    955     // Look for "'" as a separator between the path or URL, and the pixel dump hash that follows.
    956     string pathOrURL(testPathOrURL);
    957     string expectedPixelHash;
    958    
    959     size_t separatorPos = pathOrURL.find("'");
    960     if (separatorPos != string::npos) {
    961         pathOrURL = string(testPathOrURL, 0, separatorPos);
    962         expectedPixelHash = string(testPathOrURL, separatorPos + 1);
    963     }
    964    
    965959    BSTR urlBStr;
    966960 
     
    984978    CFRelease(url);
    985979
    986     ::gLayoutTestController = LayoutTestController::create(pathOrURL, expectedPixelHash);
     980    ::gLayoutTestController = LayoutTestController::create(pathOrURL, command.expectedPixelHash);
    987981    done = false;
    988982    topLoadingFrame = 0;
     
    13351329        if (!stricmp(argv[i], "--dump-all-pixels")) {
    13361330            dumpAllPixels = true;
    1337             continue;
    1338         }
    1339 
    1340         if (!stricmp(argv[i], "--pixel-tests")) {
    1341             dumpPixels = true;
    13421331            continue;
    13431332        }
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.vcproj

    r124319 r124581  
    564564                </File>
    565565                <File
     566                        RelativePath="..\DumpRenderTreeCommon.cpp"
     567                        >
     568                </File>
     569                <File
    566570                        RelativePath="..\DumpRenderTreePrefix.h"
    567571                        >
  • trunk/Tools/DumpRenderTree/wscript

    r124319 r124581  
    4141                ]
    4242sources = [
     43            'DumpRenderTreeCommon.cpp',
    4344            'LayoutTestController.cpp',
    4445            'WorkQueue.cpp',
  • trunk/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp

    r124319 r124581  
    5151volatile bool notified = false;
    5252static bool printSeparators = true;
    53 static int dumpPixels;
     53static int dumpPixelsForCurrentTest;
    5454static int dumpTree = 1;
    5555time_t startTime; // to detect timeouts / failed tests
     
    204204    }
    205205
    206     if (dumpPixels
     206    if (dumpPixelsForCurrentTest
    207207        && gLayoutTestController->generatePixelResults()
    208208        && !gLayoutTestController->dumpDOMAsWebArchive()
     
    219219}
    220220
    221 static void runTest(const wxString testPathOrURL)
     221static void runTest(const wxString inputLine)
    222222{
    223223    done = false;
    224224    time(&startTime);
    225     string pathOrURLString(testPathOrURL.char_str());
    226     string pathOrURL(pathOrURLString);
    227     string expectedPixelHash;
    228 
    229     size_t separatorPos = pathOrURL.find("'");
    230     if (separatorPos != string::npos) {
    231         pathOrURL = string(pathOrURLString, 0, separatorPos);
    232         expectedPixelHash = string(pathOrURLString, separatorPos + 1);
    233     }
     225
     226    TestCommand command = parseInputLine(std::string(inputLine.ToAscii()));
     227    string& pathOrURL = command.pathOrURL;
     228    dumpPixelsForCurrentTest = command.shouldDumpPixels;
    234229   
    235230    // CURL isn't happy if we don't have a protocol.
     
    238233        pathOrURL.insert(0, "file://");
    239234   
    240     gLayoutTestController = LayoutTestController::create(pathOrURL, expectedPixelHash);
     235    gLayoutTestController = LayoutTestController::create(pathOrURL, command.expectedPixelHash);
    241236    if (!gLayoutTestController) {
    242237        wxTheApp->ExitMainLoop();
     
    280275        if (!option.CmpNoCase(_T("--notree"))) {
    281276            dumpTree = false;
    282             continue;
    283         }
    284        
    285         if (!option.CmpNoCase(_T("--pixel-tests"))) {
    286             dumpPixels = true;
    287277            continue;
    288278        }
     
    324314   
    325315    } else {
    326         printSeparators = (optind < argc-1 || (dumpPixels && dumpTree));
     316        printSeparators = (optind < argc - 1 || (dumpPixelsForCurrentTest && dumpTree));
    327317        for (int i = optind; i != argc; ++i) {
    328318            runTest(wxTheApp->argv[1]);
  • trunk/Tools/GNUmakefile.am

    r124319 r124581  
    107107Programs_DumpRenderTree_SOURCES = \
    108108        Tools/DumpRenderTree/DumpRenderTree.h \
     109        Tools/DumpRenderTree/DumpRenderTreeCommon.cpp \
    109110        Tools/DumpRenderTree/DumpRenderTreePrefix.h \
    110111        Tools/DumpRenderTree/AccessibilityController.cpp \
  • trunk/Tools/Scripts/old-run-webkit-tests

    r124319 r124581  
    749749
    750750    # Try to read expected hash file for pixel tests
    751     my $suffixExpectedHash = "";
    752     if ($pixelTests && !$resetResults) {
    753         my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png");
    754         if (my $expectedHash = readChecksumFromPng(File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.png"))) {
    755             # Format expected hash into a suffix string that is appended to the path / URL passed to DRT.
    756             $suffixExpectedHash = "'$expectedHash";
     751    my $suffixPixelTest = "";
     752    if ($pixelTests) {
     753        # ' is the separator between arguments.
     754        $suffixPixelTest = "'--pixel-test";
     755        if (!$resetResults) {
     756            my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png");
     757            if (my $expectedHash = readChecksumFromPng(File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.png"))) {
     758                # Format expected hash into a suffix string that is appended to the path / URL passed to DRT.
     759                $suffixPixelTest = "'--pixel-test'$expectedHash";
     760            }
    757761        }
    758762    }
     
    790794            my $path = canonpath($test);
    791795            $path =~ s/^http\/tests\///;
    792             print OUT "http://127.0.0.1:$httpdPort/$path$suffixExpectedHash\n";
     796            print OUT "http://127.0.0.1:$httpdPort/$path$suffixPixelTest\n";
    793797        } elsif ($test =~ /^http\/tests\/ssl\//) {
    794798            my $path = canonpath($test);
    795799            $path =~ s/^http\/tests\///;
    796             print OUT "https://127.0.0.1:$httpdSSLPort/$path$suffixExpectedHash\n";
     800            print OUT "https://127.0.0.1:$httpdSSLPort/$path$suffixPixelTest\n";
    797801        } else {
    798802            my $testPath = "$testDirectory/$test";
     
    802806                $testPath = canonpath($testPath);
    803807            }
    804             print OUT "$testPath$suffixExpectedHash\n";
     808            print OUT "$testPath$suffixPixelTest\n";
    805809        }
    806810    } else {
     
    811815            $testPath = canonpath($testPath);
    812816        }
    813         print OUT "$testPath$suffixExpectedHash\n" if defined $testPath;
     817        print OUT "$testPath$suffixPixelTest\n" if defined $testPath;
    814818    }
    815819
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r124401 r124581  
    12791279        return []
    12801280
    1281     def supports_switching_pixel_tests_per_test(self):
    1282         if self.get_option('webkit_test_runner'):
    1283             return True
    1284         return self._supports_switching_pixel_tests_per_test()
    1285 
    1286     def _supports_switching_pixel_tests_per_test(self):
    1287         # FIXME: all ports should support it.
    1288         return False
    1289 
    12901281    def should_run_as_pixel_test(self, test_input):
    12911282        if not self._options.pixel_tests:
    12921283            return False
    1293         if not self.supports_switching_pixel_tests_per_test():
    1294             # Cannot do more filtering without this.
    1295             return True
    12961284        if self._options.pixel_test_directories:
    12971285            return any(test_input.test_name.startswith(directory) for directory in self._options.pixel_test_directories)
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py

    r124481 r124581  
    296296        cmd.extend(self._port.get_option('additional_drt_flag', []))
    297297
    298         if pixel_tests and not self._port.supports_switching_pixel_tests_per_test():
    299             cmd.append('--pixel-tests')
    300298        cmd.extend(per_test_args)
    301299
     
    338336        assert not driver_input.image_hash or driver_input.should_run_pixel_test
    339337
     338        # ' is the separator between arguments.
    340339        if driver_input.should_run_pixel_test:
    341             if self._port.supports_switching_pixel_tests_per_test():
    342                 # We did not start the driver with --pixel-tests, instead we specify it per test.
    343                 # "'" is the separator of command fields.
    344                 command += "'" + '--pixel-test'
     340            command += "'--pixel-test"
    345341        if driver_input.image_hash:
    346342            command += "'" + driver_input.image_hash
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/qt.py

    r124319 r124581  
    185185        return result
    186186
    187     def _supports_switching_pixel_tests_per_test(self):
    188         return True
    189 
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py

    r124319 r124581  
    514514        ]
    515515
    516     def supports_switching_pixel_tests_per_test(self):
    517         # Let it true so we can test the --pixel-test-directory option.
    518         return True
    519 
    520516
    521517class TestDriver(Driver):
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r124319 r124581  
    3636#include <WebKit2/WKPreferencesPrivate.h>
    3737#include <WebKit2/WKRetainPtr.h>
     38#include <algorithm>
    3839#include <cstdio>
     40#include <ctype.h>
     41#include <stdlib.h>
     42#include <string>
    3943#include <wtf/PassOwnPtr.h>
    4044
     
    6872
    6973TestController::TestController(int argc, const char* argv[])
    70     : m_dumpPixelsForAllTests(false)
    71     , m_verbose(false)
     74    : m_verbose(false)
    7275    , m_printSeparators(false)
    7376    , m_usingServerMode(false)
     
    268271        }
    269272
    270         if (argument == "--pixel-tests") {
    271             m_dumpPixelsForAllTests = true;
    272             continue;
    273         }
    274273        if (argument == "--verbose") {
    275274            m_verbose = true;
     
    505504}
    506505
    507 bool TestController::runTest(const char* test)
     506struct TestCommand {
     507    TestCommand() : shouldDumpPixels(false) { }
     508
     509    std::string pathOrURL;
     510    bool shouldDumpPixels;
     511    std::string expectedPixelHash;
     512};
     513
     514class CommandTokenizer {
     515public:
     516    explicit CommandTokenizer(const std::string& input)
     517        : m_input(input)
     518        , m_posNextSeparator(0)
     519    {
     520        pump();
     521    }
     522
     523    bool hasNext() const;
     524    std::string next();
     525
     526private:
     527    void pump();
     528    static const char kSeparator = '\'';
     529    const std::string& m_input;
     530    std::string m_next;
     531    size_t m_posNextSeparator;
     532};
     533
     534void CommandTokenizer::pump()
     535{
     536    if (m_posNextSeparator == std::string::npos || m_posNextSeparator == m_input.size()) {
     537        m_next = std::string();
     538        return;
     539    }
     540    size_t start = m_posNextSeparator ? m_posNextSeparator + 1 : 0;
     541    m_posNextSeparator = m_input.find(kSeparator, start);
     542    size_t size = m_posNextSeparator == std::string::npos ? std::string::npos : m_posNextSeparator - start;
     543    m_next = std::string(m_input, start, size);
     544}
     545
     546std::string CommandTokenizer::next()
     547{
     548    ASSERT(hasNext());
     549
     550    std::string oldNext = m_next;
     551    pump();
     552    return oldNext;
     553}
     554
     555bool CommandTokenizer::hasNext() const
     556{
     557    return !m_next.empty();
     558}
     559
     560NO_RETURN static void die(const std::string& inputLine)
     561{
     562    fprintf(stderr, "Unexpected input line: %s\n", inputLine.c_str());
     563    exit(1);
     564}
     565
     566TestCommand parseInputLine(const std::string& inputLine)
     567{
     568    TestCommand result;
     569    CommandTokenizer tokenizer(inputLine);
     570    if (!tokenizer.hasNext())
     571        die(inputLine);
     572
     573    result.pathOrURL = tokenizer.next();
     574    if (!tokenizer.hasNext())
     575        return result;
     576
     577    std::string arg = tokenizer.next();
     578    if (arg != std::string("-p") && arg != std::string("--pixel-test"))
     579        die(inputLine);
     580    result.shouldDumpPixels = true;
     581
     582    if (tokenizer.hasNext())
     583        result.expectedPixelHash = tokenizer.next();
     584
     585    return result;
     586}
     587
     588bool TestController::runTest(const char* inputLine)
    508589{
    509590    if (!resetStateToConsistentValues()) {
     
    518599    }
    519600
    520     bool dumpPixelsTest = m_dumpPixelsForAllTests;
    521     std::string command(test);
    522     std::string pathOrURL = command;
    523     std::string expectedPixelHash;
    524     size_t firstSeparatorPos = command.find_first_of('\'');
    525     size_t secondSeparatorPos = command.find_first_of('\'', firstSeparatorPos + 1);
    526     if (firstSeparatorPos != std::string::npos) {
    527         pathOrURL = std::string(command, 0, firstSeparatorPos);
    528         size_t pixelHashPos = firstSeparatorPos + 1;
    529 
    530         // NRWT passes --pixel-test if we should dump pixels for the test.
    531         const std::string expectedPixelTestArg("--pixel-test");
    532         std::string argTest = std::string(command, firstSeparatorPos + 1, expectedPixelTestArg.size());
    533         if (argTest == expectedPixelTestArg) {
    534             dumpPixelsTest = true;
    535             pixelHashPos = secondSeparatorPos == std::string::npos ? std::string::npos : secondSeparatorPos + 1;
    536         }
    537         if (pixelHashPos != std::string::npos && pixelHashPos < command.size())
    538             expectedPixelHash = std::string(command, pixelHashPos);
    539     }
     601    TestCommand command = parseInputLine(std::string(inputLine));
    540602
    541603    m_state = RunningTest;
    542604
    543     m_currentInvocation = adoptPtr(new TestInvocation(pathOrURL));
    544     if (dumpPixelsTest)
    545         m_currentInvocation->setIsPixelTest(expectedPixelHash);
     605    m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL));
     606    if (command.shouldDumpPixels)
     607        m_currentInvocation->setIsPixelTest(command.expectedPixelHash);
    546608
    547609    m_currentInvocation->invoke();
  • trunk/Tools/WebKitTestRunner/TestController.h

    r124319 r124581  
    105105    OwnPtr<TestInvocation> m_currentInvocation;
    106106
    107     bool m_dumpPixelsForAllTests;
    108107    bool m_verbose;
    109108    bool m_printSeparators;
Note: See TracChangeset for help on using the changeset viewer.