Title: [176449] trunk/Tools
Revision
176449
Author
[email protected]
Date
2014-11-21 08:44:26 -0800 (Fri, 21 Nov 2014)

Log Message

Remove http lock code from webkitperl
https://bugs.webkit.org/show_bug.cgi?id=138959

Reviewed by Alexey Proskuryakov.

* Scripts/webkitperl/httpd.pm:
(cleanUp):
(extractLockNumber): Deleted.
(getLockFiles): Deleted.
(getNextAvailableLockNumber): Deleted.
(getLockNumberForCurrentRunning): Deleted.
(waitForHTTPDLock): Deleted.
(scheduleHttpTesting): Deleted.
(getWaitTime): Deleted.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (176448 => 176449)


--- trunk/Tools/ChangeLog	2014-11-21 16:40:55 UTC (rev 176448)
+++ trunk/Tools/ChangeLog	2014-11-21 16:44:26 UTC (rev 176449)
@@ -1,3 +1,20 @@
+2014-11-21  Csaba Osztrogonác  <[email protected]>
+
+        Remove http lock code from webkitperl
+        https://bugs.webkit.org/show_bug.cgi?id=138959
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Scripts/webkitperl/httpd.pm:
+        (cleanUp):
+        (extractLockNumber): Deleted.
+        (getLockFiles): Deleted.
+        (getNextAvailableLockNumber): Deleted.
+        (getLockNumberForCurrentRunning): Deleted.
+        (waitForHTTPDLock): Deleted.
+        (scheduleHttpTesting): Deleted.
+        (getWaitTime): Deleted.
+
 2014-11-20  Hunseop Jeong  <[email protected]>
 
         [EFL] The option value of fixed layout is false in MiniBrowser

Modified: trunk/Tools/Scripts/webkitperl/httpd.pm (176448 => 176449)


--- trunk/Tools/Scripts/webkitperl/httpd.pm	2014-11-21 16:40:55 UTC (rev 176448)
+++ trunk/Tools/Scripts/webkitperl/httpd.pm	2014-11-21 16:44:26 UTC (rev 176449)
@@ -36,7 +36,6 @@
 use File::Path;
 use File::Spec;
 use File::Spec::Functions;
-use Fcntl ':flock';
 use IPC::Open2;
 
 use webkitdirs;
@@ -52,17 +51,12 @@
                      &getDefaultConfigForTestDirectory
                      &openHTTPD
                      &closeHTTPD
-                     &setShouldWaitForUserInterrupt
-                     &waitForHTTPDLock
-                     &getWaitTime);
+                     &setShouldWaitForUserInterrupt);
    %EXPORT_TAGS = ( );
    @EXPORT_OK   = ();
 }
 
 my $tmpDir = "/tmp";
-my $httpdLockPrefix = "WebKitHttpd.lock.";
-my $myLockFile;
-my $exclusiveLockFile = File::Spec->catfile($tmpDir, "WebKit.lock");
 my $httpdPidDir = File::Spec->catfile($tmpDir, "WebKit");
 my $httpdPidFile = File::Spec->catfile($httpdPidDir, "httpd.pid");
 my $httpdPid;
@@ -264,84 +258,4 @@
 sub cleanUp
 {
     rmdir $httpdPidDir;
-    unlink $exclusiveLockFile;
-    unlink $myLockFile if $myLockFile;
 }
-
-sub extractLockNumber
-{
-    my ($lockFile) = @_;
-    return -1 unless $lockFile;
-    return substr($lockFile, length($httpdLockPrefix));
-}
-
-sub getLockFiles
-{
-    opendir(TMPDIR, $tmpDir) or die "Could not open " . $tmpDir . ".";
-    my @lockFiles = grep {m/^$httpdLockPrefix\d+$/} readdir(TMPDIR);
-    @lockFiles = sort { extractLockNumber($a) <=> extractLockNumber($b) } @lockFiles;
-    closedir(TMPDIR);
-    return @lockFiles;
-}
-
-sub getNextAvailableLockNumber
-{
-    my @lockFiles = getLockFiles();
-    return 0 unless @lockFiles;
-    return extractLockNumber($lockFiles[-1]) + 1;
-}
-
-sub getLockNumberForCurrentRunning
-{
-    my @lockFiles = getLockFiles();
-    return 0 unless @lockFiles;
-    return extractLockNumber($lockFiles[0]);
-}
-
-sub waitForHTTPDLock
-{
-    $waitBeginTime = time;
-    scheduleHttpTesting();
-    # If we are the only one waiting for Apache just run the tests without any further checking
-    if (scalar getLockFiles() > 1) {
-        my $currentLockFile = File::Spec->catfile($tmpDir, "$httpdLockPrefix" . getLockNumberForCurrentRunning());
-        my $currentLockPid = <SCHEDULER_LOCK> if (-f $currentLockFile && open(SCHEDULER_LOCK, "<$currentLockFile"));
-        # Wait until we are allowed to run the http tests
-        while ($currentLockPid && $currentLockPid != $$) {
-            $currentLockFile = File::Spec->catfile($tmpDir, "$httpdLockPrefix" . getLockNumberForCurrentRunning());
-            if ($currentLockFile eq $myLockFile) {
-                $currentLockPid = <SCHEDULER_LOCK> if open(SCHEDULER_LOCK, "<$currentLockFile");
-                if ($currentLockPid != $$) {
-                    print STDERR "\nPID mismatch.\n";
-                    last;
-                }
-            } else {
-                sleep 1;
-            }
-        }
-    }
-    $waitEndTime = time;
-}
-
-sub scheduleHttpTesting
-{
-    # We need an exclusive lock file to avoid deadlocks and starvation and ensure that the scheduler lock numbers are sequential.
-    # The scheduler locks are used to schedule the running test sessions in first come first served order.
-    while (!(open(SEQUENTIAL_GUARD_LOCK, ">$exclusiveLockFile") && flock(SEQUENTIAL_GUARD_LOCK, LOCK_EX|LOCK_NB))) {}
-    $myLockFile = File::Spec->catfile($tmpDir, "$httpdLockPrefix" . getNextAvailableLockNumber());
-    open(SCHEDULER_LOCK, ">$myLockFile");
-    print SCHEDULER_LOCK "$$";
-    print SEQUENTIAL_GUARD_LOCK "$$";
-    close(SCHEDULER_LOCK);
-    close(SEQUENTIAL_GUARD_LOCK);
-    unlink $exclusiveLockFile;
-}
-
-sub getWaitTime
-{
-    my $waitTime = 0;
-    if ($waitBeginTime && $waitEndTime) {
-        $waitTime = $waitEndTime - $waitBeginTime;
-    }
-    return $waitTime;
-}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to