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

📄 run-webkit-tests

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻
📖 第 1 页 / 共 5 页
字号:
}if ($ignoreTests) {    processIgnoreTests($ignoreTests, "ignore-tests");}if (!$ignoreSkipped) {    foreach my $level (@platformHierarchy) {        if (open SKIPPED, "<", "$level/Skipped") {            if ($verbose && !$skippedOnly) {                my ($dir, $name) = splitpath($level);                print "Skipped tests in $name:\n";            }            while (<SKIPPED>) {                my $skipped = $_;                chomp $skipped;                $skipped =~ s/^[ \n\r]+//;                $skipped =~ s/[ \n\r]+$//;                if ($skipped && $skipped !~ /^#/) {                    if ($skippedOnly) {                        push(@ARGV, $skipped);                    } else {                        if ($verbose) {                            print "    $skipped\n";                        }                        processIgnoreTests($skipped, "Skipped");                    }                }            }            close SKIPPED;        }    }}my $directoryFilter = sub {    return () if exists $ignoredLocalDirectories{basename($File::Find::dir)};    return () if exists $ignoredDirectories{File::Spec->abs2rel($File::Find::dir, $testDirectory)};    return @_;};my $fileFilter = sub {    my $filename = $_;    if ($filename =~ /\.([^.]+)$/) {        if (exists $supportedFileExtensions{$1}) {            my $path = File::Spec->abs2rel(catfile($File::Find::dir, $filename), $testDirectory);            push @tests, $path if !exists $ignoredFiles{$path};        }    }};for my $test (@ARGV) {    $test =~ s/^($layoutTestsName|$testDirectory)\///;    my $fullPath = catfile($testDirectory, $test);    if (file_name_is_absolute($test)) {        print "can't run test $test outside $testDirectory\n";    } elsif (-f $fullPath) {        my ($filename, $pathname, $fileExtension) = fileparse($test, qr{\.[^.]+$});        if (!exists $supportedFileExtensions{substr($fileExtension, 1)}) {            print "test $test does not have a supported extension\n";        } elsif ($testHTTP || $pathname !~ /^http\//) {            push @tests, $test;        }    } elsif (-d $fullPath) {        find({ preprocess => $directoryFilter, wanted => $fileFilter }, $fullPath);        for my $level (@platformHierarchy) {            my $platformPath = catfile($level, $test);            find({ preprocess => $directoryFilter, wanted => $fileFilter }, $platformPath) if (-d $platformPath);        }    } else {        print "test $test not found\n";    }}if (!scalar @ARGV) {    find({ preprocess => $directoryFilter, wanted => $fileFilter }, $testDirectory);    for my $level (@platformHierarchy) {        find({ preprocess => $directoryFilter, wanted => $fileFilter }, $level);    }}die "no tests to run\n" if !@tests;@tests = sort pathcmp @tests;my %counts;my %tests;my %imagesPresent;my %imageDifferences;my %durations;my $count = 0;my $leaksOutputFileNumber = 1;my $totalLeaks = 0;my @toolArgs = ();push @toolArgs, "--pixel-tests" if $pixelTests;push @toolArgs, "--threaded" if $threaded;push @toolArgs, "--complex-text" if $complexText;push @toolArgs, "-";my @diffToolArgs = ();push @diffToolArgs, "--tolerance", $tolerance;$| = 1;my $imageDiffToolPID;if ($pixelTests) {    local %ENV;    $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;    $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, @diffToolArgs) or die "unable to open $imageDiffTool\n";    $ENV{MallocStackLogging} = 0 if $shouldCheckLeaks;}my $dumpToolPID;my $isDumpToolOpen = 0;my $dumpToolCrashed = 0;my $atLineStart = 1;my $lastDirectory = "";my $isHttpdOpen = 0;sub catch_pipe { $dumpToolCrashed = 1; }$SIG{"PIPE"} = "catch_pipe";print "Testing ", scalar @tests, " test cases.\n";my $overallStartTime = time;my %expectedResultPaths;# Reverse the tests@tests = reverse @tests if $reverseTests;# Shuffle the array@tests = shuffle(@tests) if $randomizeTests;for my $test (@tests) {    next if $test eq 'results.html';    my $newDumpTool = not $isDumpToolOpen;    openDumpTool();    my $base = stripExtension($test);    my $expectedExtension = ".txt";        my $dir = $base;    $dir =~ s|/[^/]+$||;    if ($newDumpTool || $dir ne $lastDirectory) {        foreach my $logue (epiloguesAndPrologues($newDumpTool ? "" : $lastDirectory, $dir)) {            if (isCygwin()) {                $logue = toWindowsPath($logue);            } else {                $logue = canonpath($logue);            }            if ($verbose) {                print "running epilogue or prologue $logue\n";            }            print OUT "$logue\n";            # Throw away output from DumpRenderTree.            # Once for the test output and once for pixel results (empty)            while (<IN>) {                last if /#EOF/;            }            while (<IN>) {                last if /#EOF/;            }        }    }    if ($verbose) {        print "running $test -> ";        $atLineStart = 0;    } elsif (!$quiet) {        if ($dir ne $lastDirectory) {            print "\n" unless $atLineStart;            print "$dir ";        }        print ".";        $atLineStart = 0;    }    $lastDirectory = $dir;    my $result;    my $startTime = time if $report10Slowest;    # Try to read expected hash file for pixel tests    my $suffixExpectedHash = "";    if ($pixelTests && !$resetResults) {        my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png");        if (open EXPECTEDHASH, "$expectedPixelDir/$base-$expectedTag.checksum") {            my $expectedHash = <EXPECTEDHASH>;            chomp($expectedHash);            close EXPECTEDHASH;                        # Format expected hash into a suffix string that is appended to the path / URL passed to DRT            $suffixExpectedHash = "'$expectedHash";        }    }    if ($test !~ /^http\//) {        my $testPath = "$testDirectory/$test";        if (isCygwin()) {            $testPath = toWindowsPath($testPath);        } else {            $testPath = canonpath($testPath);        }        print OUT "$testPath$suffixExpectedHash\n";    } else {        openHTTPDIfNeeded();        if ($test !~ /^http\/tests\/local\// && $test !~ /^http\/tests\/ssl\// && $test !~ /^http\/tests\/wml\// && $test !~ /^http\/tests\/media\//) {            my $path = canonpath($test);            $path =~ s/^http\/tests\///;            print OUT "http://127.0.0.1:$httpdPort/$path$suffixExpectedHash\n";        } elsif ($test =~ /^http\/tests\/ssl\//) {            my $path = canonpath($test);            $path =~ s/^http\/tests\///;            print OUT "https://127.0.0.1:$httpdSSLPort/$path$suffixExpectedHash\n";        } else {            my $testPath = "$testDirectory/$test";            if (isCygwin()) {                $testPath = toWindowsPath($testPath);            } else {                $testPath = canonpath($testPath);            }            print OUT "$testPath$suffixExpectedHash\n";        }    }    # DumpRenderTree is expected to dump two "blocks" to stdout for each test.    # Each block is terminated by a #EOF on a line by itself.    # The first block is the output of the test (in text, RenderTree or other formats).    # The second block is for optional pixel data in PNG format, and may be empty if    # pixel tests are not being run, or the test does not dump pixels (e.g. text tests).        my $actualRead = readFromDumpToolWithTimer(IN);    my $errorRead = readFromDumpToolWithTimer(ERROR, $actualRead->{status} eq "timedOut");    my $actual = $actualRead->{output};    my $error = $errorRead->{output};    $expectedExtension = $actualRead->{extension};    my $expectedFileName = "$base-$expectedTag.$expectedExtension";    my $isText = isTextOnlyTest($actual);    my $expectedDir = expectedDirectoryForTest($base, $isText, $expectedExtension);    $expectedResultPaths{$base} = "$expectedDir/$expectedFileName";    unless ($actualRead->{status} eq "success" && $errorRead->{status} eq "success") {        my $crashed = $actualRead->{status} eq "crashed" || $errorRead->{status} eq "crashed";        testCrashedOrTimedOut($test, $base, $crashed, $actual, $error);        countFinishedTest($test, $base, $crashed ? "crash" : "timedout", 0);        next;     }    $durations{$test} = time - $startTime if $report10Slowest;    my $expected;    if (!$resetResults && open EXPECTED, "<", "$expectedDir/$expectedFileName") {        $expected = "";        while (<EXPECTED>) {            next if $stripEditingCallbacks && $_ =~ /^EDITING DELEGATE:/;            $expected .= $_;        }        close EXPECTED;    }    my $expectedMac;    if (!isAppleMacWebKit() && $strictTesting && !$isText) {      if (!$resetResults && open EXPECTED, "<", "$testDirectory/platform/mac/$expectedFileName") {        $expectedMac = "";        while (<EXPECTED>) {          $expectedMac .= $_;        }        close EXPECTED;      }    }    if ($shouldCheckLeaks && $testsPerDumpTool == 1) {        print "        $test -> ";    }    my $actualPNG = "";    my $diffPNG = "";    my $diffPercentage = "";    my $diffResult = "passed";    my $actualHash = "";    my $expectedHash = "";    my $actualPNGSize = 0;    while (<IN>) {        last if /#EOF/;        if (/ActualHash: ([a-f0-9]{32})/) {            $actualHash = $1;        } elsif (/ExpectedHash: ([a-f0-9]{32})/) {            $expectedHash = $1;        } elsif (/Content-Length: (\d+)\s*/) {            $actualPNGSize = $1;            read(IN, $actualPNG, $actualPNGSize);        }    }    if ($verbose && $pixelTests && !$resetResults && $actualPNGSize) {        if ($actualHash eq "" && $expectedHash eq "") {            printFailureMessageForTest($test, "WARNING: actual & expected pixel hashes are missing!");        } elsif ($actualHash eq "") {            printFailureMessageForTest($test, "WARNING: actual pixel hash is missing!");        } elsif ($expectedHash eq "") {            printFailureMessageForTest($test, "WARNING: expected pixel hash is missing!");        }    }    if ($actualPNGSize > 0) {        my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png");        if (!$resetResults && ($expectedHash ne $actualHash || ($actualHash eq "" && $expectedHash eq ""))) {            if (-f "$expectedPixelDir/$base-$expectedTag.png") {                my $expectedPNGSize = -s "$expectedPixelDir/$base-$expectedTag.png";                my $expectedPNG = "";                open EXPECTEDPNG, "$expectedPixelDir/$base-$expectedTag.png";                read(EXPECTEDPNG, $expectedPNG, $expectedPNGSize);                print DIFFOUT "Content-Length: $actualPNGSize\n";                print DIFFOUT $actualPNG;                print DIFFOUT "Content-Length: $expectedPNGSize\n";                print DIFFOUT $expectedPNG;                while (<DIFFIN>) {                    last if /^error/ || /^diff:/;                    if (/Content-Length: (\d+)\s*/) {                        read(DIFFIN, $diffPNG, $1);                    }                }                if (/^diff: (.+)% (passed|failed)/) {                    $diffPercentage = $1;                    $imageDifferences{$base} = $diffPercentage;                    $diffResult = $2;                }                                if ($diffPercentage == 0) {                    printFailureMessageForTest($test, "pixel hash failed (but pixel test still passes)");                }            } elsif ($verbose) {                printFailureMessageForTest($test, "WARNING: expected image is missing!");            }        }        if ($resetResults || !-f "$expectedPixelDir/$base-$expectedTag.png") {            mkpath catfile($expectedPixelDir, dirname($base)) if $testDirectory ne $expectedPixelDir;            writeToFile("$expectedPixelDir/$base-$expectedTag.png", $actualPNG);        }        if ($actualHash ne "" && ($resetResults || !-f "$expectedPixelDir/$base-$expectedTag.checksum")) {            writeToFile("$expectedPixelDir/$base-$expectedTag.checksum", $actualHash);        }    }    if (!isAppleMacWebKit() && $strictTesting && !$isText) {      if (defined $expectedMac) {        my $simplified_actual;        $simplified_actual = $actual;        $simplified_actual =~ s/at \(-?[0-9]+,-?[0-9]+\) *//g;        $simplified_actual =~ s/size -?[0-9]+x-?[0-9]+ *//g;        $simplified_actual =~ s/text run width -?[0-9]+: //g;        $simplified_actual =~ s/text run width -?[0-9]+ [a-zA-Z ]+: //g;        $simplified_actual =~ s/RenderButton {BUTTON} .*/RenderButton {BUTTON}/g;        $simplified_actual =~ s/RenderImage {INPUT} .*/RenderImage {INPUT}/g;        $simplified_actual =~ s/RenderBlock {INPUT} .*/RenderBlock {INPUT}/g;        $simplified_actual =~ s/RenderTextControl {INPUT} .*/RenderTextControl {INPUT}/g;        $simplified_actual =~ s/\([0-9]+px/px/g;        $simplified_actual =~ s/ *" *\n +" */ /g;        $simplified_actual =~ s/" +$/"/g;

⌨️ 快捷键说明

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