Title: [262696] trunk/Tools
Revision
262696
Author
ticaiol...@gmail.com
Date
2020-06-07 07:35:51 -0700 (Sun, 07 Jun 2020)

Log Message

Allow run-jsc-stress-tests still run if some of the remote hosts are not available
https://bugs.webkit.org/show_bug.cgi?id=201426

Reviewed by Saam Barati.

This patch allows run-jsc-stress-tests to keep on running if some of
the remote hosts are not available. To do this, we created a new
function `checkAndPrepareRemoteHosts` that is responsible to check the
connection and read/write permissions of given remote hosts list. It
filters out every unavailable remote host.
These checks and filter happen in the beginning of the script and is
excuted only once, in the beggining of the script. It means that if
some remote device becomes unavailable after the check and preparation
is done, the script execution will be interupted.

* Scripts/run-jsc-stress-tests:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (262695 => 262696)


--- trunk/Tools/ChangeLog	2020-06-07 09:55:32 UTC (rev 262695)
+++ trunk/Tools/ChangeLog	2020-06-07 14:35:51 UTC (rev 262696)
@@ -1,3 +1,22 @@
+2020-06-07  Caio Lima  <ticaiol...@gmail.com>
+
+        Allow run-jsc-stress-tests still run if some of the remote hosts are not available
+        https://bugs.webkit.org/show_bug.cgi?id=201426
+
+        Reviewed by Saam Barati.
+
+        This patch allows run-jsc-stress-tests to keep on running if some of
+        the remote hosts are not available. To do this, we created a new
+        function `checkAndPrepareRemoteHosts` that is responsible to check the
+        connection and read/write permissions of given remote hosts list. It
+        filters out every unavailable remote host.
+        These checks and filter happen in the beginning of the script and is
+        excuted only once, in the beggining of the script. It means that if
+        some remote device becomes unavailable after the check and preparation
+        is done, the script execution will be interupted.
+
+        * Scripts/run-jsc-stress-tests:
+
 2020-06-07  Philippe Normand  <pnorm...@igalia.com>
 
         Remove ENABLE_VIDEO_TRACK ifdef guards

Modified: trunk/Tools/Scripts/run-jsc-stress-tests (262695 => 262696)


--- trunk/Tools/Scripts/run-jsc-stress-tests	2020-06-07 09:55:32 UTC (rev 262695)
+++ trunk/Tools/Scripts/run-jsc-stress-tests	2020-06-07 14:35:51 UTC (rev 262696)
@@ -123,6 +123,49 @@
 $forceCollectContinuously = false
 $reportExecutionTime = false
 
+def sshRead(cmd, remoteIndex=0)
+    raise unless $remote
+
+    remoteHost = $remoteHosts[remoteIndex]
+
+    result = ""
+    IO.popen("ssh -o NoHostAuthenticationForLocalhost=yes -p #{remoteHost.port} #{remoteHost.user}@#{remoteHost.host} '#{cmd}'", "r") {
+      | inp |
+      inp.each_line {
+        | line |
+        result += line
+      }
+    }
+    raise "#{$?}" unless $?.success?
+    result
+end
+
+def checkAndPrepareRemoteHost(remoteIndex=0)
+    available = false
+    remoteHost = $remoteHosts[remoteIndex]
+
+    begin
+        remoteHost.remoteDirectory = JSON::parse(sshRead("cat ~/.bencher", remoteIndex))["tempPath"] unless remoteHost.remoteDirectory
+        mysys("ssh", "-o", "NoHostAuthenticationForLocalhost=yes", "-p", remoteHost.port.to_s, "#{remoteHost.user}@#{remoteHost.host}", "mkdir -p #{remoteHost.remoteDirectory}")
+        available = true
+    rescue
+        $stderr.puts "Host #{remoteHost.host}:#{remoteHost.port} is not available"
+    end
+    available
+end
+
+def checkAndPrepareRemoteHosts
+    availableHosts = []
+    $remoteHosts.each_with_index {
+        | host, remoteIndex |
+        if checkAndPrepareRemoteHost(remoteIndex)
+            availableHosts << host
+        end
+    }
+    raise "There is no remote host available" if availableHosts.empty?
+    $remoteHosts = availableHosts
+end
+
 def usage
     puts "run-jsc-stress-tests -j <shell path> <collections path> [<collections path> ...]"
     puts
@@ -296,6 +339,8 @@
             host
         }
     end
+
+    checkAndPrepareRemoteHosts if $remote
 end
 
 unless jscArg
@@ -1955,23 +2000,6 @@
     }
 end
 
-def sshRead(cmd, remoteIndex=0)
-    raise unless $remote
-
-    remoteHost = $remoteHosts[remoteIndex]
-
-    result = ""
-    IO.popen("ssh -o NoHostAuthenticationForLocalhost=yes -p #{remoteHost.port} #{remoteHost.user}@#{remoteHost.host} '#{cmd}'", "r") {
-      | inp |
-      inp.each_line {
-        | line |
-        result += line
-      }
-    }
-    raise "#{$?}" unless $?.success?
-    result
-end
-
 def runCommandOnTester(cmd)
     if $remote
         result = sshRead(cmd)
@@ -2076,12 +2104,8 @@
 end
 
 def runTestRunner(remoteIndex=0)
+    remoteHost = $remoteHosts[remoteIndex]
     if $remote
-        remoteHost = $remoteHosts[remoteIndex]
-        if !remoteHost.remoteDirectory
-            remoteHost.remoteDirectory = JSON::parse(sshRead("cat ~/.bencher", remoteIndex))["tempPath"]
-        end
-        mysys("ssh", "-o", "NoHostAuthenticationForLocalhost=yes", "-p", remoteHost.port.to_s, "#{remoteHost.user}@#{remoteHost.host}", "mkdir -p #{remoteHost.remoteDirectory}")
         mysys("scp", "-o", "NoHostAuthenticationForLocalhost=yes", "-P", remoteHost.port.to_s, ($outputDir.dirname + $tarFileName).to_s, "#{remoteHost.user}@#{remoteHost.host}:#{remoteHost.remoteDirectory}")
         remoteScript = "\""
         remoteScript += "cd #{remoteHost.remoteDirectory} && "
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to