+2012-07-02 Xiaobo Wang <xbwang@torchmobile.com.cn>
+
+ [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 <test file>.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 <abarth@webkit.org>
Remove flashplugin-installer from the EWS image because it causes some tests to crash
#include "WebPageClient.h"
#include "WorkQueue.h"
#include "WorkQueueItem.h"
+#include <BlackBerryPlatformLayoutTest.h>
#include <WebSettings.h>
#include <stdio.h>
#include <sys/stat.h>
, 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;
{
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())) {
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();
}
{
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;
&& testLower.substring(lenHttpTestSyntax, strlen(localTestSyntax)) != localTestSyntax;
}
-void DumpRenderTree::getTestsToRun()
-{
- Vector<String> files;
-
- FILE* fd = fopen(m_indexFile.utf8().data(), "r");
- fseek(fd, 0, SEEK_END);
- int size = ftell(fd);
- fseek(fd, 0, SEEK_SET);
- OwnArrayPtr<char> 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<String>::iterator iter = files.begin(); files.end() != iter; ++iter)
- getRefTests(*iter);
-}
-
void DumpRenderTree::invalidateAnyPreviousWaitToDumpWatchdog()
{
m_waitToDumpWatchdogTimer.stop();
void DumpRenderTree::dump()
{
+ if (testDone)
+ return;
+
invalidateAnyPreviousWaitToDumpWatchdog();
String dumpFile = m_resultsDir + *m_currentTest + ".dump";
String crashFile = dumpFile + ".crash";
unlink(crashFile.utf8().data());
+ String doneFile = m_resultsDir + *m_currentTest + ".done";
+ createFile(doneFile);
+
testDone = true;
runRemainingTests();
}
#include "BlackBerryGlobal.h"
+
#include "DumpRenderTreeClient.h"
#include "PlatformString.h"
#include "Timer.h"
+#include <BlackBerryPlatformLayoutTest.h>
#include <FindOptions.h>
#include <wtf/Vector.h>
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();
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<DumpRenderTree>*);
void locationChangeForFrame(WebCore::Frame*);
void doneDrt();
- void getTestsToRun();
bool isHTTPTest(const String& test);
String renderTreeDump() const;
void resetToConsistentStateBeforeTesting();
Vector<String> m_tests;
Vector<String>::iterator m_currentTest;
- Vector<String> m_refTests; // Reference tests for current test
+ Vector<String> m_bufferedTests;
String m_resultsDir;
- String m_indexFile;
String m_doneFile;
String m_currentHttpTest;
String m_currentTestFile;
bool m_acceptsEditing;
bool m_loadFinished;
- bool m_runningRefTests;
static bool s_selectTrailingWhitespaceEnabled;
};
}