Kouhei Sutou 2018-11-07 12:43:43 +0900 (Wed, 07 Nov 2018) Revision: 24610ca016220901d0952576a9a978f6058fb7c3 https://github.com/groonga/groonga-query-log/commit/24610ca016220901d0952576a9a978f6058fb7c3 Message: format-regression-test-logs: support error log Modified files: lib/groonga-query-log/command/format-regression-test-logs.rb lib/groonga-query-log/server-verifier.rb Modified: lib/groonga-query-log/command/format-regression-test-logs.rb (+16 -1) =================================================================== --- lib/groonga-query-log/command/format-regression-test-logs.rb 2018-11-07 12:35:45 +0900 (669b06b) +++ lib/groonga-query-log/command/format-regression-test-logs.rb 2018-11-07 12:43:43 +0900 (80815a2) @@ -1,4 +1,4 @@ -# Copyright (C) 2014-2017 Kouhei Sutou <kou****@clear*****> +# Copyright (C) 2014-2018 Kouhei Sutou <kou****@clear*****> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -63,6 +63,8 @@ module GroongaQueryLog command = nil response_old = nil response_new = nil + backtrace = [] + error_message = nil input.each_line do |line| unless line.valid_encoding? @@ -79,6 +81,12 @@ module GroongaQueryLog response_new = $POSTMATCH.chomp next unless valid_entry?(command, response_old, response_new) report_diff(command, response_old, response_new) + when /\Aerror: / + error_message = $POSTMATCH.chomp + report_error(command, error_message, backtrace) + backtrace.clear + when /\Abacktrace: / + backtrace.unshift($POSTMATCH.chomp) end end end @@ -126,6 +134,13 @@ module GroongaQueryLog end end + def report_error(command, message, backtrace) + report_command(command) + puts("Error: #{message}") + puts("Backtrace:") + puts(backtrace) + end + def report_command(command) puts(command) parsed_command = Groonga::Command::Parser.parse(command) Modified: lib/groonga-query-log/server-verifier.rb (+2 -2) =================================================================== --- lib/groonga-query-log/server-verifier.rb 2018-11-07 12:35:45 +0900 (bd1d4de) +++ lib/groonga-query-log/server-verifier.rb 2018-11-07 12:43:43 +0900 (089e0a7) @@ -204,10 +204,10 @@ module GroongaQueryLog def report_error(output, command, error) command_source = command.original_source || command.to_uri_format output.puts("command: #{command_source}") - output.puts("error: #{error.class}: #{error.message}") - error.backtrace.each do |trace| + error.backtrace.reverse_each do |trace| output.puts("backtrace: #{trace}") end + output.puts("error: #{error.class}: #{error.message}") output.flush end -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181107/41264fb2/attachment-0001.html>