Changeset 54339 in webkit


Ignore:
Timestamp:
Feb 4, 2010 2:55:39 AM (14 years ago)
Author:
vestbo@webkit.org
Message:

Make run-webkit-tests work under Cygwin for the Qt port

Reviewed by Simon Hausmann.

setPathForRunningWebKitApp() is implemented for the Qt port
by using qmake to query for the location of the Qt libraries.

This requires the original environment (%ENV) to be untouched,
so launchWithCurrentEnv() was refactored to launchWithEnv(),
and the code in openDumpTool() to not use %ENV but a %CLEAN_ENV
instead. This has the added benefit of getting rid of the temp
variables used for storing the current env.

openDumpTool() is also refactored a bit into platform-spesific,
port-spesific, and generic environment variables.

Checks for undef was added a few places to fix Perl concat
warnings when run-webkit-tests is aborted.

https://bugs.webkit.org/show_bug.cgi?id=33895

  • Scripts/run-webkit-tests:
  • Scripts/webkitdirs.pm:
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r54336 r54339  
     12010-01-22  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        Make run-webkit-tests work under Cygwin for the Qt port
     6
     7        setPathForRunningWebKitApp() is implemented for the Qt port
     8        by using qmake to query for the location of the Qt libraries.
     9
     10        This requires the original environment (%ENV) to be untouched,
     11        so launchWithCurrentEnv() was refactored to launchWithEnv(),
     12        and the code in openDumpTool() to not use %ENV but a %CLEAN_ENV
     13        instead. This has the added benefit of getting rid of the temp
     14        variables used for storing the current env.
     15
     16        openDumpTool() is also refactored a bit into platform-spesific,
     17        port-spesific, and generic environment variables.
     18
     19        Checks for undef was added a few places to fix Perl concat
     20        warnings when run-webkit-tests is aborted.
     21
     22        https://bugs.webkit.org/show_bug.cgi?id=33895
     23
     24        * Scripts/run-webkit-tests:
     25        * Scripts/webkitdirs.pm:
     26
    1272010-02-04  Yuzo Fujishima  <yuzo@google.com>
    228
  • trunk/WebKitTools/Scripts/run-webkit-tests

    r54314 r54339  
    8888sub htmlForResultsSection(\@$&);
    8989sub isTextOnlyTest($);
    90 sub launchWithCurrentEnv(@);
     90sub launchWithEnv(\@\%);
    9191sub resolveAndMakeTestResultsDirectory();
    9292sub numericcmp($$);
     
    660660            $testPath = canonpath($testPath);
    661661        }
    662         print OUT "$testPath$suffixExpectedHash\n";
     662        print OUT "$testPath$suffixExpectedHash\n" if defined $testPath;
    663663    }
    664664
     
    10281028} elsif (isQt()) {
    10291029  unshift @configurationArgs, qw(-graphicssystem raster -style windows);
     1030  if (isCygwin()) {
     1031    $testResults = "/" . toWindowsPath($testResults);
     1032    $testResults =~ s/\\/\//g;
     1033  }
    10301034  system "WebKitTools/Scripts/run-launcher", @configurationArgs, "file://".$testResults if $launchSafari;
    10311035} elsif (isCygwin()) {
     
    12111215}
    12121216
    1213 sub launchWithCurrentEnv(@)
    1214 {
    1215     my (@args) = @_;
     1217sub launchWithEnv(\@\%)
     1218{
     1219    my ($args, $env) = @_;
    12161220
    12171221    # Dump the current environment as perl code and then put it in quotes so it is one parameter.
    1218     my $environmentDumper = Data::Dumper->new([\%ENV], [qw(*ENV)]);
     1222    my $environmentDumper = Data::Dumper->new([\%{$env}], [qw(*ENV)]);
    12191223    $environmentDumper->Indent(0);
    12201224    $environmentDumper->Purity(1);
    12211225    my $allEnvVars = $environmentDumper->Dump();
    1222     unshift @args, "\"$allEnvVars\"";
     1226    unshift @{$args}, "\"$allEnvVars\"";
    12231227
    12241228    my $execScript = File::Spec->catfile(sourceDir(), qw(WebKitTools Scripts execAppWithEnv));
    1225     unshift @args, $execScript;
    1226     return @args;
     1229    unshift @{$args}, $execScript;
     1230    return @{$args};
    12271231}
    12281232
     
    12391243    return if !$pixelTests;
    12401244
    1241     local %ENV;
    1242     $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
    1243     $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, launchWithCurrentEnv(@diffToolArgs)) or die "unable to open $imageDiffTool\n";
    1244     $ENV{MallocStackLogging} = 0 if $shouldCheckLeaks;
     1245    my %CLEAN_ENV;
     1246    $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
     1247    $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, launchWithEnv(@diffToolArgs, %CLEAN_ENV)) or die "unable to open $imageDiffTool\n";
    12451248    $isDiffToolOpen = 1;
    12461249}
     
    12501253    return if $isDumpToolOpen;
    12511254
    1252     # Save environment variables required for the linux environment.
    1253     my $homeDir = $ENV{'HOME'};
    1254     my $libraryPath = $ENV{'LD_LIBRARY_PATH'};
    1255     my $dyldLibraryPath = $ENV{'DYLD_LIBRARY_PATH'};
    1256     my $dbusAddress = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
    1257     my $display = $ENV{'DISPLAY'};
    1258     my $xauthority = $ENV{'XAUTHORITY'};
    1259     my $testfonts = $ENV{'WEBKIT_TESTFONTS'};
    1260 
    1261     my $homeDrive = $ENV{'HOMEDRIVE'};
    1262     my $homePath = $ENV{'HOMEPATH'};
    1263        
    1264     local %ENV;
    1265     if (isQt() || isGtk()) {
    1266         if (defined $display) {
    1267             $ENV{DISPLAY} = $display;
     1255    my %CLEAN_ENV;
     1256
     1257    # Generic environment variables
     1258    if (defined $ENV{'WEBKIT_TESTFONTS'}) {
     1259        $CLEAN_ENV{WEBKIT_TESTFONTS} = $ENV{'WEBKIT_TESTFONTS'};
     1260    }
     1261
     1262    $CLEAN_ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995>
     1263
     1264    # Platform spesifics
     1265    if (isLinux()) {
     1266        if (defined $ENV{'DISPLAY'}) {
     1267            $CLEAN_ENV{DISPLAY} = $ENV{'DISPLAY'};
    12681268        } else {
    1269             $ENV{DISPLAY} = ":1";
    1270         }
    1271         if (defined $xauthority) {
    1272             $ENV{XAUTHORITY} = $xauthority;
    1273         }
    1274         $ENV{'WEBKIT_TESTFONTS'} = $testfonts if defined($testfonts);
    1275         $ENV{HOME} = $homeDir;
    1276         if (defined $libraryPath) {
    1277             $ENV{LD_LIBRARY_PATH} = $libraryPath;
    1278         }
    1279         if (defined $dyldLibraryPath) {
    1280             $ENV{DYLD_LIBRARY_PATH} = $dyldLibraryPath;
    1281         }
    1282         if (defined $dbusAddress) {
    1283             $ENV{DBUS_SESSION_BUS_ADDRESS} = $dbusAddress;
    1284         }
    1285     }
     1269            $CLEAN_ENV{DISPLAY} = ":1";
     1270        }
     1271        if (defined $ENV{'XAUTHORITY'}) {
     1272            $CLEAN_ENV{XAUTHORITY} = $ENV{'XAUTHORITY'};
     1273        }
     1274
     1275        $CLEAN_ENV{HOME} = $ENV{'HOME'};
     1276
     1277        if (defined $ENV{'LD_LIBRARY_PATH'}) {
     1278            $CLEAN_ENV{LD_LIBRARY_PATH} = $ENV{'LD_LIBRARY_PATH'};
     1279        }
     1280        if (defined $ENV{'DBUS_SESSION_BUS_ADDRESS'}) {
     1281            $CLEAN_ENV{DBUS_SESSION_BUS_ADDRESS} = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
     1282        }
     1283    } elsif (isDarwin()) {
     1284        if (defined $ENV{'DYLD_LIBRARY_PATH'}) {
     1285            $CLEAN_ENV{DYLD_LIBRARY_PATH} = $ENV{'DYLD_LIBRARY_PATH'};
     1286        }
     1287
     1288        $CLEAN_ENV{DYLD_FRAMEWORK_PATH} = $productDir;
     1289        $CLEAN_ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
     1290    } elsif (isCygwin()) {
     1291        $CLEAN_ENV{HOMEDRIVE} = $ENV{'HOMEDRIVE'};
     1292        $CLEAN_ENV{HOMEPATH} = $ENV{'HOMEPATH'};
     1293
     1294        setPathForRunningWebKitApp(\%CLEAN_ENV);
     1295    }
     1296
     1297    # Port spesifics
    12861298    if (isQt()) {
    1287         $ENV{QTWEBKIT_PLUGIN_PATH} = productDir() . "/lib/plugins";
    1288     }
    1289     $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    1290     $ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995>
    1291     $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
     1299        $CLEAN_ENV{QTWEBKIT_PLUGIN_PATH} = productDir() . "/lib/plugins";
     1300    }
    12921301   
    1293     if (isCygwin()) {
    1294         $ENV{HOMEDRIVE} = $homeDrive;
    1295         $ENV{HOMEPATH} = $homePath;
    1296         if ($testfonts) {
    1297             $ENV{WEBKIT_TESTFONTS} = $testfonts;
    1298         }
    1299         setPathForRunningWebKitApp(\%ENV) if isCygwin();
    1300     }
    1301 
    13021302    my @args = ($dumpTool, @toolArgs);
    13031303    if (isAppleMacWebKit() and !isTiger()) {
     
    13081308        unshift @args, "valgrind", "--suppressions=$platformBaseDirectory/qt/SuppressedValgrindErrors";
    13091309    }
    1310    
    1311     $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
    1312     $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithCurrentEnv(@args)) or die "Failed to start tool: $dumpTool\n";
    1313     $ENV{MallocStackLogging} = 0 if $shouldCheckLeaks;
     1310
     1311    $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
     1312
     1313    $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithEnv(@args, %CLEAN_ENV)) or die "Failed to start tool: $dumpTool\n";
    13141314    $isDumpToolOpen = 1;
    13151315    $dumpToolCrashed = 0;
     
    13381338    return 1 if $dumpToolCrashed;
    13391339    return 0 unless $isDumpToolOpen;
    1340 
    13411340    my $pid = waitpid(-1, WNOHANG);
    13421341    return 1 if ($pid == $dumpToolPID);
     
    16181617    local *outFH = $cygpath->{"out"};
    16191618    print outFH $path . "\n";
    1620     chomp(my $convertedPath = <inFH>);
     1619    my $convertedPath = <inFH>;
     1620    chomp($convertedPath) if defined $convertedPath;
    16211621    return $convertedPath;
    16221622}
  • trunk/WebKitTools/Scripts/webkitdirs.pm

    r53783 r54339  
    542542            return "$configurationProductDir/lib/$libraryName.framework/$libraryName";
    543543        } elsif (isWindows()) {
    544             chomp(my $mkspec = `qmake -query QMAKE_MKSPECS`);
     544            my $mkspec = `qmake -query QMAKE_MKSPECS`;
     545            $mkspec =~ s/[\n|\r]$//g;
    545546            my $qtMajorVersion = retrieveQMakespecVar("$mkspec/qconfig.pri", "QT_MAJOR_VERSION");
    546             if ($qtMajorVersion eq "unknown") {
     547            if (not $qtMajorVersion) {
    547548                $qtMajorVersion = "";
    548549            }
     
    13291330    my $varname = $_[1];
    13301331
    1331     my $compiler = "unknown";
     1332    my $varvalue = undef;
    13321333    #print "retrieveMakespecVar " . $mkspec . ", " . $varname . "\n";
    13331334
    13341335    local *SPEC;
    1335     open SPEC, "<$mkspec" or return "make";
     1336    open SPEC, "<$mkspec" or return $varvalue;
    13361337    while (<SPEC>) {
    13371338        if ($_ =~ /\s*include\((.+)\)/) {
     
    13411342            my $newcwd = "$volume$directories";
    13421343            chdir $newcwd if $newcwd;
    1343             $compiler = retrieveQMakespecVar($1, $varname);
     1344            $varvalue = retrieveQMakespecVar($1, $varname);
    13441345            chdir $oldcwd;
    13451346        } elsif ($_ =~ /$varname\s*=\s*([^\s]+)/) {
    1346             $compiler = $1;
     1347            $varvalue = $1;
    13471348            last;
    13481349        }
    13491350    }
    13501351    close SPEC;
    1351     return $compiler;
     1352    return $varvalue;
    13521353}
    13531354
     
    16461647    my ($env) = @_;
    16471648
    1648     return unless isAppleWinWebKit();
    1649 
    1650     $env->{PATH} = join(':', productDir(), dirname(installedSafariPath()), appleApplicationSupportPath(), $env->{PATH} || "");
     1649    if (isAppleWinWebKit()) {
     1650        $env->{PATH} = join(':', productDir(), dirname(installedSafariPath()), appleApplicationSupportPath(), $env->{PATH} || "");
     1651    } elsif (isQt()) {
     1652        my $qtLibs = `qmake -query QT_INSTALL_LIBS`;
     1653        $qtLibs =~ s/[\n|\r]$//g;
     1654        $env->{PATH} = join(';', $qtLibs, productDir() . "/lib", $env->{PATH} || "");
     1655    }
    16511656}
    16521657
Note: See TracChangeset for help on using the changeset viewer.