From: commit-queue@webkit.org Date: Tue, 3 Jul 2012 03:23:43 +0000 (+0000) Subject: [BlackBerry] Update DumpRenderTree to have it work interactively in parallel X-Git-Tag: 070512121124~173 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=464a57b3a9575fde120d84c597ec52c5e8fa5893;p=profile%2Fivi%2Fwebkit-efl.git [BlackBerry] Update DumpRenderTree to have it work interactively in parallel https://bugs.webkit.org/show_bug.cgi?id=88326 Patch by Xiaobo Wang on 2012-07-02 Reviewed by Rob Buis. 1. Test name is sent to torch-launcher via PPS message(from host machine). So we get test list by monitoring and receiving PPS message instead of reading file index.drt. 2. Torch-launcher create a .done file when it finished a test. 3. We don't need to search for Ref-tests in DumpRenderTree.cpp any more. NRWT will get them for us. * DumpRenderTree/blackberry/DumpRenderTree.cpp: (BlackBerry::WebKit::DumpRenderTree::DumpRenderTree): (BlackBerry::WebKit::DumpRenderTree::doneDrt): (BlackBerry::WebKit::DumpRenderTree::runRemainingTests): (BlackBerry::WebKit::DumpRenderTree::ensurePPS): (WebKit): (BlackBerry::WebKit::DumpRenderTree::handlePPSData): (BlackBerry::WebKit::DumpRenderTree::waitForTest): (BlackBerry::WebKit::DumpRenderTree::runTests): (BlackBerry::WebKit::DumpRenderTree::dump): * DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h: (DumpRenderTree): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121723 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Tools/ChangeLog b/Tools/ChangeLog index e3a9c25..e20e177 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,30 @@ +2012-07-02 Xiaobo Wang + + [BlackBerry] Update DumpRenderTree to have it work interactively in parallel + https://bugs.webkit.org/show_bug.cgi?id=88326 + + Reviewed by Rob Buis. + + 1. Test name is sent to torch-launcher via PPS message(from host machine). + So we get test list by monitoring and receiving PPS message instead of + reading file index.drt. + 2. Torch-launcher create a .done file when it finished a test. + 3. We don't need to search for Ref-tests in DumpRenderTree.cpp any more. NRWT + will get them for us. + + * DumpRenderTree/blackberry/DumpRenderTree.cpp: + (BlackBerry::WebKit::DumpRenderTree::DumpRenderTree): + (BlackBerry::WebKit::DumpRenderTree::doneDrt): + (BlackBerry::WebKit::DumpRenderTree::runRemainingTests): + (BlackBerry::WebKit::DumpRenderTree::ensurePPS): + (WebKit): + (BlackBerry::WebKit::DumpRenderTree::handlePPSData): + (BlackBerry::WebKit::DumpRenderTree::waitForTest): + (BlackBerry::WebKit::DumpRenderTree::runTests): + (BlackBerry::WebKit::DumpRenderTree::dump): + * DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h: + (DumpRenderTree): + 2012-07-02 Adam Barth Remove flashplugin-installer from the EWS image because it causes some tests to crash diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp index a19742c..11f390e 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp @@ -61,6 +61,7 @@ #include "WebPageClient.h" #include "WorkQueue.h" #include "WorkQueueItem.h" +#include #include #include #include @@ -156,13 +157,12 @@ DumpRenderTree::DumpRenderTree(BlackBerry::WebKit::WebPage* page) , m_waitToDumpWatchdogTimer(this, &DumpRenderTree::waitToDumpWatchdogTimerFired) , m_workTimer(this, &DumpRenderTree::processWork) , m_acceptsEditing(true) - , m_runningRefTests(false) { + const char* workerNumber = getenv("WORKER_NUMBER") ? getenv("WORKER_NUMBER") : "0"; String sdcardPath = SDCARD_PATH; m_resultsDir = sdcardPath + "/results/"; - m_indexFile = sdcardPath + "/index.drt"; - m_doneFile = sdcardPath + "/done"; - m_currentTestFile = sdcardPath + "/current.drt"; + m_doneFile = sdcardPath + "/done" + workerNumber; + m_currentTestFile = sdcardPath + "/current" + workerNumber + ".drt"; m_page->resetVirtualViewportOnCommitted(false); m_page->setVirtualViewportSize(800, 600); s_currentInstance = this; @@ -200,36 +200,13 @@ void DumpRenderTree::doneDrt() { fclose(stdout); fclose(stderr); + unlink(getPPSPath().c_str()); // Notify the external world that we're done. createFile(m_doneFile); (m_page->client())->notifyRunLayoutTestsFinished(); } -void DumpRenderTree::getRefTests(const String& testName) -{ - if (m_runningRefTests) - return; - - const char* suffixes[] = {"-expected", "-expected-mismatch"}; - const int countofSuffixes = sizeof(suffixes) / sizeof(const char*); - // FIXME: Currently we only have ref tests with .html extension, you many need to add more - // when they have more extensions(.htm, .shtml, .xhtml, etc.). - const char* extensions[] = {".html", ".svg"}; - const int countofExtensions = sizeof(extensions) / sizeof(const char*); - String layoutDir = kSDCLayoutTestsURI + 7; // 7: strlen("file://"), layoutDir: "/developer/LayoutTests/" - - size_t iEnd = testName.reverseFind('.'); - - String nameWithoutExtension = testName.substring(0, iEnd); - for (int i = 0; i < countofSuffixes; ++i) - for (int j = 0; j < countofExtensions; ++j) { - String candidateFile = layoutDir + nameWithoutExtension + suffixes[i] + extensions[j]; - if (!access(candidateFile.utf8().data(), F_OK)) - m_refTests.append(nameWithoutExtension + suffixes[i] + extensions[j]); - } -} - void DumpRenderTree::runCurrentTest() { if (isHTTPTest(m_currentTest->utf8().data())) { @@ -247,20 +224,17 @@ void DumpRenderTree::runRemainingTests() fflush(stderr); if (m_currentTest >= m_tests.end() - 1) { - // Run ref-tests after real tests were finished - if (!m_runningRefTests && !m_refTests.isEmpty()) { - m_tests.clear(); - m_tests.append(m_refTests); - m_refTests.clear(); + m_tests.clear(); + if (m_bufferedTests.size() > 0) { + m_tests.append(m_bufferedTests); + m_bufferedTests.clear(); m_currentTest = m_tests.begin(); - m_runningRefTests = true; - } else { - doneDrt(); - return; + runCurrentTest(); } - } else - m_currentTest++; + return; + } + m_currentTest++; runCurrentTest(); } @@ -346,20 +320,35 @@ void DumpRenderTree::runTests() { m_gcController = new GCController(); m_accessibilityController = new AccessibilityController(); - getTestsToRun(); + if (!ensurePPS()) { + fprintf(stderr, "Failed to open PPS file '%s', error=%d\n", getPPSPath().c_str(), errno); + (m_page->client())->notifyRunLayoutTestsFinished(); + return; + } mainFrame = DumpRenderTreeSupport::corePage(m_page)->mainFrame(); - m_currentTest = m_tests.begin(); + // Get Test file name from PPS: /pps/services/drt/input + // Example: test_file::fast/js/arguments.html + waitForTest(); +} - if (m_currentTest == m_tests.end()) { +void DumpRenderTree::addTest(const char* testFile) +{ + String test(testFile); + if (test == "#DONE") doneDrt(); - return; + else if (!test.isEmpty()) { + if (m_tests.isEmpty()) { + // No test is being run, initialize iterator and start test + m_tests.append(test); + m_currentTest = m_tests.begin(); + runCurrentTest(); + } else + m_bufferedTests.append(test); } - runCurrentTest(); } - String DumpRenderTree::dumpFramesAsText(WebCore::Frame* frame) { String s; @@ -395,28 +384,6 @@ bool DumpRenderTree::isHTTPTest(const String& test) && testLower.substring(lenHttpTestSyntax, strlen(localTestSyntax)) != localTestSyntax; } -void DumpRenderTree::getTestsToRun() -{ - Vector files; - - FILE* fd = fopen(m_indexFile.utf8().data(), "r"); - fseek(fd, 0, SEEK_END); - int size = ftell(fd); - fseek(fd, 0, SEEK_SET); - OwnArrayPtr buf = adoptArrayPtr(new char[size]); - fread(buf.get(), 1, size, fd); - fclose(fd); - String s(buf.get(), size); - s.split("\n", files); - - m_tests = files; - - // Find ref-tests for each of the real tests, one test may have multiple expected ref-tests - // and multiple mismatch ref-tests. - for (Vector::iterator iter = files.begin(); files.end() != iter; ++iter) - getRefTests(*iter); -} - void DumpRenderTree::invalidateAnyPreviousWaitToDumpWatchdog() { m_waitToDumpWatchdogTimer.stop(); @@ -511,6 +478,9 @@ static String dumpBackForwardListForWebView() void DumpRenderTree::dump() { + if (testDone) + return; + invalidateAnyPreviousWaitToDumpWatchdog(); String dumpFile = m_resultsDir + *m_currentTest + ".dump"; @@ -533,6 +503,9 @@ void DumpRenderTree::dump() String crashFile = dumpFile + ".crash"; unlink(crashFile.utf8().data()); + String doneFile = m_resultsDir + *m_currentTest + ".done"; + createFile(doneFile); + testDone = true; runRemainingTests(); } diff --git a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h index c6eba9d..4ca9a3f 100644 --- a/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h +++ b/Tools/DumpRenderTree/blackberry/DumpRenderTreeBlackBerry.h @@ -21,9 +21,11 @@ #include "BlackBerryGlobal.h" + #include "DumpRenderTreeClient.h" #include "PlatformString.h" #include "Timer.h" +#include #include #include @@ -45,7 +47,7 @@ namespace BlackBerry { namespace WebKit { class WebPage; -class DumpRenderTree : public BlackBerry::WebKit::DumpRenderTreeClient { +class DumpRenderTree : public BlackBerry::WebKit::DumpRenderTreeClient, public BlackBerry::Platform::LayoutTestClient { public: DumpRenderTree(WebPage*); virtual ~DumpRenderTree(); @@ -104,11 +106,12 @@ public: void setSelectTrailingWhitespaceEnabled(bool enabled) { s_selectTrailingWhitespaceEnabled = enabled; } bool didReceiveAuthenticationChallenge(WebCore::Credential&); + // BlackBerry::Platform::BlackBerryPlatformLayoutTestClient method + virtual void addTest(const char* testFile); private: void runTest(const String& url); void runTests(); void runCurrentTest(); - void getRefTests(const String& testName); void processWork(WebCore::Timer*); @@ -119,7 +122,6 @@ private: void locationChangeForFrame(WebCore::Frame*); void doneDrt(); - void getTestsToRun(); bool isHTTPTest(const String& test); String renderTreeDump() const; void resetToConsistentStateBeforeTesting(); @@ -129,10 +131,9 @@ private: Vector m_tests; Vector::iterator m_currentTest; - Vector m_refTests; // Reference tests for current test + Vector m_bufferedTests; String m_resultsDir; - String m_indexFile; String m_doneFile; String m_currentHttpTest; String m_currentTestFile; @@ -146,7 +147,6 @@ private: bool m_acceptsEditing; bool m_loadFinished; - bool m_runningRefTests; static bool s_selectTrailingWhitespaceEnabled; }; }