lib/grntest/tester.rb in grntest-1.2.9 vs lib/grntest/tester.rb in grntest-1.3.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2012-2016 Kouhei Sutou <kou@clear-code.com> +# Copyright (C) 2012-2018 Kouhei Sutou <kou@clear-code.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. @@ -228,10 +228,16 @@ "Enable debug information", "(#{tester.debug?})") do |debug| tester.debug = debug end + parser.on("--n-retries=N", Integer, + "Retry N times on failure", + "(#{tester.n_retries})") do |n| + tester.n_retries = n + end + parser.on("--version", "Show version and exit") do puts(VERSION) throw(tag, true) end @@ -279,10 +285,11 @@ attr_writer :suppress_omit_log attr_writer :suppress_backtrace attr_writer :debug attr_reader :test_patterns, :test_suite_patterns attr_reader :exclude_test_patterns, :exclude_test_suite_patterns + attr_accessor :n_retries def initialize @groonga = "groonga" @groonga_httpd = "groonga-httpd" @groonga_suggest_create_dataset = "groonga-suggest-create-dataset" unless command_exist?(@groonga_suggest_create_dataset) @@ -309,9 +316,10 @@ detect_suitable_diff initialize_debuggers initialize_memory_checkers @timeout = 5 @read_timeout = 3 + @n_retries = 0 end def run(*targets) succeeded = true return succeeded if targets.empty?