Title: [133574] trunk/Tools
Revision
133574
Author
[email protected]
Date
2012-11-06 02:12:29 -0800 (Tue, 06 Nov 2012)

Log Message

DumpRenderTree should have --pixel-tests option again
https://bugs.webkit.org/show_bug.cgi?id=98648

Reviewed by Dirk Pranke.

Add back the --pixel-tests command line option to DumpRenderTree.
It was removed r124581 because tools don't use it after that patch.
However, it turned out that it is useful for debugging and working
with pixel tests.

* DumpRenderTree/efl/DumpRenderTree.cpp:
(parseCommandLineOptions):
(runTest):
* DumpRenderTree/gtk/DumpRenderTree.cpp:
(initializeGlobalsFromCommandLineOptions):
(runTest):
* DumpRenderTree/mac/DumpRenderTree.mm:
(initializeGlobalsFromCommandLineOptions):
(runTest):
* DumpRenderTree/qt/DumpRenderTreeMain.cpp:
(isOption):
(printUsage):
(main):
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::processLine):
* DumpRenderTree/qt/DumpRenderTreeQt.h:
(WebCore::DumpRenderTree::setShouldDumpPixelsForAllTests):
(DumpRenderTree):
* DumpRenderTree/win/DumpRenderTree.cpp:
(runTest):
(dllLauncherEntryPoint):
* DumpRenderTree/wx/DumpRenderTreeWx.cpp:
(runTest):
(MyApp::OnInit):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::TestController):
(WTR::TestController::initialize):
(WTR::TestController::runTest):
* WebKitTestRunner/TestController.h:
(TestController):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (133573 => 133574)


--- trunk/Tools/ChangeLog	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/ChangeLog	2012-11-06 10:12:29 UTC (rev 133574)
@@ -1,3 +1,46 @@
+2012-11-06  Balazs Kelemen  <[email protected]>
+
+        DumpRenderTree should have --pixel-tests option again
+        https://bugs.webkit.org/show_bug.cgi?id=98648
+
+        Reviewed by Dirk Pranke.
+
+        Add back the --pixel-tests command line option to DumpRenderTree.
+        It was removed r124581 because tools don't use it after that patch.
+        However, it turned out that it is useful for debugging and working
+        with pixel tests.
+
+        * DumpRenderTree/efl/DumpRenderTree.cpp:
+        (parseCommandLineOptions):
+        (runTest):
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (initializeGlobalsFromCommandLineOptions):
+        (runTest):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (initializeGlobalsFromCommandLineOptions):
+        (runTest):
+        * DumpRenderTree/qt/DumpRenderTreeMain.cpp:
+        (isOption):
+        (printUsage):
+        (main):
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::DumpRenderTree::processLine):
+        * DumpRenderTree/qt/DumpRenderTreeQt.h:
+        (WebCore::DumpRenderTree::setShouldDumpPixelsForAllTests):
+        (DumpRenderTree):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (runTest):
+        (dllLauncherEntryPoint):
+        * DumpRenderTree/wx/DumpRenderTreeWx.cpp:
+        (runTest):
+        (MyApp::OnInit):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::TestController):
+        (WTR::TestController::initialize):
+        (WTR::TestController::runTest):
+        * WebKitTestRunner/TestController.h:
+        (TestController):
+
 2012-11-05  Dirk Pranke  <[email protected]>
 
         webkit-patch rebaseline*: fix typo for --results-directory

Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp (133573 => 133574)


--- trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp	2012-11-06 10:12:29 UTC (rev 133574)
@@ -66,6 +66,7 @@
 volatile bool done = false;
 
 static bool dumpPixelsForCurrentTest;
+static int dumpPixelsForAllTests = false;
 static int dumpTree = true;
 static int printSeparators = true;
 
@@ -192,6 +193,7 @@
 {
     static const option options[] = {
         {"notree", no_argument, &dumpTree, false},
+        {"pixel-tests", no_argument, &dumpPixelsForAllTests, true},
         {"tree", no_argument, &dumpTree, true},
         {0, 0, 0, 0}
     };
@@ -258,7 +260,7 @@
     TestCommand command = parseInputLine(inputLine);
     const String testPathOrURL(command.pathOrURL.c_str());
     ASSERT(!testPathOrURL.isEmpty());
-    dumpPixelsForCurrentTest = command.shouldDumpPixels;
+    dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests;
     const String expectedPixelHash(command.expectedPixelHash.c_str());
 
     // Convert the path into a full file URL if it does not look

Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (133573 => 133574)


--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2012-11-06 10:12:29 UTC (rev 133574)
@@ -73,6 +73,7 @@
 
 volatile bool done;
 static bool printSeparators;
+static int dumpPixelsForAllTests = false;
 static bool dumpPixelsForCurrentTest;
 static int dumpTree = 1;
 static int useTimeoutWatchdog = 1;
@@ -548,6 +549,7 @@
 {
     struct option options[] = {
         {"notree", no_argument, &dumpTree, false},
+        {"pixel-tests", no_argument, &dumpPixelsForAllTests, true},
         {"tree", no_argument, &dumpTree, true},
         {"no-timeout", no_argument, &useTimeoutWatchdog, false},
         {NULL, 0, NULL, 0}
@@ -692,7 +694,7 @@
 
     TestCommand command = parseInputLine(inputLine);
     string& testURL = command.pathOrURL;
-    dumpPixelsForCurrentTest = command.shouldDumpPixels;
+    dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests;
 
     // Convert the path into a full file URL if it does not look
     // like an HTTP/S URL (doesn't start with http:// or https://).

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (133573 => 133574)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2012-11-06 10:12:29 UTC (rev 133574)
@@ -145,6 +145,7 @@
 PolicyDelegate *policyDelegate;
 StorageTrackerDelegate *storageDelegate;
 
+static int dumpPixelsForAllTests = NO;
 static bool dumpPixelsForCurrentTest;
 static int threaded;
 static int dumpTree = YES;
@@ -792,6 +793,7 @@
 {
     struct option options[] = {
         {"notree", no_argument, &dumpTree, NO},
+        {"pixel-tests", no_argument, &dumpPixelsForAllTests, YES},
         {"tree", no_argument, &dumpTree, YES},
         {"threaded", no_argument, &threaded, YES},
         {"complex-text", no_argument, &forceComplexText, YES},
@@ -1300,7 +1302,7 @@
 
     TestCommand command = parseInputLine(inputLine);
     const string& pathOrURL = command.pathOrURL;
-    dumpPixelsForCurrentTest = command.shouldDumpPixels;
+    dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests;
 
     NSString *pathOrURLString = [NSString stringWithUTF8String:pathOrURL.c_str()];
     if (!pathOrURLString) {

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp (133573 => 133574)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeMain.cpp	2012-11-06 10:12:29 UTC (rev 133574)
@@ -65,11 +65,11 @@
     // do nothing
 }
 
-// We only support -v or --stdout or --stderr or -, all the others will be
+// We only support -v, -p, --pixel-tests, --stdout, --stderr and -, all the others will be
 // pass as test case name (even -abc.html is a valid test case name)
 bool isOption(const QString& str)
 {
-    return str == QString("-v")
+    return str == QString("-v") || str == QString("-p") || str == QString("--pixel-tests")
            || str == QString("--stdout") || str == QString("--stderr")
            || str == QString("--timeout") || str == QString("--no-timeout")
            || str == QString("-");
@@ -88,8 +88,8 @@
 
 void printUsage()
 {
-    fprintf(stderr, "Usage: DumpRenderTree [-v] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n");
-    fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v] dirpath\n");
+    fprintf(stderr, "Usage: DumpRenderTree [-v|-p|--pixel-tests] [--stdout output_filename] [-stderr error_filename] [--no-timeout] [--timeout timeout_MS] filename [filename2..n]\n");
+    fprintf(stderr, "Or folder containing test files: DumpRenderTree [-v|--pixel-tests] dirpath\n");
     fflush(stderr);
 }
 
@@ -155,6 +155,14 @@
             exit(1);
         }
     }
+    index = args.indexOf("--pixel-tests");
+    if (index == -1)
+        index = args.indexOf("-p");
+    if (index != -1) {
+        dumper.setShouldDumpPixelsForAllTests();
+        args.removeAt(index);
+    }
+
     QWebDatabase::removeAllDatabases();
 
     index = args.indexOf(QLatin1String("--timeout"));

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (133573 => 133574)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2012-11-06 10:12:29 UTC (rev 133574)
@@ -388,7 +388,8 @@
 }
 
 DumpRenderTree::DumpRenderTree()
-    : m_stdin(0)
+    : m_dumpPixelsForAllTests(false)
+    , m_stdin(0)
     , m_enableTextOutput(false)
     , m_standAloneMode(false)
     , m_graphicsBased(false)
@@ -691,7 +692,7 @@
 {
     TestCommand command = parseInputLine(std::string(input.toLatin1().constData()));
     QString pathOrURL = QLatin1String(command.pathOrURL.c_str());
-    m_dumpPixelsForCurrentTest = command.shouldDumpPixels;
+    m_dumpPixelsForCurrentTest = command.shouldDumpPixels || m_dumpPixelsForAllTests;
     m_expectedHash = QLatin1String(command.expectedPixelHash.c_str());
 
     if (pathOrURL.startsWith(QLatin1String("http:"))

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h (133573 => 133574)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.h	2012-11-06 10:12:29 UTC (rev 133574)
@@ -105,6 +105,7 @@
 
     void setTimeout(int);
     void setShouldTimeout(bool flag);
+    void setShouldDumpPixelsForAllTests() { m_dumpPixelsForAllTests = true; }
 
 public Q_SLOTS:
     void initJSObjects();
@@ -141,6 +142,7 @@
     TestRunner *m_controller;
 
     bool m_dumpPixelsForCurrentTest;
+    bool m_dumpPixelsForAllTests;
     QString m_expectedHash;
     QStringList m_standAloneModeTestList;
 

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (133573 => 133574)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2012-11-06 10:12:29 UTC (rev 133574)
@@ -80,6 +80,7 @@
 const LPCWSTR kDumpRenderTreeClassName = L"DumpRenderTreeWindow";
 
 static bool dumpTree = true;
+static bool dumpPixelsForAllTests = false;
 static bool dumpPixelsForCurrentTest;
 static bool dumpAllPixels;
 static bool printSeparators;
@@ -952,7 +953,7 @@
 {
     TestCommand command = parseInputLine(inputLine);
     const string& pathOrURL = command.pathOrURL;
-    dumpPixelsForCurrentTest = command.shouldDumpPixels;
+    dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests;
 
     static BSTR methodBStr = SysAllocString(TEXT("GET"));
 
@@ -1341,6 +1342,11 @@
             continue;
         }
 
+        if (!stricmp(argv[i], "--pixel-tests")) {
+            dumpPixelsForAllTests = true;
+            continue;
+        }
+
         tests.append(argv[i]);
     }
 

Modified: trunk/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp (133573 => 133574)


--- trunk/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp	2012-11-06 10:12:29 UTC (rev 133574)
@@ -50,6 +50,7 @@
 volatile bool done = true;
 volatile bool notified = false;
 static bool printSeparators = true;
+static int dumpPixelsForAllTests = false;
 static int dumpPixelsForCurrentTest;
 static int dumpTree = 1;
 time_t startTime; // to detect timeouts / failed tests
@@ -225,7 +226,7 @@
 
     TestCommand command = parseInputLine(std::string(inputLine.ToAscii()));
     string& pathOrURL = command.pathOrURL;
-    dumpPixelsForCurrentTest = command.shouldDumpPixels;
+    dumpPixelsForCurrentTest = command.shouldDumpPixels || dumpPixelsForAllTests;
     
     // CURL isn't happy if we don't have a protocol.
     size_t http = pathOrURL.find("http://");
@@ -281,6 +282,11 @@
             dumpTree = true;
             continue;
         }
+
+        if (!option.CmpNoCase(_T("--pixel-tests"))) {
+            dumpPixelsForAllTests = true;
+            continue;
+        }
     }
     wxInitAllImageHandlers();
         

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (133573 => 133574)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2012-11-06 10:12:29 UTC (rev 133574)
@@ -81,6 +81,7 @@
     , m_printSeparators(false)
     , m_usingServerMode(false)
     , m_gcBetweenTests(false)
+    , m_shouldDumpPixelsForAllTests(false)
     , m_state(Initial)
     , m_doneResetting(false)
     , m_longTimeout(defaultLongTimeout)
@@ -283,11 +284,16 @@
             m_gcBetweenTests = true;
             continue;
         }
+        if (argument == "--pixel-tests" || argument == "-p") {
+            m_shouldDumpPixelsForAllTests = true;
+            continue;
+        }
         if (argument == "--print-supported-features") {
             printSupportedFeatures = true;
             break;
         }
 
+
         // Skip any other arguments that begin with '--'.
         if (argument.length() >= 2 && argument[0] == '-' && argument[1] == '-')
             continue;
@@ -660,7 +666,7 @@
     m_state = RunningTest;
 
     m_currentInvocation = adoptPtr(new TestInvocation(command.pathOrURL));
-    if (command.shouldDumpPixels)
+    if (command.shouldDumpPixels || m_shouldDumpPixelsForAllTests)
         m_currentInvocation->setIsPixelTest(command.expectedPixelHash);
 
     m_currentInvocation->invoke();

Modified: trunk/Tools/WebKitTestRunner/TestController.h (133573 => 133574)


--- trunk/Tools/WebKitTestRunner/TestController.h	2012-11-06 10:06:27 UTC (rev 133573)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2012-11-06 10:12:29 UTC (rev 133574)
@@ -140,6 +140,7 @@
     bool m_printSeparators;
     bool m_usingServerMode;
     bool m_gcBetweenTests;
+    bool m_shouldDumpPixelsForAllTests;
     std::vector<std::string> m_paths;
     WKRetainPtr<WKStringRef> m_injectedBundlePath;
     WKRetainPtr<WKStringRef> m_testPluginDirectory;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to