Signed-off-by: Lin Jiaxin ljx.joe@qq.com --- lib/error_messages.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/lib/error_messages.rb b/lib/error_messages.rb index 7bf3aa8..3a74d29 100644 --- a/lib/error_messages.rb +++ b/lib/error_messages.rb @@ -3,10 +3,13 @@ # frozen_string_literal: true
require 'set' +require_relative "#{ENV['LKP_SRC']}/lib/common"
# usage: # foo = ErrorMessages.new(build-pkg) # build-pkg is a file that includes errors generated by make +# errorid_array = foo.obtain_error_messages_by_errorid(errorid) +# errorid_array includes all error_messages that error same as errorid # error_messages_hash = foo.obtain_error_messages # error_messages_hash.each { |k,v| puts k; puts; v.each {|m| puts m } } # output: @@ -37,6 +40,17 @@ class ErrorMessages return @error_messages end
+ def obtain_error_messages_by_errorid(errorid) + error_messages_by_errorid = [] + error_messages = obtain_error_messages + error_messages.each do | k, v | + if ("build-pkg." + build_pkg_error_id(k)) == errorid + error_messages_by_errorid << v + end + end + error_messages_by_errorid + end + private
def extract_error_message(line)