[Groonga-commit] groonga/grntest at 717c91f [master] Add --stop-on-failure

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Mar 12 12:29:55 JST 2015


Kouhei Sutou	2015-03-12 12:29:55 +0900 (Thu, 12 Mar 2015)

  New Revision: 717c91f88fc96e354885650343d17dc4a28f1607
  https://github.com/groonga/grntest/commit/717c91f88fc96e354885650343d17dc4a28f1607

  Message:
    Add --stop-on-failure
    
    It's useful to start debug a failure.

  Modified files:
    lib/grntest/test-suites-runner.rb
    lib/grntest/tester.rb
    lib/grntest/worker.rb

  Modified: lib/grntest/test-suites-runner.rb (+7 -0)
===================================================================
--- lib/grntest/test-suites-runner.rb    2015-03-12 12:26:05 +0900 (d843f8e)
+++ lib/grntest/test-suites-runner.rb    2015-03-12 12:29:55 +0900 (1ddc896)
@@ -64,6 +64,13 @@ module Grntest
       collect_count(:n_not_checked_tests)
     end
 
+    def have_failure?
+      @workers.any? do |worker|
+        worker.result.n_failed_tests > 0 or
+          worker.result.n_leaked_tests > 0
+      end
+    end
+
     private
     def collect_count(item)
       counts =****@worke***** do |worker|

  Modified: lib/grntest/tester.rb (+12 -0)
===================================================================
--- lib/grntest/tester.rb    2015-03-12 12:26:05 +0900 (e7fcb7c)
+++ lib/grntest/tester.rb    2015-03-12 12:29:55 +0900 (a7f8c3e)
@@ -182,6 +182,12 @@ module Grntest
           tester.keep_database = boolean
         end
 
+        parser.on("--[no-]stop-on-failure",
+                  "Stop immediately on the first non success test",
+                  "(#{tester.stop_on_failure?})") do |boolean|
+          tester.stop_on_failure = boolean
+        end
+
         parser.on("--output=OUTPUT",
                   "Output to OUTPUT",
                   "(stdout)") do |output|
@@ -221,6 +227,7 @@ module Grntest
     attr_accessor :valgrind, :default_valgrind
     attr_writer :valgrind_gen_suppressions
     attr_writer :reporter, :keep_database, :use_color
+    attr_writer :stop_on_failure
     attr_reader :test_patterns, :test_suite_patterns
     attr_reader :exclude_test_patterns, :exclude_test_suite_patterns
     def initialize
@@ -237,6 +244,7 @@ module Grntest
       @output = $stdout
       @keep_database = false
       @use_color = nil
+      @stop_on_failure = false
       @test_patterns = []
       @test_suite_patterns = []
       @exclude_test_patterns = []
@@ -277,6 +285,10 @@ module Grntest
       @use_color
     end
 
+    def stop_on_failure?
+      @stop_on_failure
+    end
+
     def valgrind_gen_suppressions?
       @valgrind_gen_suppressions
     end

  Modified: lib/grntest/worker.rb (+3 -0)
===================================================================
--- lib/grntest/worker.rb    2015-03-12 12:26:05 +0900 (a33531d)
+++ lib/grntest/worker.rb    2015-03-12 12:29:55 +0900 (83ecc46)
@@ -107,6 +107,9 @@ module Grntest
             succeeded = false unless runner.run
 
             break if interruptted?
+            if****@teste*****_on_failure? and @test_suites_result.have_failure?
+              break
+            end
           end
           @status = "finished"
           @reporter.on_suite_finish(@suite_name) if @suite_name
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index