Kouhei Sutou 2018-11-07 11:03:25 +0900 (Wed, 07 Nov 2018) Revision: ebf982930c71564d00a95048585b9f8dadbc4f04 https://github.com/groonga/groonga-query-log/commit/ebf982930c71564d00a95048585b9f8dadbc4f04 Merged a90ef28: Merge pull request #35 from komainu8/improve_stop_on_failure Message: Use more meaningful name Modified files: lib/groonga-query-log/server-verifier.rb Modified: lib/groonga-query-log/server-verifier.rb (+15 -12) =================================================================== --- lib/groonga-query-log/server-verifier.rb 2018-11-07 10:39:25 +0900 (433fd7a) +++ lib/groonga-query-log/server-verifier.rb 2018-11-07 11:03:25 +0900 (50486cd) @@ -39,7 +39,7 @@ module GroongaQueryLog producer.join @different_results.push(nil) reporter.join - different_or_error_results? + success? end private @@ -51,7 +51,7 @@ module GroongaQueryLog n_commands = 0 callback_per_n_commands = 100 parser.parse(input) do |statistic| - break if stop_parse? + break if stop? command = statistic.command next if command.nil? @@ -79,7 +79,7 @@ module GroongaQueryLog @options.n_clients.times.collect do Thread.new do loop do - break if run_consumer_stop? + break if run_consumer end end end @@ -91,6 +91,7 @@ module GroongaQueryLog loop do statistic =****@queue***** return true if statistic.nil? + return true if stop? original_source = statistic.command.original_source begin @@ -101,7 +102,7 @@ module GroongaQueryLog $stderr.puts(original_source) end @client_error_is_occurred = true - return false + retur****@optio*****_on_failure? end if****@optio*****_cache? begin @@ -112,7 +113,7 @@ module GroongaQueryLog $stderr.puts("status after #{original_source}") end @client_error_is_occurred = true - return false + retur****@optio*****_on_failure? end end end @@ -136,16 +137,18 @@ module GroongaQueryLog @options.target_command_name?(command.command_name) end - def different_or_error_results? - @same and !@client_error_is_occurred + def success? + return false unless @same + return false if @client_error_is_occurred + true end - def stop_parse? - (!@same or @client_error_is_occurred) and****@optio*****_on_failure? + def failed? + not success? end - def run_consumer_stop? - run_consumer or****@optio*****_on_failure? + def stop? + @options.stop_on_failure? and failed? end def verify_command(groonga1_client, groonga2_client, command) @@ -162,6 +165,7 @@ module GroongaQueryLog comparer = ResponseComparer.new(command, response1, response2, compare_options) unless comparer.same? + @same = false @different_results.push([command, response1, response2]) end end @@ -182,7 +186,6 @@ module GroongaQueryLog end def report_result(output, result) - @same = false command, response1, response2 = result command_source = command.original_source || command.to_uri_format output.puts("command: #{command_source}") -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181107/e43117db/attachment-0001.html>