Changeset 70188 in webkit


Ignore:
Timestamp:
Oct 20, 2010 4:12:09 PM (14 years ago)
Author:
Adam Roben
Message:

Gently nudge old-run-webkit-tests toward working with Win32 Perl

This makes old-run-webkit-tests able to build DRT and find all the
tests to run. It even invokes DRT and passes it the list of tests. But
DRT ends up hung blocking on I/O.

Fixes <http://webkit.org/b/47961> Get old-run-webkit-tests mostly
working with Win32 Perl

Reviewed by David Kilzer.

  • Scripts/old-run-webkit-tests:
    • Use File::Spec instead of manually concatenating paths
    • Use dirname instead of manually stripping off the base name
    • Use isCygwin/isWindows/isAppleWinWebKit more judiciously
    • Explicitly invoke Perl when running Perl scripts
    • Quote paths when using them in regular expressions to allow them to include characters that have special meanings in regular expressions
  • Scripts/run-webkit-tests: Use File::Spec instead of manually

concatenating paths.

  • Scripts/webkitdirs.pm:
    • Remove the unused $windowsTmpPath variable
    • Use isCygwin/isWindows/isAppleWinWebKit more judiciously
    • Only pass paths to cygpath when using Cygwin Perl
    • Only use pdevenv when using Cygwin Perl, for now
Location:
trunk/WebKitTools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r70187 r70188  
     12010-10-19  Adam Roben  <aroben@apple.com>
     2
     3        Gently nudge old-run-webkit-tests toward working with Win32 Perl
     4
     5        This makes old-run-webkit-tests able to build DRT and find all the
     6        tests to run. It even invokes DRT and passes it the list of tests. But
     7        DRT ends up hung blocking on I/O.
     8
     9        Fixes <http://webkit.org/b/47961> Get old-run-webkit-tests mostly
     10        working with Win32 Perl
     11
     12        Reviewed by David Kilzer.
     13
     14        * Scripts/old-run-webkit-tests:
     15          - Use File::Spec instead of manually concatenating paths
     16          - Use dirname instead of manually stripping off the base name
     17          - Use isCygwin/isWindows/isAppleWinWebKit more judiciously
     18          - Explicitly invoke Perl when running Perl scripts
     19          - Quote paths when using them in regular expressions to allow them
     20            to include characters that have special meanings in regular
     21            expressions
     22
     23        * Scripts/run-webkit-tests: Use File::Spec instead of manually
     24        concatenating paths.
     25
     26        * Scripts/webkitdirs.pm:
     27          - Remove the unused $windowsTmpPath variable
     28          - Use isCygwin/isWindows/isAppleWinWebKit more judiciously
     29          - Only pass paths to cygpath when using Cygwin Perl
     30          - Only use pdevenv when using Cygwin Perl, for now
     31
    1322010-10-20  Daniel Bates  <dbates@rim.com>
    233
  • trunk/WebKitTools/Scripts/old-run-webkit-tests

    r70183 r70188  
    5050use warnings;
    5151
     52use Config;
    5253use Cwd;
    5354use Data::Dumper;
     
    158159my $testMedia = 1;
    159160my $tmpDir = "/tmp";
    160 my $testResultsDirectory = File::Spec->catfile($tmpDir, "layout-test-results");
     161my $testResultsDirectory = File::Spec->catdir($tmpDir, "layout-test-results");
    161162my $testsPerDumpTool = 1000;
    162163my $threaded = 0;
     
    180181# Default to --no-http for wx for now.
    181182$testHTTP = 0 if (isWx());
     183
     184my $perlInterpreter = "perl";
    182185
    183186my $expectedTag = "expected";
     
    225228} elsif (isWx()) {
    226229    $platform = "wx";
    227 } elsif (isCygwin()) {
     230} elsif (isCygwin() || isWindows()) {
    228231    if (isWindowsXP()) {
    229232        $platform = "win-xp";
     
    237240}
    238241
    239 if (isQt() || isCygwin()) {
     242if (isQt() || isAppleWinWebKit()) {
    240243    my $testfontPath = $ENV{"WEBKIT_TESTFONTS"};
    241244    if (!$testfontPath || !-d "$testfontPath") {
     
    413416my $dumpToolName = $useWebKitTestRunner ? "WebKitTestRunner" : "DumpRenderTree";
    414417
    415 $dumpToolName .= "_debug" if isCygwin() && configurationForVisualStudio() !~ /^Release|Debug_Internal$/;
    416 my $dumpTool = "$productDir/$dumpToolName";
     418if (isAppleWinWebKit()) {
     419    $dumpToolName .= "_debug" if configurationForVisualStudio() !~ /^Release|Debug_Internal$/;
     420    $dumpToolName .= $Config{_exe};
     421}
     422my $dumpTool = File::Spec->catfile($productDir, $dumpToolName);
    417423die "can't find executable $dumpToolName (looked in $productDir)\n" unless -x $dumpTool;
    418424
     
    685691    if ($pixelTests && !$resetResults) {
    686692        my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png");
    687         if (open EXPECTEDHASH, "$expectedPixelDir/$base-$expectedTag.checksum") {
     693        if (open EXPECTEDHASH, File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.checksum")) {
    688694            my $expectedHash = <EXPECTEDHASH>;
    689695            chomp($expectedHash);
     
    767773
    768774    my $expectedDir = expectedDirectoryForTest($base, $isText, $expectedExtension);
    769     $expectedResultPaths{$base} = "$expectedDir/$expectedFileName";
     775    $expectedResultPaths{$base} = File::Spec->catfile($expectedDir, $expectedFileName);
    770776
    771777    unless ($readResults->{status} eq "success") {
     
    781787    my $expected;
    782788
    783     if (!$resetResults && open EXPECTED, "<", "$expectedDir/$expectedFileName") {
     789    if (!$resetResults && open EXPECTED, "<", $expectedResultPaths{$base}) {
    784790        $expected = "";
    785791        while (<EXPECTED>) {
     
    831837    if ($actualPNGSize > 0) {
    832838        my $expectedPixelDir = expectedDirectoryForTest($base, 0, "png");
     839        my $expectedPNGPath = File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.png");
    833840
    834841        if (!$resetResults && ($expectedHash ne $actualHash || ($actualHash eq "" && $expectedHash eq ""))) {
    835             if (-f "$expectedPixelDir/$base-$expectedTag.png") {
    836                 my $expectedPNGSize = -s "$expectedPixelDir/$base-$expectedTag.png";
     842            if (-f $expectedPNGPath) {
     843                my $expectedPNGSize = -s $expectedPNGPath;
    837844                my $expectedPNG = "";
    838                 open EXPECTEDPNG, "$expectedPixelDir/$base-$expectedTag.png";
     845                open EXPECTEDPNG, $expectedPNGPath;
    839846                read(EXPECTEDPNG, $expectedPNG, $expectedPNGSize);
    840847
     
    867874        }
    868875
    869         if ($resetResults || !-f "$expectedPixelDir/$base-$expectedTag.png") {
     876        if ($resetResults || !-f $expectedPNGPath) {
    870877            mkpath catfile($expectedPixelDir, dirname($base)) if $testDirectory ne $expectedPixelDir;
    871             writeToFile("$expectedPixelDir/$base-$expectedTag.png", $actualPNG);
    872         }
    873 
    874         if ($actualHash ne "" && ($resetResults || !-f "$expectedPixelDir/$base-$expectedTag.checksum")) {
    875             writeToFile("$expectedPixelDir/$base-$expectedTag.checksum", $actualHash);
     878            writeToFile($expectedPNGPath, $actualPNG);
     879        }
     880
     881        my $expectedChecksumPath = File::Spec->catfile($expectedPixelDir, "$base-$expectedTag.checksum");
     882        if ($actualHash ne "" && ($resetResults || !-f $expectedChecksumPath)) {
     883            writeToFile($expectedChecksumPath, $actualHash);
    876884        }
    877885    }
     
    10101018
    10111019    if ($error) {
    1012         my $dir = "$testResultsDirectory/$base";
    1013         $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n";
     1020        my $dir = dirname(File::Spec->catdir($testResultsDirectory, $base));
    10141021        mkpath $dir;
    10151022       
    1016         writeToFile("$testResultsDirectory/$base-$errorTag.txt", $error);
     1023        writeToFile(File::Spec->catfile($testResultsDirectory, "$base-$errorTag.txt"), $error);
    10171024       
    10181025        $counts{error}++;
     
    11221129} elsif (isCygwin()) {
    11231130  system "cygstart", $testResults if $launchSafari;
     1131} elsif (isWindows()) {
     1132  system "start", $testResults if $launchSafari;
    11241133} else {
    11251134  system "WebKitTools/Scripts/run-safari", @configurationArgs, "-NSOpen", $testResults if $launchSafari;
     
    13231332
    13241333    my $execScript = File::Spec->catfile(sourceDir(), qw(WebKitTools Scripts execAppWithEnv));
    1325     unshift @{$args}, $execScript;
     1334    unshift @{$args}, $perlInterpreter, $execScript;
    13261335    return @{$args};
    13271336}
     
    13651374
    13661375    my @args = argumentsForConfiguration();
    1367     my $buildProcess = open3($childIn, $childOut, $childErr, "WebKitTools/Scripts/$dumpToolBuildScript", @args) or die "Failed to run build-dumprendertree";
     1376    my $buildProcess = open3($childIn, $childOut, $childErr, $perlInterpreter, File::Spec->catfile(qw(WebKitTools Scripts), $dumpToolBuildScript), @args) or die "Failed to run build-dumprendertree";
    13681377    close($childIn);
    13691378    waitpid $buildProcess, 0;
     
    15081517{
    15091518    # we have not chdir to sourceDir yet.
    1510     system sourceDir() . "/WebKitTools/Scripts/ensure-valid-python", "--check-only";
     1519    system $perlInterpreter, File::Spec->catfile(sourceDir(), qw(WebKitTools Scripts ensure-valid-python)), "--check-only";
    15111520    return exitStatus($?) == 0;
    15121521}
     
    16111620
    16121621    my @directories = @platformResultHierarchy;
    1613     push @directories, map { catdir($platformBaseDirectory, $_) } qw(mac-snowleopard mac) if isCygwin();
     1622    push @directories, map { catdir($platformBaseDirectory, $_) } qw(mac-snowleopard mac) if isAppleWinWebKit();
    16141623    push @directories, $expectedDirectory;
    16151624
    16161625    # If we already have expected results, just return their location.
    16171626    foreach my $directory (@directories) {
    1618         return $directory if (-f "$directory/$base-$expectedTag.$expectedExtension");
     1627        return $directory if -f File::Spec->catfile($directory, "$base-$expectedTag.$expectedExtension");
    16191628    }
    16201629
     
    16321641            my $fileName;
    16331642            if ($testsPerDumpTool == 1) {
    1634                 $fileName = "$testResultsDirectory/$base-leaks.txt";
     1643                $fileName = File::Spec->catfile($testResultsDirectory, "$base-leaks.txt");
    16351644            } else {
    1636                 $fileName = "$testResultsDirectory/" . fileNameWithNumber($dumpToolName, $leaksOutputFileNumber) . "-leaks.txt";
     1645                $fileName = File::Spec->catfile($testResultsDirectory, fileNameWithNumber($dumpToolName, $leaksOutputFileNumber) . "-leaks.txt");
    16371646            }
    16381647            my $leakCount = countAndPrintLeaks($dumpToolName, $dumpToolPID, $fileName);
     
    16571666    sampleDumpTool() unless $didCrash;
    16581667
    1659     my $dir = "$testResultsDirectory/$base";
    1660     $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n";
     1668    my $dir = dirname(File::Spec->catdir($testResultsDirectory, $base));
    16611669    mkpath $dir;
    16621670
     
    16641672
    16651673    if (defined($error) && length($error)) {
    1666         writeToFile("$testResultsDirectory/$base-$errorTag.txt", $error);
     1674        writeToFile(File::Spec->catfile($testResultsDirectory, "$base-$errorTag.txt"), $error);
    16671675    }
    16681676
     
    19021910    my $expectedResultPath = $expectedResultPaths{$base};
    19031911    my ($expectedResultFileNameMinusExtension, $expectedResultDirectoryPath, $expectedResultExtension) = fileparse($expectedResultPath, qr{\.[^.]+$});
    1904     my $actualResultsPath = "$testResultsDirectory/$base-$actualTag$expectedResultExtension";
    1905     my $copiedExpectedResultsPath = "$testResultsDirectory/$base-$expectedTag$expectedResultExtension";
     1912    my $actualResultsPath = File::Spec->catfile($testResultsDirectory, "$base-$actualTag$expectedResultExtension");
     1913    my $copiedExpectedResultsPath = File::Spec->catfile($testResultsDirectory, "$base-$expectedTag$expectedResultExtension");
    19061914
    19071915    mkpath(dirname($actualResultsPath));
     
    19151923    }
    19161924
    1917     my $diffOuputBasePath = "$testResultsDirectory/$base";
     1925    my $diffOuputBasePath = File::Spec->catfile($testResultsDirectory, $base);
    19181926    my $diffOutputPath = "$diffOuputBasePath-$diffsTag.txt";
    19191927    system "diff -u \"$copiedExpectedResultsPath\" \"$actualResultsPath\" > \"$diffOutputPath\"";
     
    22752283
    22762284    for my $test (@ARGV) {
    2277         $test =~ s/^($layoutTestsName|$testDirectory)\///;
     2285        $test =~ s/^(\Q$layoutTestsName\E|\Q$testDirectory\E)\///;
    22782286        my $fullPath = catfile($testDirectory, $test);
    22792287        if (file_name_is_absolute($test)) {
  • trunk/WebKitTools/Scripts/run-webkit-tests

    r58080 r70188  
    4242use warnings;
    4343
     44use File::Spec;
    4445use FindBin;
    4546use lib $FindBin::Bin;
     
    8081}
    8182
    82 my $harnessPath = sprintf("%s/%s", relativeScriptsDir(), $harnessName);
     83my $harnessPath = File::Spec->catfile(relativeScriptsDir(), $harnessName);
    8384exec $harnessPath ($harnessPath, @ARGV) or die "Failed to execute $harnessPath";
  • trunk/WebKitTools/Scripts/webkitdirs.pm

    r69863 r70188  
    7272# Variables for Win32 support
    7373my $vcBuildPath;
    74 my $windowsTmpPath;
    7574my $windowsSourceDir;
    7675my $winVersion;
     
    174173        chomp $dosBuildPath;
    175174        $ENV{"WEBKITOUTPUTDIR"} = $dosBuildPath;
    176     }
    177 
    178     if (isAppleWinWebKit()) {
    179175        my $unixBuildPath = `cygpath --unix \"$baseProductDir\"`;
    180176        chomp $unixBuildPath;
     
    290286    return unless $configuration eq "Debug";
    291287    setupCygwinEnv();
    292     chomp(my $dir = `cygpath -ua '$ENV{WEBKITLIBRARIESDIR}'`);
    293     $configurationForVisualStudio = "Debug_Internal" if -f "$dir/bin/CoreFoundation_debug.dll";
     288    my $dir = $ENV{WEBKITLIBRARIESDIR};
     289    chomp($dir = `cygpath -ua '$dir'`) if isCygwin();
     290    $configurationForVisualStudio = "Debug_Internal" if -f File::Spec->catfile($dir, "bin", "CoreFoundation_debug.dll");
    294291}
    295292
     
    300297    determineConfiguration();
    301298    if (isAppleWinWebKit() && !isWx()) {
    302         $configurationProductDir = "$baseProductDir/bin";
     299        $configurationProductDir = File::Spec->catdir($baseProductDir, "bin");
    303300    } else {
    304301        # [Gtk][Efl] We don't have Release/Debug configurations in straight
     
    530527        $safariBundle = `"$configurationProductDir/FindSafari.exe"`;
    531528        $safariBundle =~ s/[\r\n]+$//;
    532         $safariBundle = `cygpath -u '$safariBundle'`;
     529        $safariBundle = `cygpath -u '$safariBundle'` if isCygwin();
    533530        $safariBundle =~ s/[\r\n]+$//;
    534531        $safariBundle .= "Safari.exe";
     
    625622sub checkFrameworks # FIXME: This is a poor name since only the Mac calls built WebCore a Framework.
    626623{
    627     return if isCygwin();
     624    return if isCygwin() || isWindows();
    628625    my @frameworks = ("JavaScriptCore", "WebCore");
    629626    push(@frameworks, "WebKit") if isAppleMacWebKit(); # FIXME: This seems wrong, all ports should have a WebKit these days.
     
    874871sub isAppleWinWebKit()
    875872{
    876     return isAppleWebKit() && isCygwin();
     873    return isAppleWebKit() && (isCygwin() || isWindows());
    877874}
    878875
     
    10101007{
    10111008    return if $windowsSourceDir;
    1012     my $sourceDir = sourceDir();
    1013     chomp($windowsSourceDir = `cygpath -w '$sourceDir'`);
     1009    $windowsSourceDir = sourceDir();
     1010    chomp($windowsSourceDir = `cygpath -w '$windowsSourceDir'`) if isCygwin();
    10141011}
    10151012
     
    10711068sub setupCygwinEnv()
    10721069{
    1073     return if !isCygwin();
     1070    return if !isCygwin() && !isWindows();
    10741071    return if $vcBuildPath;
    10751072
    10761073    my $vsInstallDir;
    1077     my $programFilesPath = $ENV{'PROGRAMFILES'} || "C:\\Program Files";
     1074    my $programFilesPath = $ENV{'PROGRAMFILES(X86)'} || $ENV{'PROGRAMFILES'} || "C:\\Program Files";
    10781075    if ($ENV{'VSINSTALLDIR'}) {
    10791076        $vsInstallDir = $ENV{'VSINSTALLDIR'};
    10801077    } else {
    1081         $vsInstallDir = "$programFilesPath/Microsoft Visual Studio 8";
    1082     }
    1083     $vsInstallDir = `cygpath "$vsInstallDir"`;
    1084     chomp $vsInstallDir;
    1085     $vcBuildPath = "$vsInstallDir/Common7/IDE/devenv.com";
     1078        $vsInstallDir = File::Spec->catdir($programFilesPath, "Microsoft Visual Studio 8");
     1079    }
     1080    chomp($vsInstallDir = `cygpath "$vsInstallDir"`) if isCygwin();
     1081    $vcBuildPath = File::Spec->catfile($vsInstallDir, qw(Common7 IDE devenv.com));
    10861082    if (-e $vcBuildPath) {
    10871083        # Visual Studio is installed; we can use pdevenv to build.
    1088         $vcBuildPath = File::Spec->catfile(sourceDir(), qw(WebKitTools Scripts pdevenv));
     1084        # FIXME: Make pdevenv work with non-Cygwin Perl.
     1085        $vcBuildPath = File::Spec->catfile(sourceDir(), qw(WebKitTools Scripts pdevenv)) if isCygwin();
    10891086    } else {
    10901087        # Visual Studio not found, try VC++ Express
    1091         $vcBuildPath = "$vsInstallDir/Common7/IDE/VCExpress.exe";
     1088        $vcBuildPath = File::Spec->catfile($vsInstallDir, qw(Common7 IDE VCExpress.exe));
    10921089        if (! -e $vcBuildPath) {
    10931090            print "*************************************************************\n";
     
    11021099    }
    11031100
    1104     my $qtSDKPath = "$programFilesPath/QuickTime SDK";
     1101    my $qtSDKPath = File::Spec->catdir($programFilesPath, "QuickTime SDK");
    11051102    if (0 && ! -e $qtSDKPath) {
    11061103        print "*************************************************************\n";
     
    11121109    }
    11131110   
    1114     chomp($ENV{'WEBKITLIBRARIESDIR'} = `cygpath -wa "$sourceDir/WebKitLibraries/win"`) unless $ENV{'WEBKITLIBRARIESDIR'};
    1115 
    1116     $windowsTmpPath = `cygpath -w /tmp`;
    1117     chomp $windowsTmpPath;
     1111    unless ($ENV{WEBKITLIBRARIESDIR}) {
     1112        $ENV{'WEBKITLIBRARIESDIR'} = File::Spec->catdir($sourceDir, "WebKitLibraries", "win");
     1113        chomp($ENV{WEBKITLIBRARIESDIR} = `cygpath -wa $ENV{WEBKITLIBRARIESDIR}`) if isCygwin();
     1114    }
     1115
    11181116    print "Building results into: ", baseProductDir(), "\n";
    11191117    print "WEBKITOUTPUTDIR is set to: ", $ENV{"WEBKITOUTPUTDIR"}, "\n";
     
    11981196    dieIfWindowsPlatformSDKNotInstalled() if $willUseVCExpressWhenBuilding;
    11991197
    1200     chomp(my $winProjectPath = `cygpath -w "$project"`);
     1198    chomp($project = `cygpath -w "$project"`) if isCygwin();
    12011199   
    12021200    my $action = "/build";
     
    12051203    }
    12061204
    1207     my @command = ($vcBuildPath, $winProjectPath, $action, $config);
     1205    my @command = ($vcBuildPath, $project, $action, $config);
    12081206
    12091207    print join(" ", @command), "\n";
Note: See TracChangeset for help on using the changeset viewer.