Changeset 25015 in webkit


Ignore:
Timestamp:
Aug 11, 2007 1:37:09 PM (17 years ago)
Author:
pewtermoose
Message:

LayoutTests:

Reviewed over and over and over by Adam Roben.

Bug 14740: Hierarchical layout tests and platform organization
http://bugs.webkit.org/show_bug.cgi?id=14740

Add support for platform-specific layout tests and results.
New platform structure is as follows:

  • platform: Added.
  • platform/mac: Added.
  • mac/leopard/ -> platform/mac-leopard
  • win/ -> platform/win
  • qt/ -> platform/qt

WebKitTools:

Reviewed over and over and over by Adam Roben.

Bug 14740: Hierarchical layout tests and platform organization
http://bugs.webkit.org/show_bug.cgi?id=14740

Add support for platform-specific layout tests and results.

  • Scripts/run-webkit-tests:
Location:
trunk
Files:
2 added
3 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r25011 r25015  
     12007-08-11  Matt Lilek  <pewtermoose@gmail.com>
     2
     3        Reviewed over and over and over by Adam Roben.
     4
     5        Bug 14740: Hierarchical layout tests and platform organization
     6        http://bugs.webkit.org/show_bug.cgi?id=14740
     7
     8        Add support for platform-specific layout tests and results.
     9        New platform structure is as follows:
     10
     11        * platform: Added.
     12        * platform/mac: Added.
     13        * mac/leopard/ -> platform/mac-leopard
     14        * win/ -> platform/win
     15        * qt/ -> platform/qt
     16
    1172007-08-11  Mitz Pettel  <mitz@webkit.org>
    218
  • trunk/WebKitTools/ChangeLog

    r25014 r25015  
     12007-08-11  Matt Lilek  <pewtermoose@gmail.com>
     2
     3        Reviewed over and over and over by Adam Roben.
     4
     5        Bug 14740: Hierarchical layout tests and platform organization
     6        http://bugs.webkit.org/show_bug.cgi?id=14740
     7
     8        Add support for platform-specific layout tests and results.
     9
     10        * Scripts/run-webkit-tests:
     11
    1122007-08-11  David Kilzer  <ddkilzer@webkit.org>
    213
  • trunk/WebKitTools/Scripts/run-webkit-tests

    r25013 r25015  
    33# Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
    44# Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
     5# Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com)
    56#
    67# Redistribution and use in source and binary forms, with or without
     
    8586sub deleteExpectedAndActualResults($);
    8687sub recordActualResultsAndDiff($$);
     88sub buildPlatformHierarchy();
    8789
    8890# Argument handling
     
    9496my $ignoreTests = '';
    9597my $launchSafari = 1;
     98my $platform;
    9699my $pixelTests = '';
    97100my $quiet = '';
     
    119122my $errorTag = "stderr";
    120123
     124my $useWinSkipped = 0;
     125if (isLeopard()) {
     126    $platform = "mac-leopard";
     127} elsif (isOSX()) {
     128    $platform = "mac";
     129} elsif (isQt()) {
     130    $platform = "qt";
     131} elsif (isCygwin()) {
     132    # FIXME: The two lines below are a hack to represent that on Windows we
     133    # currently want to
     134    # 1) use the Mac expected results
     135    # 2) use the Windows Skipped file
     136    # Once Windows has its own results and/or we come up with a better way of
     137    # sharing results with Mac, we should set $platform to "win" and get rid of
     138    # $useWinSkipped entirely.
     139    $platform = "mac";
     140    $useWinSkipped = 1;
     141}
     142
     143if (!defined($platform)) {
     144    print "WARNING: Your platform is not recognized. Any platform-specific results will be generated in platform/undefined.\n";
     145    $platform = "undefined";
     146}
     147
    121148my $programName = basename($0);
    122149my $launchSafariDefault = $launchSafari ? "launch" : "do not launch";
     
    135162  --[no-]new-test-results         Generate results for new tests
    136163  -p|--pixel-tests                Enable pixel tests
     164  --platform                      Override the detected platform to use for tests and results (default: $platform)
    137165  --port                          Web server port to use with http tests
    138166  -q|--quiet                      Less verbose output
     
    166194    'leaks|l' => \$shouldCheckLeaks,
    167195    'pixel-tests|p' => \$pixelTests,
     196    'platform=s' => \$platform,
    168197    'port=i' => \$httpdPort,
    169198    'quiet|q' => \$quiet,
     
    246275my $layoutTestsName = "LayoutTests";
    247276my $testDirectory = File::Spec->rel2abs($layoutTestsName);
    248 my $platformTestDirectory = $testDirectory;
    249277my $expectedDirectory = $testDirectory;
    250 if (isLeopard()) {
    251     $platformTestDirectory = "$testDirectory/mac/leopard";
    252 } elsif (isQt()) {
    253     $expectedDirectory = File::Spec->rel2abs("LayoutTests/qt/");
    254     $platformTestDirectory = $expectedDirectory;
    255 } elsif (isCygwin()) {
    256     $expectedDirectory = $testDirectory;
    257     $platformTestDirectory = File::Spec->rel2abs("LayoutTests/win/");
    258 }
     278my $platformTestDirectory = catdir($testDirectory, "platform", $platform);
     279my @platformHierarchy = buildPlatformHierarchy();
    259280
    260281$expectedDirectory = $ENV{"WebKitExpectedTestResultsDirectory"} if $ENV{"WebKitExpectedTestResultsDirectory"};
     
    275296
    276297my %ignoredFiles = ();
    277 my %ignoredDirectories = ();
     298my %ignoredDirectories = map { $_ => 1 } qw(platform);
    278299my %ignoredLocalDirectories = map { $_ => 1 } qw(.svn _svn resources);
    279300my %supportedFileExtensions = map { $_ => 1 } qw(html shtml xml xhtml pl php);
     
    297318}
    298319
    299 if (!$ignoreSkipped && open SKIPPED, "<", "$platformTestDirectory/Skipped") {
    300     if ($verbose && !$skippedOnly) {
    301         print "Skipped tests:\n";
    302     }
    303     while (<SKIPPED>) {
    304         my $skipped = $_;
    305         chomp $skipped;
    306         $skipped =~ s/^ +//;
    307         $skipped =~ s/ +$//;
    308         if ($skipped && $skipped !~ /^#/) {
    309             if ($skippedOnly) {
    310                 push(@ARGV, $skipped);
    311             } else {
    312                 if ($verbose) {
    313                     print "    $skipped\n";
     320if (!$ignoreSkipped) {
     321    # FIXME: See comments where $platform is set for info on why this is needed.
     322    my @skippedHierarchy;
     323    if ($useWinSkipped) {
     324        @skippedHierarchy = (catdir($testDirectory, "platform", "win"));
     325    } else {
     326        @skippedHierarchy = @platformHierarchy;
     327    }
     328
     329    foreach my $level (@skippedHierarchy) {
     330        if (open SKIPPED, "<", "$level/Skipped") {
     331            if ($verbose && !$skippedOnly) {
     332                my ($dir, $name) = splitpath($level);
     333                print "Skipped tests in $name:\n";
     334            }
     335
     336            while (<SKIPPED>) {
     337                my $skipped = $_;
     338                chomp $skipped;
     339                $skipped =~ s/^ +//;
     340                $skipped =~ s/ +$//;
     341                if ($skipped && $skipped !~ /^#/) {
     342                    if ($skippedOnly) {
     343                        push(@ARGV, $skipped);
     344                    } else {
     345                        if ($verbose) {
     346                            print "    $skipped\n";
     347                        }
     348                        processIgnoreTests($skipped);
     349                    }
    314350                }
    315                 processIgnoreTests($skipped);
    316351            }
    317         }
    318     }
    319     close SKIPPED;
     352            close SKIPPED;
     353        }
     354    }
    320355}
    321356
     
    351386    } elsif (-d $fullPath) {
    352387        find({ preprocess => $directoryFilter, wanted => $fileFilter }, $fullPath);
     388
     389        for my $level (@platformHierarchy) {
     390            my $platformPath = catfile($level, $test);
     391            find({ preprocess => $directoryFilter, wanted => $fileFilter }, $platformPath) if (-d $platformPath);
     392        }
    353393    } else {
    354394        print "test $test not found\n";
     
    357397if (!scalar @ARGV) {
    358398    find({ preprocess => $directoryFilter, wanted => $fileFilter }, $testDirectory);
     399
     400    for my $level (@platformHierarchy) {
     401        find({ preprocess => $directoryFilter, wanted => $fileFilter }, $level);
     402    }
    359403}
    360404
     
    477521    my $expectedDir = expectedDirectoryForTest($base);
    478522    if (isQt() && $isText) {
    479       $expectedDir = $testDirectory;
     523        $expectedDir = $testDirectory;
    480524    }
    481525
     
    509553   
    510554    if ($pixelTests) {
    511         die "Pixel tests currently don't work when using a custom expected test results directory" if $testDirectory ne $expectedDir;
    512            
    513555        my $actualHash = "";
    514556        my $expectedHash = "";
    515557        my $actualPNGSize = 0;
     558
    516559        while (<IN>) {
    517560            last if /#EOF/;
     
    526569        }
    527570
    528         if ($expectedHash ne $actualHash && -f "$testDirectory/$base-$expectedTag.png") {
    529             my $expectedPNGSize = -s "$testDirectory/$base-$expectedTag.png";
     571        if ($expectedHash ne $actualHash && -f "$expectedDir/$base-$expectedTag.png") {
     572            my $expectedPNGSize = -s "$expectedDir/$base-$expectedTag.png";
    530573            my $expectedPNG = "";
    531             open EXPECTEDPNG, "$testDirectory/$base-$expectedTag.png";
     574            open EXPECTEDPNG, "$expectedDir/$base-$expectedTag.png";
    532575            read(EXPECTEDPNG, $expectedPNG, $expectedPNGSize);
    533576
     
    551594        }
    552595
    553         if ($actualPNGSize && ($resetResults || !-f "$testDirectory/$base-$expectedTag.png")) {
    554             open EXPECTED, ">", "$testDirectory/$base-expected.png" or die "could not create $testDirectory/$base-expected.png\n";
     596        if ($actualPNGSize && ($resetResults || !-f "$expectedDir/$base-$expectedTag.png")) {
     597            mkpath(catfile($expectedDir, dirname($base))) if $testDirectory ne $expectedDir;
     598            open EXPECTED, ">", "$expectedDir/$base-expected.png" or die "could not create $expectedDir/$base-expected.png\n";
    555599            print EXPECTED $actualPNG;
    556600            close EXPECTED;
     
    558602
    559603        # update the expected hash if the image diff said that there was no difference
    560         if ($actualHash ne "" && ($resetResults || !-f "$testDirectory/$base-$expectedTag.checksum")) {
    561             open EXPECTED, ">", "$testDirectory/$base-$expectedTag.checksum" or die "could not create $testDirectory/$base-$expectedTag.checksum\n";
     604        if ($actualHash ne "" && ($resetResults || !-f "$expectedDir/$base-$expectedTag.checksum")) {
     605            open EXPECTED, ">", "$expectedDir/$base-$expectedTag.checksum" or die "could not create $expectedDir/$base-$expectedTag.checksum\n";
    562606            print EXPECTED $actualHash;
    563607            close EXPECTED;
     
    661705                print "$test -> ";
    662706            }
    663             print "new\n";
     707            print "new (results generated in $expectedDir)\n";
    664708            $atLineStart = 1;
    665709        }
     
    945989            "gldGetString" # leak in OpenGL, Radar 5013699
    946990        );
    947          push @typesToExclude, (
     991        push @typesToExclude, (
    948992            "THRD", # bug in 'leaks', Radar 3387783
    949993            "DRHT" # ditto (endian little hate i)
     
    12591303{
    12601304    my ($base) = @_;
    1261     return (-f "$platformTestDirectory/$base-$expectedTag.txt") ? $platformTestDirectory : $expectedDirectory;
     1305
     1306    foreach my $level (@platformHierarchy) {
     1307        return $level if (-f "$level/$base-$expectedTag.txt");
     1308    }
     1309
     1310    return $expectedDirectory if (-f "$expectedDirectory/$base-$expectedTag.txt");
     1311
     1312    return $platformHierarchy[$#platformHierarchy];
    12621313}
    12631314
     
    13821433    system "diff -u \"$testResultsDirectory/$base-$expectedTag.txt\" \"$testResultsDirectory/$base-$actualTag.txt\" > \"$testResultsDirectory/$base-$diffsTag.txt\"";
    13831434}
     1435
     1436sub buildPlatformHierarchy()
     1437{
     1438    mkpath($platformTestDirectory) if ($platform eq "undefined" && !-d "$platformTestDirectory");
     1439
     1440    my @platforms = split('-', $platformTestDirectory);
     1441    my @hierarchy;
     1442    for (my $i=0; $i < @platforms; $i++) {
     1443        my $scoped = join('-', @platforms[0..($#platforms - $i)]);
     1444        print "scoped = $scoped\n";
     1445        push(@hierarchy, $scoped) if (-d $scoped);
     1446    }
     1447
     1448    return @hierarchy;
     1449}
Note: See TracChangeset for help on using the changeset viewer.