⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 run-webkit-tests

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻
📖 第 1 页 / 共 5 页
字号:
        $simplified_actual =~ s/- /-/g;        $simplified_actual =~ s/\n( *)"\s+/\n$1"/g;        $simplified_actual =~ s/\s+"\n/"\n/g;                $expectedMac =~ s/at \(-?[0-9]+,-?[0-9]+\) *//g;        $expectedMac =~ s/size -?[0-9]+x-?[0-9]+ *//g;        $expectedMac =~ s/text run width -?[0-9]+: //g;        $expectedMac =~ s/text run width -?[0-9]+ [a-zA-Z ]+: //g;        $expectedMac =~ s/RenderButton {BUTTON} .*/RenderButton {BUTTON}/g;        $expectedMac =~ s/RenderImage {INPUT} .*/RenderImage {INPUT}/g;        $expectedMac =~ s/RenderBlock {INPUT} .*/RenderBlock {INPUT}/g;        $expectedMac =~ s/RenderTextControl {INPUT} .*/RenderTextControl {INPUT}/g;        $expectedMac =~ s/\([0-9]+px/px/g;        $expectedMac =~ s/ *" *\n +" */ /g;        $expectedMac =~ s/" +$/"/g;        $expectedMac =~ s/- /-/g;        $expectedMac =~ s/\n( *)"\s+/\n$1"/g;        $expectedMac =~ s/\s+"\n/"\n/g;                if ($simplified_actual ne $expectedMac) {          writeToFile("/tmp/actual.txt", $simplified_actual);          writeToFile("/tmp/expected.txt", $expectedMac);          system "diff -u \"/tmp/expected.txt\" \"/tmp/actual.txt\" > \"/tmp/simplified.diff\"";          $diffResult = "failed";          if ($verbose) {            print "\n";            system "cat /tmp/simplified.diff";            print "failed!!!!!";          }        }      }    }    if (dumpToolDidCrash()) {        $result = "crash";        testCrashedOrTimedOut($test, $base, 1, $actual, $error);    } elsif (!defined $expected) {        if ($verbose) {            print "new " . ($resetResults ? "result" : "test") ."\n";            $atLineStart = 1;        }        $result = "new";        if ($generateNewResults || $resetResults) {            mkpath catfile($expectedDir, dirname($base)) if $testDirectory ne $expectedDir;            writeToFile("$expectedDir/$expectedFileName", $actual);        }        deleteExpectedAndActualResults($base);        if ($generateNewResults && !$resetResults) {            # Always print the file name for new tests, as they will probably need some manual inspection.            # in verbose mode we already printed the test case, so no need to do it again.            unless ($verbose) {                print "\n" unless $atLineStart;                print "$test -> ";            }            my $resultsDir = catdir($expectedDir, dirname($base));            print "new (results generated in $resultsDir)\n";            $atLineStart = 1;        }    } elsif ($actual eq $expected && $diffResult eq "passed") {        if ($verbose) {            print "succeeded\n";            $atLineStart = 1;        }        $result = "match";        deleteExpectedAndActualResults($base);    } else {        $result = "mismatch";        my $message = $actual eq $expected ? "pixel test failed" : "failed";        if ($actual ne $expected && $addPlatformExceptions) {            my $testBase = catfile($testDirectory, $base);            my $expectedBase = catfile($expectedDir, $base);            my $testIsMaximallyPlatformSpecific = $testBase =~ m|^\Q$platformTestDirectory\E/|;            my $expectedResultIsMaximallyPlatformSpecific = $expectedBase =~ m|^\Q$platformTestDirectory\E/|;            if (!$testIsMaximallyPlatformSpecific && !$expectedResultIsMaximallyPlatformSpecific) {                mkpath catfile($platformTestDirectory, dirname($base));                my $expectedFile = catfile($platformTestDirectory, "$expectedFileName");                writeToFile("$expectedFile", $actual);                $message .= " (results generated in $platformTestDirectory)";            }        }        printFailureMessageForTest($test, $message);        my $dir = "$testResultsDirectory/$base";        $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n";        my $testName = $1;        mkpath $dir;        deleteExpectedAndActualResults($base);        recordActualResultsAndDiff($base, $actual);        if ($pixelTests && $diffPNG && $diffPNG ne "") {            $imagesPresent{$base} = 1;            writeToFile("$testResultsDirectory/$base-$actualTag.png", $actualPNG);            writeToFile("$testResultsDirectory/$base-$diffsTag.png", $diffPNG);            my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png");            copy("$expectedPixelDir/$base-$expectedTag.png", "$testResultsDirectory/$base-$expectedTag.png");            open DIFFHTML, ">$testResultsDirectory/$base-$diffsTag.html" or die;            print DIFFHTML "<html>\n";            print DIFFHTML "<head>\n";            print DIFFHTML "<title>$base Image Compare</title>\n";            print DIFFHTML "<script language=\"Javascript\" type=\"text/javascript\">\n";            print DIFFHTML "var currentImage = 0;\n";            print DIFFHTML "var imageNames = new Array(\"Actual\", \"Expected\");\n";            print DIFFHTML "var imagePaths = new Array(\"$testName-$actualTag.png\", \"$testName-$expectedTag.png\");\n";            if (-f "$testDirectory/$base-w3c.png") {                copy("$testDirectory/$base-w3c.png", "$testResultsDirectory/$base-w3c.png");                print DIFFHTML "imageNames.push(\"W3C\");\n";                print DIFFHTML "imagePaths.push(\"$testName-w3c.png\");\n";            }            print DIFFHTML "function animateImage() {\n";            print DIFFHTML "    var image = document.getElementById(\"animatedImage\");\n";            print DIFFHTML "    var imageText = document.getElementById(\"imageText\");\n";            print DIFFHTML "    image.src = imagePaths[currentImage];\n";            print DIFFHTML "    imageText.innerHTML = imageNames[currentImage] + \" Image\";\n";            print DIFFHTML "    currentImage = (currentImage + 1) % imageNames.length;\n";            print DIFFHTML "    setTimeout('animateImage()',2000);\n";            print DIFFHTML "}\n";            print DIFFHTML "</script>\n";            print DIFFHTML "</head>\n";            print DIFFHTML "<body onLoad=\"animateImage();\">\n";            print DIFFHTML "<table>\n";            if ($diffPercentage) {                print DIFFHTML "<tr>\n";                print DIFFHTML "<td>Difference between images: <a href=\"$testName-$diffsTag.png\">$diffPercentage%</a></td>\n";                print DIFFHTML "</tr>\n";            }            print DIFFHTML "<tr>\n";            print DIFFHTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">test file</a></td>\n";            print DIFFHTML "</tr>\n";            print DIFFHTML "<tr>\n";            print DIFFHTML "<td id=\"imageText\" style=\"text-weight: bold;\">Actual Image</td>\n";            print DIFFHTML "</tr>\n";            print DIFFHTML "<tr>\n";            print DIFFHTML "<td><img src=\"$testName-$actualTag.png\" id=\"animatedImage\"></td>\n";            print DIFFHTML "</tr>\n";            print DIFFHTML "</table>\n";            print DIFFHTML "</body>\n";            print DIFFHTML "</html>\n";        }    }    if ($error) {        my $dir = "$testResultsDirectory/$base";        $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n";        mkpath $dir;                writeToFile("$testResultsDirectory/$base-$errorTag.txt", $error);                $counts{error}++;        push @{$tests{error}}, $test;    }    countFinishedTest($test, $base, $result, $isText);}printf "\n%0.2fs total testing time\n", (time - $overallStartTime) . "";!$isDumpToolOpen || die "Failed to close $dumpToolName.\n";closeHTTPD();# Because multiple instances of this script are running concurrently we cannot # safely delete this symlink.# system "rm /tmp/LayoutTests";# FIXME: Do we really want to check the image-comparison tool for leaks every time?if ($shouldCheckLeaks && $pixelTests) {    $totalLeaks += countAndPrintLeaks("ImageDiff", $imageDiffToolPID, "$testResultsDirectory/ImageDiff-leaks.txt");}if ($totalLeaks) {    if ($mergeDepth) {        parseLeaksandPrintUniqueLeaks();    }    else {         print "\nWARNING: $totalLeaks total leaks found!\n";        print "See above for individual leaks results.\n" if ($leaksOutputFileNumber > 2);    }}close IN;close OUT;close ERROR;if ($report10Slowest) {    print "\n\nThe 10 slowest tests:\n\n";    my $count = 0;    for my $test (sort slowestcmp keys %durations) {        printf "%0.2f secs: %s\n", $durations{$test}, $test;        last if ++$count == 10;    }}print "\n";if ($skippedOnly && $counts{"match"}) {    print "The following tests are in the Skipped file (" . File::Spec->abs2rel("$platformTestDirectory/Skipped", $testDirectory) . "), but succeeded:\n";    foreach my $test (@{$tests{"match"}}) {        print "  $test\n";    }}if ($resetResults || ($counts{match} && $counts{match} == $count)) {    print "all $count test cases succeeded\n";    unlink $testResults;    exit;}my %text = (    match => "succeeded",    mismatch => "had incorrect layout",    new => "were new",    timedout => "timed out",    crash => "crashed",    error => "had stderr output");for my $type ("match", "mismatch", "new", "timedout", "crash", "error") {    my $c = $counts{$type};    if ($c) {        my $t = $text{$type};        my $message;        if ($c == 1) {            $t =~ s/were/was/;            $message = sprintf "1 test case (%d%%) %s\n", 1 * 100 / $count, $t;        } else {            $message = sprintf "%d test cases (%d%%) %s\n", $c, $c * 100 / $count, $t;        }        $message =~ s-\(0%\)-(<1%)-;        print $message;    }}mkpath $testResultsDirectory;open HTML, ">", $testResults or die;print HTML "<html>\n";print HTML "<head>\n";print HTML "<title>Layout Test Results</title>\n";print HTML "</head>\n";print HTML "<body>\n";print HTML htmlForResultsSection(@{$tests{mismatch}}, "Tests where results did not match expected results", \&linksForMismatchTest);print HTML htmlForResultsSection(@{$tests{timedout}}, "Tests that timed out", \&linksForErrorTest);print HTML htmlForResultsSection(@{$tests{crash}}, "Tests that caused the DumpRenderTree tool to crash", \&linksForErrorTest);print HTML htmlForResultsSection(@{$tests{error}}, "Tests that had stderr output", \&linksForErrorTest);print HTML htmlForResultsSection(@{$tests{new}}, "Tests that had no expected results (probably new)", \&linksForNewTest);print HTML "</body>\n";print HTML "</html>\n";close HTML;my @configurationArgs = argumentsForConfiguration();if (isQt() || isGtk()) {  system "WebKitTools/Scripts/run-launcher", @configurationArgs, "file://".$testResults if $launchSafari;} elsif (isCygwin()) {  system "cygstart", $testResults if $launchSafari;} else {  system "WebKitTools/Scripts/run-safari", @configurationArgs, "-NSOpen", $testResults if $launchSafari;}closeCygpaths() if isCygwin();exit 1;sub countAndPrintLeaks($$$){    my ($dumpToolName, $dumpToolPID, $leaksFilePath) = @_;    print "\n" unless $atLineStart;    $atLineStart = 1;    # We are excluding the following reported leaks so they don't get in our way when looking for WebKit leaks:    # This allows us ignore known leaks and only be alerted when new leaks occur. Some leaks are in the old    # versions of the system frameworks that are being used by the leaks bots. Even though a leak has been    # fixed, it will be listed here until the bot has been updated with the newer frameworks.    my @typesToExclude = (    );    my @callStacksToExclude = (        "Flash_EnforceLocalSecurity" # leaks in Flash plug-in code, rdar://problem/4449747    );    if (isTiger()) {        # Leak list for the version of Tiger used on the build bot.        push @callStacksToExclude, (            "CFRunLoopRunSpecific \\| malloc_zone_malloc", "CFRunLoopRunSpecific \\| CFAllocatorAllocate ", # leak in CFRunLoopRunSpecific, rdar://problem/4670839            "CGImageSourceGetPropertiesAtIndex", # leak in ImageIO, rdar://problem/4628809            "FOGetCoveredUnicodeChars", # leak in ATS, rdar://problem/3943604            "GetLineDirectionPreference", "InitUnicodeUtilities", # leaks tool falsely reporting leak in CFNotificationCenterAddObserver, rdar://problem/4964790            "ICCFPrefWrapper::GetPrefDictionary", # leaks in Internet Config. code, rdar://problem/4449794            "NSHTTPURLProtocol setResponseHeader:", # leak in multipart/mixed-replace handling in Foundation, no Radar, but fixed in Leopard            "NSURLCache cachedResponseForRequest", # leak in CFURL cache, rdar://problem/4768430            "PCFragPrepareClosureFromFile", # leak in Code Fragment Manager, rdar://problem/3426998            "WebCore::Selection::toRange", # bug in 'leaks', rdar://problem/4967949            "WebCore::SubresourceLoader::create", # bug in 'leaks', rdar://problem/4985806            "_CFPreferencesDomainDeepCopyDictionary", # leak in CFPreferences, rdar://problem/4220786            "_objc_msgForward", # leak in NSSpellChecker, rdar://problem/4965278            "gldGetString", # leak in OpenGL, rdar://problem/5013699            "_setDefaultUserInfoFromURL", # leak in NSHTTPAuthenticator, rdar://problem/5546453             "SSLHandshake", # leak in SSL, rdar://problem/5546440             "SecCertificateCreateFromData", # leak in SSL code, rdar://problem/4464397        );        push @typesToExclude, (            "THRD", # bug in 'leaks', rdar://problem/3387783            "DRHT", # ditto (endian little hate i)        );    }    if (isLeopard()) {        # Leak list for the version of Leopard used on the build bot.        push @callStacksToExclude, (            "CFHTTPMessageAppendBytes", # leak in CFNetwork, rdar://problem/5435912            "sendDidReceiveDataCallback", # leak in CFNetwork, rdar://problem/5441619            "_CFHTTPReadStreamReadMark", # leak in CFNetwork, rdar://problem/5441468            "httpProtocolStart", # leak in CFNetwork, rdar://problem/5468837            "_CFURLConnectionSendCallbacks", # leak in CFNetwork, rdar://problem/5441600            "DispatchQTMsg", # leak in QuickTime, PPC only, rdar://problem/5667132            "QTMovieContentView createVisualContext", # leak in QuickTime, PPC only, rdar://problem/5667132            "_CopyArchitecturesForJVMVersion", # leak in Java, rdar://problem/5910823        );    }    my $leaksTool = sourceDir() . "/WebKitTools/Scripts/run-leaks";    my $excludeString = "--exclude-callstack '" . (join "' --exclude-callstack '", @callStacksToExclude) . "'";    $excludeString .= " --exclude-type '" . (join "' --exclude-type '", @typesToExclude) . "'" if @typesToExclude;    print " ? checking for leaks in $dumpToolName\n";    my $leaksOutput = `$leaksTool $excludeString $dumpToolPID`;    my ($count, $bytes) = $leaksOutput =~ /Process $dumpToolPID: (\d+) leaks? for (\d+) total/;    my ($excluded) = $leaksOutput =~ /(\d+) leaks? excluded/;    my $adjustedCount = $count;    $adjustedCount -= $excluded if $excluded;    if (!$adjustedCount) {        print " - no leaks found\n";        unlink $leaksFilePath;        return 0;    } else {        my $dir = $leaksFilePath;        $dir =~ s|/[^/]+$|| or die;        mkpath $dir;        if ($excluded) {            print " + $adjustedCount leaks ($bytes bytes including $excluded excluded leaks) were found, details in $leaksFilePath\n";        } else {            print " + $count leaks ($bytes bytes) were found, details in $leaksFilePath\n";        }        writeToFile($leaksFilePath, $leaksOutput);                push( @leaksFilenames, $leaksFilePath );    }    return $adjustedCount;}sub writeToFile($$){    my ($filePath, $contents) = @_;    open NEWFILE, ">", "$filePath" or die "could not create $filePath\n";    print NEWFILE $contents;    close NEWFILE;}# Break up a path into the directory (with slash) and base name.sub splitpath($)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -