Commit d51d95a4 authored by vestbo@webkit.org's avatar vestbo@webkit.org

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:

git-svn-id: svn://svn.chromium.org/blink/trunk@54339 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6a78c72d
2010-01-22 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Reviewed by Simon Hausmann.
Make run-webkit-tests work under Cygwin for the Qt port
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:
2010-02-04 Yuzo Fujishima <yuzo@google.com>
Unreviewed.
......
......@@ -87,7 +87,7 @@ sub expectedDirectoryForTest($;$;$);
sub fileNameWithNumber($$);
sub htmlForResultsSection(\@$&);
sub isTextOnlyTest($);
sub launchWithCurrentEnv(@);
sub launchWithEnv(\@\%);
sub resolveAndMakeTestResultsDirectory();
sub numericcmp($$);
sub openDiffTool();
......@@ -659,7 +659,7 @@ for my $test (@tests) {
} else {
$testPath = canonpath($testPath);
}
print OUT "$testPath$suffixExpectedHash\n";
print OUT "$testPath$suffixExpectedHash\n" if defined $testPath;
}
# DumpRenderTree is expected to dump two "blocks" to stdout for each test.
......@@ -1027,6 +1027,10 @@ if (isGtk()) {
system "WebKitTools/Scripts/run-launcher", @configurationArgs, "file://".$testResults if $launchSafari;
} elsif (isQt()) {
unshift @configurationArgs, qw(-graphicssystem raster -style windows);
if (isCygwin()) {
$testResults = "/" . toWindowsPath($testResults);
$testResults =~ s/\\/\//g;
}
system "WebKitTools/Scripts/run-launcher", @configurationArgs, "file://".$testResults if $launchSafari;
} elsif (isCygwin()) {
system "cygstart", $testResults if $launchSafari;
......@@ -1210,20 +1214,20 @@ sub slowestcmp($$)
return pathcmp($testa, $testb);
}
sub launchWithCurrentEnv(@)
sub launchWithEnv(\@\%)
{
my (@args) = @_;
my ($args, $env) = @_;
# Dump the current environment as perl code and then put it in quotes so it is one parameter.
my $environmentDumper = Data::Dumper->new([\%ENV], [qw(*ENV)]);
my $environmentDumper = Data::Dumper->new([\%{$env}], [qw(*ENV)]);
$environmentDumper->Indent(0);
$environmentDumper->Purity(1);
my $allEnvVars = $environmentDumper->Dump();
unshift @args, "\"$allEnvVars\"";
unshift @{$args}, "\"$allEnvVars\"";
my $execScript = File::Spec->catfile(sourceDir(), qw(WebKitTools Scripts execAppWithEnv));
unshift @args, $execScript;
return @args;
unshift @{$args}, $execScript;
return @{$args};
}
sub resolveAndMakeTestResultsDirectory()
......@@ -1238,10 +1242,9 @@ sub openDiffTool()
return if $isDiffToolOpen;
return if !$pixelTests;
local %ENV;
$ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
$imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, launchWithCurrentEnv(@diffToolArgs)) or die "unable to open $imageDiffTool\n";
$ENV{MallocStackLogging} = 0 if $shouldCheckLeaks;
my %CLEAN_ENV;
$CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
$imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, launchWithEnv(@diffToolArgs, %CLEAN_ENV)) or die "unable to open $imageDiffTool\n";
$isDiffToolOpen = 1;
}
......@@ -1249,56 +1252,53 @@ sub openDumpTool()
{
return if $isDumpToolOpen;
# Save environment variables required for the linux environment.
my $homeDir = $ENV{'HOME'};
my $libraryPath = $ENV{'LD_LIBRARY_PATH'};
my $dyldLibraryPath = $ENV{'DYLD_LIBRARY_PATH'};
my $dbusAddress = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
my $display = $ENV{'DISPLAY'};
my $xauthority = $ENV{'XAUTHORITY'};
my $testfonts = $ENV{'WEBKIT_TESTFONTS'};
my $homeDrive = $ENV{'HOMEDRIVE'};
my $homePath = $ENV{'HOMEPATH'};
local %ENV;
if (isQt() || isGtk()) {
if (defined $display) {
$ENV{DISPLAY} = $display;
my %CLEAN_ENV;
# Generic environment variables
if (defined $ENV{'WEBKIT_TESTFONTS'}) {
$CLEAN_ENV{WEBKIT_TESTFONTS} = $ENV{'WEBKIT_TESTFONTS'};
}
$CLEAN_ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995>
# Platform spesifics
if (isLinux()) {
if (defined $ENV{'DISPLAY'}) {
$CLEAN_ENV{DISPLAY} = $ENV{'DISPLAY'};
} else {
$ENV{DISPLAY} = ":1";
$CLEAN_ENV{DISPLAY} = ":1";
}
if (defined $xauthority) {
$ENV{XAUTHORITY} = $xauthority;
if (defined $ENV{'XAUTHORITY'}) {
$CLEAN_ENV{XAUTHORITY} = $ENV{'XAUTHORITY'};
}
$ENV{'WEBKIT_TESTFONTS'} = $testfonts if defined($testfonts);
$ENV{HOME} = $homeDir;
if (defined $libraryPath) {
$ENV{LD_LIBRARY_PATH} = $libraryPath;
$CLEAN_ENV{HOME} = $ENV{'HOME'};
if (defined $ENV{'LD_LIBRARY_PATH'}) {
$CLEAN_ENV{LD_LIBRARY_PATH} = $ENV{'LD_LIBRARY_PATH'};
}
if (defined $dyldLibraryPath) {
$ENV{DYLD_LIBRARY_PATH} = $dyldLibraryPath;
if (defined $ENV{'DBUS_SESSION_BUS_ADDRESS'}) {
$CLEAN_ENV{DBUS_SESSION_BUS_ADDRESS} = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
}
if (defined $dbusAddress) {
$ENV{DBUS_SESSION_BUS_ADDRESS} = $dbusAddress;
} elsif (isDarwin()) {
if (defined $ENV{'DYLD_LIBRARY_PATH'}) {
$CLEAN_ENV{DYLD_LIBRARY_PATH} = $ENV{'DYLD_LIBRARY_PATH'};
}
$CLEAN_ENV{DYLD_FRAMEWORK_PATH} = $productDir;
$CLEAN_ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
} elsif (isCygwin()) {
$CLEAN_ENV{HOMEDRIVE} = $ENV{'HOMEDRIVE'};
$CLEAN_ENV{HOMEPATH} = $ENV{'HOMEPATH'};
setPathForRunningWebKitApp(\%CLEAN_ENV);
}
# Port spesifics
if (isQt()) {
$ENV{QTWEBKIT_PLUGIN_PATH} = productDir() . "/lib/plugins";
$CLEAN_ENV{QTWEBKIT_PLUGIN_PATH} = productDir() . "/lib/plugins";
}
$ENV{DYLD_FRAMEWORK_PATH} = $productDir;
$ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995>
$ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
if (isCygwin()) {
$ENV{HOMEDRIVE} = $homeDrive;
$ENV{HOMEPATH} = $homePath;
if ($testfonts) {
$ENV{WEBKIT_TESTFONTS} = $testfonts;
}
setPathForRunningWebKitApp(\%ENV) if isCygwin();
}
my @args = ($dumpTool, @toolArgs);
if (isAppleMacWebKit() and !isTiger()) {
unshift @args, "arch", "-" . architecture();
......@@ -1307,10 +1307,10 @@ sub openDumpTool()
if ($useValgrind) {
unshift @args, "valgrind", "--suppressions=$platformBaseDirectory/qt/SuppressedValgrindErrors";
}
$ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
$dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithCurrentEnv(@args)) or die "Failed to start tool: $dumpTool\n";
$ENV{MallocStackLogging} = 0 if $shouldCheckLeaks;
$CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
$dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithEnv(@args, %CLEAN_ENV)) or die "Failed to start tool: $dumpTool\n";
$isDumpToolOpen = 1;
$dumpToolCrashed = 0;
}
......@@ -1337,7 +1337,6 @@ sub dumpToolDidCrash()
{
return 1 if $dumpToolCrashed;
return 0 unless $isDumpToolOpen;
my $pid = waitpid(-1, WNOHANG);
return 1 if ($pid == $dumpToolPID);
......@@ -1617,7 +1616,8 @@ sub convertPathUsingCygpath($$)
local *inFH = $cygpath->{"in"};
local *outFH = $cygpath->{"out"};
print outFH $path . "\n";
chomp(my $convertedPath = <inFH>);
my $convertedPath = <inFH>;
chomp($convertedPath) if defined $convertedPath;
return $convertedPath;
}
......
......@@ -541,9 +541,10 @@ sub builtDylibPathForName
if (isDarwin() and -d "$configurationProductDir/lib/$libraryName.framework") {
return "$configurationProductDir/lib/$libraryName.framework/$libraryName";
} elsif (isWindows()) {
chomp(my $mkspec = `qmake -query QMAKE_MKSPECS`);
my $mkspec = `qmake -query QMAKE_MKSPECS`;
$mkspec =~ s/[\n|\r]$//g;
my $qtMajorVersion = retrieveQMakespecVar("$mkspec/qconfig.pri", "QT_MAJOR_VERSION");
if ($qtMajorVersion eq "unknown") {
if (not $qtMajorVersion) {
$qtMajorVersion = "";
}
return "$configurationProductDir/lib/$libraryName$qtMajorVersion.dll";
......@@ -1328,11 +1329,11 @@ sub retrieveQMakespecVar
my $mkspec = $_[0];
my $varname = $_[1];
my $compiler = "unknown";
my $varvalue = undef;
#print "retrieveMakespecVar " . $mkspec . ", " . $varname . "\n";
local *SPEC;
open SPEC, "<$mkspec" or return "make";
open SPEC, "<$mkspec" or return $varvalue;
while (<SPEC>) {
if ($_ =~ /\s*include\((.+)\)/) {
# open the included mkspec
......@@ -1340,15 +1341,15 @@ sub retrieveQMakespecVar
(my $volume, my $directories, my $file) = File::Spec->splitpath($mkspec);
my $newcwd = "$volume$directories";
chdir $newcwd if $newcwd;
$compiler = retrieveQMakespecVar($1, $varname);
$varvalue = retrieveQMakespecVar($1, $varname);
chdir $oldcwd;
} elsif ($_ =~ /$varname\s*=\s*([^\s]+)/) {
$compiler = $1;
$varvalue = $1;
last;
}
}
close SPEC;
return $compiler;
return $varvalue;
}
sub qtMakeCommand($)
......@@ -1645,9 +1646,13 @@ sub setPathForRunningWebKitApp
{
my ($env) = @_;
return unless isAppleWinWebKit();
$env->{PATH} = join(':', productDir(), dirname(installedSafariPath()), appleApplicationSupportPath(), $env->{PATH} || "");
if (isAppleWinWebKit()) {
$env->{PATH} = join(':', productDir(), dirname(installedSafariPath()), appleApplicationSupportPath(), $env->{PATH} || "");
} elsif (isQt()) {
my $qtLibs = `qmake -query QT_INSTALL_LIBS`;
$qtLibs =~ s/[\n|\r]$//g;
$env->{PATH} = join(';', $qtLibs, productDir() . "/lib", $env->{PATH} || "");
}
}
sub runSafari
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment