summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/run-webkit-tests
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/Scripts/run-webkit-tests')
-rwxr-xr-xWebKitTools/Scripts/run-webkit-tests127
1 files changed, 38 insertions, 89 deletions
diff --git a/WebKitTools/Scripts/run-webkit-tests b/WebKitTools/Scripts/run-webkit-tests
index 6dd8339..bb4fb34 100755
--- a/WebKitTools/Scripts/run-webkit-tests
+++ b/WebKitTools/Scripts/run-webkit-tests
@@ -67,6 +67,7 @@ use Time::HiRes qw(time usleep);
use List::Util 'shuffle';
use lib $FindBin::Bin;
+use webkitperl::httpd;
use webkitdirs;
use VCSUtils;
use POSIX;
@@ -75,8 +76,8 @@ sub buildPlatformResultHierarchy();
sub buildPlatformTestHierarchy(@);
sub closeCygpaths();
sub closeDumpTool();
-sub closeHTTPD();
sub closeWebSocketServer();
+sub configureAndOpenHTTPDIfNeeded();
sub countAndPrintLeaks($$$);
sub countFinishedTest($$$$);
sub deleteExpectedAndActualResults($);
@@ -91,7 +92,6 @@ sub resolveAndMakeTestResultsDirectory();
sub numericcmp($$);
sub openDiffTool();
sub openDumpTool();
-sub openHTTPDIfNeeded();
sub parseLeaksandPrintUniqueLeaks();
sub openWebSocketServerIfNeeded();
sub pathcmp($$);
@@ -143,7 +143,8 @@ my $showHelp = 0;
my $stripEditingCallbacks = isCygwin();
my $testHTTP = 1;
my $testMedia = 1;
-my $testResultsDirectory = "/tmp/layout-test-results";
+my $tmpDir = "/tmp";
+my $testResultsDirectory = File::Spec->catfile($tmpDir, "layout-test-results");
my $testsPerDumpTool = 1000;
my $threaded = 0;
# DumpRenderTree has an internal timeout of 15 seconds, so this must be > 15.
@@ -383,7 +384,8 @@ my @platformTestHierarchy = buildPlatformTestHierarchy(@platformResultHierarchy)
$expectedDirectory = $ENV{"WebKitExpectedTestResultsDirectory"} if $ENV{"WebKitExpectedTestResultsDirectory"};
-my $testResults = catfile($testResultsDirectory, "results.html");
+$testResultsDirectory = File::Spec->rel2abs($testResultsDirectory);
+my $testResults = File::Spec->catfile($testResultsDirectory, "results.html");
print "Running tests from $testDirectory\n";
if ($pixelTests) {
@@ -605,7 +607,7 @@ for my $test (@tests) {
}
if ($test =~ /^http\//) {
- openHTTPDIfNeeded();
+ configureAndOpenHTTPDIfNeeded();
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\///;
@@ -708,7 +710,7 @@ for my $test (@tests) {
my $actualPNG = "";
my $diffPNG = "";
- my $diffPercentage = "";
+ my $diffPercentage = 0;
my $diffResult = "passed";
my $actualHash = "";
@@ -762,12 +764,12 @@ for my $test (@tests) {
}
if (/^diff: (.+)% (passed|failed)/) {
- $diffPercentage = $1;
+ $diffPercentage = $1 + 0;
$imageDifferences{$base} = $diffPercentage;
$diffResult = $2;
}
- if ($diffPercentage == 0) {
+ if (!$diffPercentage) {
printFailureMessageForTest($test, "pixel hash failed (but pixel test still passes)");
}
} elsif ($verbose) {
@@ -945,7 +947,7 @@ printf "\n%0.2fs total testing time\n", (time - $overallStartTime) . "";
!$isDumpToolOpen || die "Failed to close $dumpToolName.\n";
-closeHTTPD();
+$isHttpdOpen = !closeHTTPD();
closeWebSocketServer();
# Because multiple instances of this script are running concurrently we cannot
@@ -1345,95 +1347,21 @@ sub dumpToolDidCrash()
return DumpRenderTreeSupport::processIsCrashing($dumpToolPID);
}
-sub openHTTPDIfNeeded()
+sub configureAndOpenHTTPDIfNeeded()
{
return if $isHttpdOpen;
-
- mkdir "/tmp/WebKit";
-
- if (-f "/tmp/WebKit/httpd.pid") {
- my $oldPid = `cat /tmp/WebKit/httpd.pid`;
- chomp $oldPid;
- if (0 != kill 0, $oldPid) {
- print "\nhttpd is already running: pid $oldPid, killing...\n";
- kill 15, $oldPid;
-
- my $retryCount = 20;
- while ((0 != kill 0, $oldPid) && $retryCount) {
- sleep 1;
- --$retryCount;
- }
-
- die "Timed out waiting for httpd to quit" unless $retryCount;
- }
- }
-
- my $httpdPath = "/usr/sbin/httpd";
- my $httpdConfig;
- if (isCygwin()) {
- my $windowsConfDirectory = "$testDirectory/http/conf/";
- unless (-x "/usr/lib/apache/libphp4.dll") {
- copy("$windowsConfDirectory/libphp4.dll", "/usr/lib/apache/libphp4.dll");
- chmod(0755, "/usr/lib/apache/libphp4.dll");
- }
- $httpdConfig = "$windowsConfDirectory/cygwin-httpd.conf";
- } elsif (isDebianBased()) {
- $httpdPath = "/usr/sbin/apache2";
- $httpdConfig = "$testDirectory/http/conf/apache2-debian-httpd.conf";
- } elsif (isFedoraBased()) {
- $httpdPath = "/usr/sbin/httpd";
- $httpdConfig = "$testDirectory/http/conf/fedora-httpd.conf";
- } else {
- $httpdConfig = "$testDirectory/http/conf/httpd.conf";
- $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|;
- }
- my $documentRoot = "$testDirectory/http/tests";
- my $jsTestResourcesDirectory = $testDirectory . "/fast/js/resources";
- my $typesConfig = "$testDirectory/http/conf/mime.types";
- my $listen = "127.0.0.1:$httpdPort";
my $absTestResultsDirectory = resolveAndMakeTestResultsDirectory();
- my $sslCertificate = "$testDirectory/http/conf/webkit-httpd.pem";
-
+ my $listen = "127.0.0.1:$httpdPort";
my @args = (
- "-f", "$httpdConfig",
- "-C", "DocumentRoot \"$documentRoot\"",
- # Setup a link to where the js test templates are stored, use -c so that mod_alias will already be laoded.
- "-c", "Alias /js-test-resources \"$jsTestResourcesDirectory\"",
- "-C", "Listen $listen",
- "-c", "TypesConfig \"$typesConfig\"",
"-c", "CustomLog \"$absTestResultsDirectory/access_log.txt\" common",
"-c", "ErrorLog \"$absTestResultsDirectory/error_log.txt\"",
- # Apache wouldn't run CGIs with permissions==700 otherwise
- "-c", "User \"#$<\""
+ "-C", "Listen $listen"
);
- # FIXME: Enable this on Windows once <rdar://problem/5345985> is fixed
- # The version of Apache we use with Cygwin does not support SSL
- push(@args, "-c", "SSLCertificateFile \"$sslCertificate\"") unless isCygwin();
+ my @defaultArgs = getDefaultConfigForTestDirectory($testDirectory);
+ @args = (@defaultArgs, @args);
- open2(\*HTTPDIN, \*HTTPDOUT, $httpdPath, @args);
-
- my $retryCount = 20;
- while (system("/usr/bin/curl -q --silent --stderr - --output " . File::Spec->devnull() . " $listen") && $retryCount) {
- sleep 1;
- --$retryCount;
- }
-
- die "Timed out waiting for httpd to start" unless $retryCount;
-
- $isHttpdOpen = 1;
-}
-
-sub closeHTTPD()
-{
- return if !$isHttpdOpen;
-
- close HTTPDIN;
- close HTTPDOUT;
-
- kill 15, `cat /tmp/WebKit/httpd.pid` if -f "/tmp/WebKit/httpd.pid";
-
- $isHttpdOpen = 0;
+ $isHttpdOpen = openHTTPD(@args);
}
sub openWebSocketServerIfNeeded()
@@ -1445,6 +1373,7 @@ sub openWebSocketServerIfNeeded()
my $webSocketPythonPath = "WebKitTools/pywebsocket";
my $webSocketHandlerDir = "$testDirectory";
my $webSocketHandlerScanDir = "$testDirectory/websocket/tests";
+ my $webSocketHandlerMapFile = "$webSocketHandlerScanDir/handler_map.txt";
my $sslCertificate = "$testDirectory/http/conf/webkit-httpd.pem";
my $absTestResultsDirectory = resolveAndMakeTestResultsDirectory();
my $logFile = "$absTestResultsDirectory/pywebsocket_log.txt";
@@ -1454,7 +1383,9 @@ sub openWebSocketServerIfNeeded()
"-p", "$webSocketPort",
"-d", "$webSocketHandlerDir",
"-s", "$webSocketHandlerScanDir",
+ "-m", "$webSocketHandlerMapFile",
"-l", "$logFile",
+ "--strict",
);
# wss is disabled until all platforms support pyOpenSSL.
# my @argsSecure = (
@@ -2220,6 +2151,24 @@ sub findTestsToRun
@testsToRun = sort pathcmp @testsToRun;
+ # We need to minimize the time when Apache and WebSocketServer is locked by tests
+ # so run them last if no explicit order was specified in the argument list.
+ if (!scalar @ARGV) {
+ my @httpTests;
+ my @websocketTests;
+ my @otherTests;
+ foreach my $test (@testsToRun) {
+ if ($test =~ /^http\//) {
+ push(@httpTests, $test);
+ } elsif ($test =~ /^websocket\//) {
+ push(@websocketTests, $test);
+ } else {
+ push(@otherTests, $test);
+ }
+ }
+ @testsToRun = (@otherTests, @httpTests, @websocketTests);
+ }
+
# Reverse the tests
@testsToRun = reverse @testsToRun if $reverseTests;