Changeset 53559 in webkit
- Timestamp:
- Jan 20, 2010 12:05:58 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r53543 r53559 1 2010-01-20 Andras Becsi <abecsi@inf.u-szeged.hu> 2 3 Reviewed by Alexey Proskuryakov. 4 5 Extract Apache handling to httpd.pm module and use the provided functionality 6 in scripts where Apache is needed. 7 The module httpd.pm stores the PID of Apache in a variable and cleans up 8 the PID directory after Apache properly shut down. Catching INT and TERM 9 signals allows the scripts to close Apache and clean up its PID directory 10 even if the testing was interrupted. 11 12 https://bugs.webkit.org/show_bug.cgi?id=33153 13 14 * Scripts/webkitperl/httpd.pm: Added. 15 * Scripts/run-iexploder-tests: 16 * Scripts/run-webkit-httpd: 17 * Scripts/run-webkit-tests: 18 1 19 2010-01-20 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 20 -
trunk/WebKitTools/Scripts/run-iexploder-tests
r50080 r53559 39 39 40 40 use lib $FindBin::Bin; 41 use webkitperl::httpd; 41 42 use webkitdirs; 42 43 43 sub openHTTPDIfNeeded(); 44 sub closeHTTPD(); 44 sub configureAndOpenHTTPDIfNeeded(); 45 45 sub runSafariWithIExploder(); 46 46 … … 49 49 my $httpdPort = 8000; 50 50 my $downloadTest; 51 my $iExploderTestDirectory = "/tmp/iExploderTest"; 51 52 52 53 GetOptions( … … 64 65 checkFrameworks(); 65 66 66 my $ httpdOpen = 0;67 openHTTPDIfNeeded();67 my $isHttpdOpen = 0; 68 configureAndOpenHTTPDIfNeeded(); 68 69 69 70 if ($downloadTest) { … … 73 74 runSafariWithIExploder(); 74 75 print "Last generated tests:\n"; 75 system "grep 'iexploder.cgi' /tmp/WebKit/access_log.txt | tail -n -5 | awk -F'[ =&\\?]' '{if (\$8 == \"lookup\") print \$11; else print \$9}'";76 system "grep 'iexploder.cgi' $iExploderTestDirectory/access_log.txt | tail -n -5 | awk -F'[ =&\\?]' '{if (\$8 == \"lookup\") print \$11; else print \$9}'"; 76 77 } 77 78 78 closeHTTPD();79 79 rmtree $iExploderTestDirectory; 80 $isHttpdOpen = !closeHTTPD(); 80 81 81 82 sub runSafariWithIExploder() … … 88 89 } 89 90 90 open REDIRECT_HTML, ">", " /tmp/WebKit/redirect.html" or die;91 open REDIRECT_HTML, ">", "$iExploderTestDirectory/redirect.html" or die; 91 92 print REDIRECT_HTML "<html>\n"; 92 93 print REDIRECT_HTML " <head>\n"; … … 103 104 local %ENV; 104 105 $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc; 105 system "WebKitTools/Scripts/run-safari", "-NSOpen", " /tmp/WebKit/redirect.html";106 system "WebKitTools/Scripts/run-safari", "-NSOpen", "$iExploderTestDirectory/redirect.html"; 106 107 } 107 108 108 sub openHTTPDIfNeeded()109 sub configureAndOpenHTTPDIfNeeded() 109 110 { 110 return if $httpdOpen; 111 112 mkdir "/tmp/WebKit"; 113 114 if (-f "/tmp/WebKit/httpd.pid") { 115 my $oldPid = `cat /tmp/WebKit/httpd.pid`; 116 chomp $oldPid; 117 if (0 != kill 0, $oldPid) { 118 print "\nhttpd is already running: pid $oldPid, killing...\n"; 119 kill 15, $oldPid; 120 121 my $retryCount = 20; 122 while ((0 != kill 0, $oldPid) && $retryCount) { 123 sleep 1; 124 --$retryCount; 125 } 126 127 die "Timed out waiting for httpd to quit" unless $retryCount; 128 } 129 } 130 131 my $testDirectory = getcwd() . "/LayoutTests"; 132 my $iExploderDirectory = getcwd() . "/WebKitTools/iExploder"; 133 my $httpdPath = "/usr/sbin/httpd"; 111 return if $isHttpdOpen; 112 mkdir $iExploderTestDirectory; 113 my $httpdPath = getHTTPDPath(); 114 my $webkitDirectory = getcwd(); 115 my $testDirectory = $webkitDirectory . "/LayoutTests"; 116 my $iExploderDirectory = $webkitDirectory . "/WebKitTools/iExploder"; 134 117 my $httpdConfig = "$testDirectory/http/conf/httpd.conf"; 135 118 $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|; … … 139 122 my $listen = "127.0.0.1:$httpdPort"; 140 123 141 open2(\*HTTPDIN, \*HTTPDOUT, $httpdPath, 124 125 my @args = ( 142 126 "-f", "$httpdConfig", 143 127 "-C", "DocumentRoot \"$documentRoot\"", 144 128 "-C", "Listen $listen", 145 129 "-c", "TypesConfig \"$typesConfig\"", 146 "-c", "CustomLog \" /tmp/WebKit/access_log.txt\" common",147 "-c", "ErrorLog \" /tmp/WebKit/error_log.txt\"",130 "-c", "CustomLog \"$iExploderTestDirectory/access_log.txt\" common", 131 "-c", "ErrorLog \"$iExploderTestDirectory/error_log.txt\"", 148 132 "-c", "SSLCertificateFile \"$sslCertificate\"", 149 133 # Apache wouldn't run CGIs with permissions==700 otherwise 150 "-c", "User \"#$<\""); 134 "-c", "User \"#$<\"" 135 ); 151 136 152 my $retryCount = 20; 153 while (system("/usr/bin/curl -q --silent --stderr - --output " . File::Spec->devnull() . " $listen") && $retryCount) { 154 sleep 1; 155 --$retryCount; 156 } 157 158 die "Timed out waiting for httpd to start" unless $retryCount; 159 160 $httpdOpen = 1; 137 $isHttpdOpen = openHTTPD(@args); 161 138 } 162 163 sub closeHTTPD()164 {165 return if !$httpdOpen;166 167 close HTTPDIN;168 close HTTPDOUT;169 170 kill 15, `cat /tmp/WebKit/httpd.pid` if -f "/tmp/WebKit/httpd.pid";171 172 $httpdOpen = 0;173 } -
trunk/WebKitTools/Scripts/run-webkit-httpd
r47930 r53559 34 34 35 35 use Cwd; 36 use File::Path; 36 37 use File::Basename; 37 38 use Getopt::Long; … … 39 40 40 41 use lib $FindBin::Bin; 42 use webkitperl::httpd; 41 43 use webkitdirs; 42 44 … … 63 65 my $productDir = productDir(); 64 66 chdirWebKit(); 65 66 mkdir "/tmp/WebKit"; 67 68 if (-f "/tmp/WebKit/httpd.pid") { 69 my $oldPid = `cat /tmp/WebKit/httpd.pid`; 70 chomp $oldPid; 71 if (0 != kill 0, $oldPid) { 72 print "\nhttpd is already running: pid $oldPid, killing...\n"; 73 kill 15, $oldPid; 74 75 my $retryCount = 20; 76 while ((0 != kill 0, $oldPid) && $retryCount) { 77 sleep 1; 78 --$retryCount; 79 } 80 81 die "Timed out waiting for httpd to quit" unless $retryCount; 82 } 83 } 84 85 my $testDirectory = getcwd() . "/LayoutTests"; 86 my $jsTestResourcesDirectory = $testDirectory . "/fast/js/resources"; 87 my $httpdPath = "/usr/sbin/httpd"; 88 $httpdPath = "/usr/sbin/apache2" if isDebianBased(); 89 my $httpdConfig = "$testDirectory/http/conf/httpd.conf"; 90 $httpdConfig = "$testDirectory/http/conf/cygwin-httpd.conf" if isCygwin(); 91 $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|; 92 $httpdConfig = "$testDirectory/http/conf/apache2-debian-httpd.conf" if isDebianBased(); 93 $httpdConfig = "$testDirectory/http/conf/fedora-httpd.conf" if isFedoraBased(); 94 my $documentRoot = "$testDirectory/http/tests"; 95 my $typesConfig = "$testDirectory/http/conf/mime.types"; 96 my $sslCertificate = "$testDirectory/http/conf/webkit-httpd.pem"; 97 67 my $testDirectory = File::Spec->catfile(getcwd(), "LayoutTests"); 98 68 my $listen = "127.0.0.1:$httpdPort"; 99 69 $listen = "$httpdPort" if ($allInterfaces); … … 104 74 print "Starting httpd on <http://$listen/>...\n"; 105 75 } 76 setShouldWaitForUserInterrupt(); 106 77 print "Press Ctrl+C to stop it.\n\n"; 107 78 108 79 my @args = ( 109 "-f", "$httpdConfig",110 "-C", "DocumentRoot \"$documentRoot\"",111 # Setup a link to where the js test templates are stored, use -c so that mod_alias will already be laoded.112 "-c", "Alias /js-test-resources \"$jsTestResourcesDirectory\"",113 80 "-C", "Listen $listen", 114 "-c", "TypesConfig \"$typesConfig\"",115 81 "-c", "CustomLog |/usr/bin/tee common", 116 82 "-c", "ErrorLog |/usr/bin/tee", 117 # Apache wouldn't run CGIs with permissions==700 otherwise.118 "-c", "User \"#$<\"",119 83 # Run in single-process mode, do not detach from the controlling terminal. 120 84 "-X", … … 124 88 ); 125 89 126 # FIXME: Enable this on Windows once <rdar://problem/5345985> is fixed 127 push(@args, "-c", "SSLCertificateFile \"$sslCertificate\"") unless isCygwin(); 128 129 system($httpdPath, @args); 130 131 unlink "/tmp/WebKit/httpd.pid"; 90 my @defaultArgs = getDefaultConfigForTestDirectory($testDirectory); 91 @args = (@defaultArgs, @args); 92 openHTTPD(@args); -
trunk/WebKitTools/Scripts/run-webkit-tests
r53015 r53559 68 68 69 69 use lib $FindBin::Bin; 70 use webkitperl::httpd; 70 71 use webkitdirs; 71 72 use VCSUtils; … … 76 77 sub closeCygpaths(); 77 78 sub closeDumpTool(); 78 sub closeHTTPD();79 79 sub closeWebSocketServer(); 80 sub configureAndOpenHTTPDIfNeeded(); 80 81 sub countAndPrintLeaks($$$); 81 82 sub countFinishedTest($$$$); … … 92 93 sub openDiffTool(); 93 94 sub openDumpTool(); 94 sub openHTTPDIfNeeded();95 95 sub parseLeaksandPrintUniqueLeaks(); 96 96 sub openWebSocketServerIfNeeded(); … … 144 144 my $testHTTP = 1; 145 145 my $testMedia = 1; 146 my $testResultsDirectory = "/tmp/layout-test-results"; 146 my $tmpDir = "/tmp"; 147 my $testResultsDirectory = File::Spec->catfile($tmpDir, "layout-test-results"); 147 148 my $testsPerDumpTool = 1000; 148 149 my $threaded = 0; … … 384 385 $expectedDirectory = $ENV{"WebKitExpectedTestResultsDirectory"} if $ENV{"WebKitExpectedTestResultsDirectory"}; 385 386 386 my $testResults = catfile($testResultsDirectory, "results.html"); 387 $testResultsDirectory = File::Spec->rel2abs($testResultsDirectory); 388 my $testResults = File::Spec->catfile($testResultsDirectory, "results.html"); 387 389 388 390 print "Running tests from $testDirectory\n"; … … 606 608 607 609 if ($test =~ /^http\//) { 608 openHTTPDIfNeeded();610 configureAndOpenHTTPDIfNeeded(); 609 611 if ($test !~ /^http\/tests\/local\// && $test !~ /^http\/tests\/ssl\// && $test !~ /^http\/tests\/wml\// && $test !~ /^http\/tests\/media\//) { 610 612 my $path = canonpath($test); … … 946 948 !$isDumpToolOpen || die "Failed to close $dumpToolName.\n"; 947 949 948 closeHTTPD();950 $isHttpdOpen = !closeHTTPD(); 949 951 closeWebSocketServer(); 950 952 … … 1346 1348 } 1347 1349 1348 sub openHTTPDIfNeeded()1350 sub configureAndOpenHTTPDIfNeeded() 1349 1351 { 1350 1352 return if $isHttpdOpen; 1351 1352 mkdir "/tmp/WebKit"; 1353 1354 if (-f "/tmp/WebKit/httpd.pid") { 1355 my $oldPid = `cat /tmp/WebKit/httpd.pid`; 1356 chomp $oldPid; 1357 if (0 != kill 0, $oldPid) { 1358 print "\nhttpd is already running: pid $oldPid, killing...\n"; 1359 kill 15, $oldPid; 1360 1361 my $retryCount = 20; 1362 while ((0 != kill 0, $oldPid) && $retryCount) { 1363 sleep 1; 1364 --$retryCount; 1365 } 1366 1367 die "Timed out waiting for httpd to quit" unless $retryCount; 1368 } 1369 } 1370 1371 my $httpdPath = "/usr/sbin/httpd"; 1372 my $httpdConfig; 1373 if (isCygwin()) { 1374 my $windowsConfDirectory = "$testDirectory/http/conf/"; 1375 unless (-x "/usr/lib/apache/libphp4.dll") { 1376 copy("$windowsConfDirectory/libphp4.dll", "/usr/lib/apache/libphp4.dll"); 1377 chmod(0755, "/usr/lib/apache/libphp4.dll"); 1378 } 1379 $httpdConfig = "$windowsConfDirectory/cygwin-httpd.conf"; 1380 } elsif (isDebianBased()) { 1381 $httpdPath = "/usr/sbin/apache2"; 1382 $httpdConfig = "$testDirectory/http/conf/apache2-debian-httpd.conf"; 1383 } elsif (isFedoraBased()) { 1384 $httpdPath = "/usr/sbin/httpd"; 1385 $httpdConfig = "$testDirectory/http/conf/fedora-httpd.conf"; 1386 } else { 1387 $httpdConfig = "$testDirectory/http/conf/httpd.conf"; 1388 $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|; 1389 } 1390 my $documentRoot = "$testDirectory/http/tests"; 1391 my $jsTestResourcesDirectory = $testDirectory . "/fast/js/resources"; 1392 my $typesConfig = "$testDirectory/http/conf/mime.types"; 1353 my $absTestResultsDirectory = resolveAndMakeTestResultsDirectory(); 1393 1354 my $listen = "127.0.0.1:$httpdPort"; 1394 my $absTestResultsDirectory = resolveAndMakeTestResultsDirectory();1395 my $sslCertificate = "$testDirectory/http/conf/webkit-httpd.pem";1396 1397 1355 my @args = ( 1398 "-f", "$httpdConfig",1399 "-C", "DocumentRoot \"$documentRoot\"",1400 # Setup a link to where the js test templates are stored, use -c so that mod_alias will already be laoded.1401 "-c", "Alias /js-test-resources \"$jsTestResourcesDirectory\"",1402 "-C", "Listen $listen",1403 "-c", "TypesConfig \"$typesConfig\"",1404 1356 "-c", "CustomLog \"$absTestResultsDirectory/access_log.txt\" common", 1405 1357 "-c", "ErrorLog \"$absTestResultsDirectory/error_log.txt\"", 1406 # Apache wouldn't run CGIs with permissions==700 otherwise 1407 "-c", "User \"#$<\"" 1358 "-C", "Listen $listen" 1408 1359 ); 1409 1360 1410 # FIXME: Enable this on Windows once <rdar://problem/5345985> is fixed 1411 # The version of Apache we use with Cygwin does not support SSL 1412 push(@args, "-c", "SSLCertificateFile \"$sslCertificate\"") unless isCygwin(); 1413 1414 open2(\*HTTPDIN, \*HTTPDOUT, $httpdPath, @args); 1415 1416 my $retryCount = 20; 1417 while (system("/usr/bin/curl -q --silent --stderr - --output " . File::Spec->devnull() . " $listen") && $retryCount) { 1418 sleep 1; 1419 --$retryCount; 1420 } 1421 1422 die "Timed out waiting for httpd to start" unless $retryCount; 1423 1424 $isHttpdOpen = 1; 1425 } 1426 1427 sub closeHTTPD() 1428 { 1429 return if !$isHttpdOpen; 1430 1431 close HTTPDIN; 1432 close HTTPDOUT; 1433 1434 kill 15, `cat /tmp/WebKit/httpd.pid` if -f "/tmp/WebKit/httpd.pid"; 1435 1436 $isHttpdOpen = 0; 1361 my @defaultArgs = getDefaultConfigForTestDirectory($testDirectory); 1362 @args = (@defaultArgs, @args); 1363 1364 $isHttpdOpen = openHTTPD(@args); 1437 1365 } 1438 1366
Note: See TracChangeset
for help on using the changeset viewer.