Title: [169241] trunk/Tools
Revision
169241
Author
[email protected]
Date
2014-05-22 20:27:36 -0700 (Thu, 22 May 2014)

Log Message

Eliminate n/total progress update from run-jsc-stress-tests output to file
https://bugs.webkit.org/show_bug.cgi?id=133191

Reviewed by Geoffrey Garen.

Changed progressMeter setting to be based on stdout being a tty instead of
stdin.  Unified the processing of output from the shell runner to match the
same processing as is used by the makefile runner.  As part of this, the 
shell runner script was simplified.  It now forwards the output of each
test_script just like the Makefile and doesn't provide its own progress.

* Scripts/jsc-stress-test-helpers/shell-runner.sh:
* Scripts/run-jsc-stress-tests:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (169240 => 169241)


--- trunk/Tools/ChangeLog	2014-05-23 03:16:33 UTC (rev 169240)
+++ trunk/Tools/ChangeLog	2014-05-23 03:27:36 UTC (rev 169241)
@@ -1,5 +1,21 @@
 2014-05-22  Michael Saboff  <[email protected]>
 
+        Eliminate n/total progress update from run-jsc-stress-tests output to file
+        https://bugs.webkit.org/show_bug.cgi?id=133191
+
+        Reviewed by Geoffrey Garen.
+
+        Changed progressMeter setting to be based on stdout being a tty instead of
+        stdin.  Unified the processing of output from the shell runner to match the
+        same processing as is used by the makefile runner.  As part of this, the 
+        shell runner script was simplified.  It now forwards the output of each
+        test_script just like the Makefile and doesn't provide its own progress.
+
+        * Scripts/jsc-stress-test-helpers/shell-runner.sh:
+        * Scripts/run-jsc-stress-tests:
+
+2014-05-22  Michael Saboff  <[email protected]>
+
         Add option to run-jsc-stress-tests to use installed jsc
         https://bugs.webkit.org/show_bug.cgi?id=133102
 

Modified: trunk/Tools/Scripts/jsc-stress-test-helpers/shell-runner.sh (169240 => 169241)


--- trunk/Tools/Scripts/jsc-stress-test-helpers/shell-runner.sh	2014-05-23 03:16:33 UTC (rev 169240)
+++ trunk/Tools/Scripts/jsc-stress-test-helpers/shell-runner.sh	2014-05-23 03:27:36 UTC (rev 169241)
@@ -31,15 +31,6 @@
     fi
 fi
 
-VERBOSE=0
-while getopts "v" OPTION
-do
-    case $OPTION in
-        v) VERBOSE=1
-            ;;
-    esac
-done
-
 indexFile=".index"
 testList=".all_tests.txt"
 tempFile=".temp.txt"
@@ -63,7 +54,6 @@
     rmdir ${lockDir}
 fi
 
-total=`wc -l < "${testList}" | sed 's/ //g'`
 for proc in `seq ${numProcs}`
 do
     (
@@ -73,14 +63,13 @@
             index=`cat ${indexFile}`
             index=$((index + 1))
             echo "${index}" > ${indexFile}
-            printf "\r ${index}/${total}"
 
             nextTest=`tail -n 1 ${testList}`
             sed '$d' < ${testList} > ${tempFile}
             mv ${tempFile} ${testList}
             unlock_test_list
 
-            [ $VERBOSE -eq 1 ] && sh ${nextTest} || sh ${nextTest} 1> /dev/null
+            sh ${nextTest}
 
             lock_test_list
         done

Modified: trunk/Tools/Scripts/run-jsc-stress-tests (169240 => 169241)


--- trunk/Tools/Scripts/run-jsc-stress-tests	2014-05-23 03:16:33 UTC (rev 169240)
+++ trunk/Tools/Scripts/run-jsc-stress-tests	2014-05-23 03:27:36 UTC (rev 169241)
@@ -180,7 +180,7 @@
     end
 end
 
-$progressMeter = ($verbosity == 0 and $stdin.tty?)
+$progressMeter = ($verbosity == 0 and $stdout.tty?)
 
 if $bundle
     $jscPath = $bundle + ".vm" + "_javascript_Core.framework" + "Resources" + "jsc"
@@ -1228,8 +1228,76 @@
     result
 end
 
+def runAndMonitorTestRunnerCommand(numberOfTests, *cmd)
+    unless $progressMeter
+        mysys(*cmd)
+    else
+       running = {}
+       didRun = {}
+       didFail = {}
+       blankLine = true
+       prevStringLength = 0
+       IO.popen(cmd, mode="r") {
+           | inp |
+           inp.each_line {
+               | line |
+               line.chomp!
+               if line =~ /^Running /
+                   running[$~.post_match] = true
+               elsif line =~ /^PASS: /
+                   didRun[$~.post_match] = true
+               elsif line =~ /^FAIL: /
+                   didRun[$~.post_match] = true
+                   didFail[$~.post_match] = true
+               else
+                   unless blankLine
+                       print("\r" + " " * prevStringLength + "\r")
+                   end
+                   puts line
+                   blankLine = true
+               end
+
+               def lpad(str, chars)
+                   str = str.to_s
+                   if str.length > chars
+                       str
+                   else
+                      "%#{chars}s"%(str)
+                   end
+               end
+
+               string  = ""
+               string += "\r#{lpad(didRun.size, numberOfTests.to_s.size)}/#{numberOfTests}"
+               unless didFail.empty?
+                   string += " (failed #{didFail.size})"
+               end
+               string += " "
+               (running.size - didRun.size).times {
+                   string += "."
+               }
+               if string.length < prevStringLength
+                   print string
+                   print(" " * (prevStringLength - string.length))
+               end
+               print string
+               prevStringLength = string.length
+               blankLine = false
+               $stdout.flush
+           }
+       }
+       puts
+       raise "Failed to run #{cmd}: #{$?.inspect}" unless $?.success?
+    end
+end
+
 def runShellTestRunner
     if $remote
+        numberOfTests = 0
+        Dir.chdir($runnerDir) {
+            # -1 for the runscript, and -2 for '..' and '.'
+            numberOfTests = Dir.entries(".").count - 3
+        }
+
         $remoteDirectory = JSON::parse(sshRead("cat ~/.bencher"))["tempPath"]
         mysys("scp", "-P", $remotePort.to_s, ($outputDir.dirname + "payload.tar.gz").to_s, "#{$remoteUser}@#{$remoteHost}:#{$remoteDirectory}")
         remoteScript = ""
@@ -1237,11 +1305,13 @@
         remoteScript += "rm -rf #{$outputDir.basename} && "
         remoteScript += "tar xzf payload.tar.gz && "
         remoteScript += "cd #{$outputDir.basename}/.runner && "
-        remoteScript += "DYLD_FRAMEWORK_PATH=$(cd #{$testingFrameworkPath.dirname}; pwd) sh runscript" 
-        system("ssh", "-p", $remotePort.to_s, "#{$remoteUser}@#{$remoteHost}", remoteScript)
+        remoteScript += "DYLD_FRAMEWORK_PATH=$(cd #{$testingFrameworkPath.dirname}; pwd) sh runscript"
+        runAndMonitorTestRunnerCommand(numberOfTests, "ssh", "-p", $remotePort.to_s, "#{$remoteUser}@#{$remoteHost}", remoteScript)
     else
         Dir.chdir($runnerDir) {
-            mysys("sh", "runscript")
+            # -1 for the runscript, and -2 for '..' and '.'
+            numberOfTests = Dir.entries(".").count - 3
+            runAndMonitorTestRunnerCommand(numberOfTests, "sh", "runscript")
         }
     end
 end
@@ -1251,66 +1321,7 @@
     Dir.chdir($runnerDir) {
         # -1 for the Makefile, and -2 for '..' and '.'
         numberOfTests = Dir.entries(".").count - 3
-        unless $progressMeter
-            mysys("make", "-j", $numProcessors.to_s, "-s", "-f", "Makefile")
-        else
-            cmd = "make -j #{$numProcessors} -s -f Makefile"
-            running = {}
-            didRun = {}
-            didFail = {}
-            blankLine = true
-            prevStringLength = 0
-            IO.popen(cmd, "r") {
-                | inp |
-                inp.each_line {
-                    | line |
-                    line.chomp!
-                    if line =~ /^Running /
-                        running[$~.post_match] = true
-                    elsif line =~ /^PASS: /
-                        didRun[$~.post_match] = true
-                    elsif line =~ /^FAIL: /
-                        didRun[$~.post_match] = true
-                        didFail[$~.post_match] = true
-                    else
-                        unless blankLine
-                            print("\r" + " " * prevStringLength + "\r")
-                        end
-                        puts line
-                        blankLine = true
-                    end
-                    
-                    def lpad(str, chars)
-                        str = str.to_s
-                        if str.length > chars
-                            str
-                        else
-                            "%#{chars}s"%(str)
-                        end
-                    end
-    
-                    string  = ""
-                    string += "\r#{lpad(didRun.size, numberOfTests.to_s.size)}/#{numberOfTests}"
-                    unless didFail.empty?
-                        string += " (failed #{didFail.size})"
-                    end
-                    string += " "
-                    (running.size - didRun.size).times {
-                        string += "."
-                    }
-                    if string.length < prevStringLength
-                        print string
-                        print(" " * (prevStringLength - string.length))
-                    end
-                    print string
-                    prevStringLength = string.length
-                    blankLine = false
-                    $stdout.flush
-                }
-            }
-            puts
-            raise "Failed to run #{cmd}: #{$?.inspect}" unless $?.success?
-        end
+        runAndMonitorTestRunnerCommand(numberOfTests, "make", "-j", $numProcessors.to_s, "-s", "-f", "Makefile")
     }
 end
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to