Title: [262807] trunk/Tools
Revision
262807
Author
[email protected]
Date
2020-06-09 13:52:57 -0700 (Tue, 09 Jun 2020)

Log Message

Add a timeout monitor for JSC stress test
https://bugs.webkit.org/show_bug.cgi?id=211978

Reviewed by Jonathan Bedard.

* Scripts/webkitruby/jsc-stress-test-writer-default.rb: Add timeout monitor inside the jsc stress test runner, it will kill the process in case of jsc timeout handler not working

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (262806 => 262807)


--- trunk/Tools/ChangeLog	2020-06-09 20:44:14 UTC (rev 262806)
+++ trunk/Tools/ChangeLog	2020-06-09 20:52:57 UTC (rev 262807)
@@ -1,3 +1,12 @@
+2020-06-09  Zhifei Fang  <[email protected]>
+
+        Add a timeout monitor for JSC stress test
+        https://bugs.webkit.org/show_bug.cgi?id=211978
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/webkitruby/jsc-stress-test-writer-default.rb: Add timeout monitor inside the jsc stress test runner, it will kill the process in case of jsc timeout handler not working
+
 2020-06-09  Tim Horton  <[email protected]>
 
         WebKit.ShrinkToFit is failing on some bots

Modified: trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-default.rb (262806 => 262807)


--- trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-default.rb	2020-06-09 20:44:14 UTC (rev 262806)
+++ trunk/Tools/Scripts/webkitruby/jsc-stress-test-writer-default.rb	2020-06-09 20:52:57 UTC (rev 262807)
@@ -232,7 +232,40 @@
         end
         @additionalEnv = []
     end
-    
+
+    def timeoutMonitorAddon
+        # In case the JSC timeout handler is not working, add a timeout monitor in the script
+        interval = 30 # Seconds
+        timeout = ENV['JSCTEST_timeout'].to_i + 10 # Let jsc timeout handler trigger first
+        if !timeout
+            timeout = interval
+        end
+        if timeout < interval
+            interval = timeout
+        end
+        script = %Q[
+(
+    ((count_down = #{timeout}))
+    while ((count_down > 0)); do
+        if [ "$count_down" -gt #{interval} ]
+        then
+            sleep #{interval}
+        else
+            sleep count_down
+        fi
+        pgrep -P $$ 1>/dev/null || exit 0
+        ((count_down -= #{interval}))
+    done
+    echo "#{Shellwords.shellescape(@name)} has timed out, killing with timeout monitor"
+    kill -s SIGTERM $$
+    sleep 5 
+    pgrep -P 1>/dev/null $$ && kill -s SIGKILL $$
+    echo FAIL: #{Shellwords.shellescape(@name)} ; touch #{failFile} ;
+) &
+]
+        return script
+    end
+
     def shellCommand
         # It's important to remember that the test is actually run in a subshell, so if we change directory
         # in the subshell when we return we will be in our original directory. This is nice because we don't
@@ -288,7 +321,8 @@
                 outp.puts "START_TIME=$SECONDS"
             end
             outp.puts "echo Running #{Shellwords.shellescape(@name)}"
-            cmd  = "(" + shellCommand + " || (echo $? > #{failFile})) 2>&1 "
+            cmd = timeoutMonitorAddon
+            cmd += "(" + shellCommand + " || (echo $? > #{failFile})) 2>&1 "
             cmd += @outputHandler.call(@name)
             if $verbosity >= 3
                 outp.puts "echo #{Shellwords.shellescape(cmd)}"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to