run-jsc-stress-tests should be less verbose
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Oct 2013 03:16:38 +0000 (03:16 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Oct 2013 03:16:38 +0000 (03:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122397

Reviewed by Sam Weinig.

It now just prints something like:

 965/1831 ....

Where the first number is the number of tests that completed, the second number is the
number of tests total, and the dots are the number of tests running right now - which is
useful towards the end when you're waiting for the last slow tests to finish.

It will also print out the output from failing tests and it will print a line for skipped
tests (to annoy you into getting them into a shape where they can be unskipped). For
example, for LayoutTests, it will print just the diff, if the test fails. It's cool.

* Scripts/run-jsc-stress-tests:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156983 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/run-jsc-stress-tests

index 5749a5e..40098b5 100644 (file)
@@ -1,5 +1,26 @@
 2013-10-05  Filip Pizlo  <fpizlo@apple.com>
 
+        run-jsc-stress-tests should be less verbose
+        https://bugs.webkit.org/show_bug.cgi?id=122397
+
+        Reviewed by Sam Weinig.
+        
+        It now just prints something like:
+        
+         965/1831 ....
+        
+        Where the first number is the number of tests that completed, the second number is the
+        number of tests total, and the dots are the number of tests running right now - which is
+        useful towards the end when you're waiting for the last slow tests to finish.
+        
+        It will also print out the output from failing tests and it will print a line for skipped
+        tests (to annoy you into getting them into a shape where they can be unskipped). For
+        example, for LayoutTests, it will print just the diff, if the test fails. It's cool.
+
+        * Scripts/run-jsc-stress-tests:
+
+2013-10-05  Filip Pizlo  <fpizlo@apple.com>
+
         Allow skipping of run-jsc-stress-tests that are configured using yaml files
         https://bugs.webkit.org/show_bug.cgi?id=122385
 
index 00b546e..e5bc31b 100755 (executable)
@@ -178,14 +178,14 @@ class Plan
             cmd  = "(" + shellCommand + " || (touch test_fail_#{@index})) 2>&1"
             cmd += " | tee " + Shellwords.shellescape(($outputDir + (@name + ".out")).to_s)
             cmd += " | awk " + Shellwords.shellescape("{ printf #{(@name + ': ').inspect}; print }")
-            if $verbosity >= 2
+            if $verbosity >= 3
                 outp.puts "echo #{Shellwords.shellescape(cmd)}"
             end
             outp.puts cmd
             outp.puts "if test -e test_fail_#{@index}"
             outp.puts "then"
             outp.puts "    echo FAIL: #{Shellwords.shellescape(@name)}"
-            if $verbosity >= 1
+            if $verbosity == 0 || $verbosity >= 2
                 outp.puts "else"
                 outp.puts "    echo PASS: #{Shellwords.shellescape(@name)}"
             end
@@ -538,7 +538,65 @@ if $parallel
     }
     
     Dir.chdir(parallelDir) {
-        mysys("make", "-j", numProcessors.to_s, "-s", "-f", "Makefile")
+        if $verbosity >= 1
+            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, $runlist.size.to_s.size)}/#{$runlist.size}"
+                    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
+                }
+            }
+            puts
+            raise "Failed to run #{cmd}: #{$?.inspect}" unless $?.success?
+        end
     }
     
     # Delete empty .out files to make life less confusing.