+4.对输出的error_id中含有的特殊字符进行处理。
- 定义白名单,除白名单以外的所有字符都替换为'-',
- 数字替换为'#'.
- 多个连续的'-',替换为单个.
上面的描述与下面的代码不匹配啊!
建议先仔细学习下 lkp-tests/lib/dmesg.rb 定义的 common_error_id()
- def common_error_id(line)
- line = line.chomp
- line.gsub!(/ /, '-')
- line.gsub!(/-+/, '-') # 对于多个连续的'-', 替换为单个
- line.gsub!(/\b-[a-z][0-9].[0-9].[0-9]+/, "#") # dgraph-linux-amd64-v0.8.2.tar.gz
- line.gsub!(/:/, '') # error.:-'__mysql_packages'-is-undefined: 1
- line.gsub!(/,/, '')
- line.gsub!(/'/, '') # Failed-to-download-metadata-for-repo-'dockerrepo: 1
- line.gsub!(/!/, '') # Distribution-openEuler-is-not-supported-by-this-role!: 1
- line.gsub!(/{%/, ' ')
- line.gsub!(/%}/, ' ')
- line
- end
-- 2.23.0