gcov 로 code의 coverage 를 측정할 경우 생성되는 *.gcda 와 *.gcno 파일이 가지고 있는 tag 정보가 서로 일치하지 않을 경우 아래와 같은 오류를 보게 됩니다.
"stamp mismatch with graph file"
이에, 강제로 두 tag 정보를 일치시키는 스크립트를 Ruby 로 작성해 보았습니다.
$:.unshift(File.dirname(__FILE__))
require 'find'
#-------------------------------------------------------------------------------
def modifyCovfiles(dir = Dir.pwd)
#Dir.glob("#{dir}/*").each do |subfiledir|
Find.find(dir) do |subfiledir|
if (File.directory? subfiledir) then
puts subfiledir + " <"
else
extn = File.extname subfiledir
if extn.eql? '.gcda' or extn.eql? '.gcno' then
puts subfiledir + " will be modified"
system "printf '\x64\x16\x64\x16' | dd of=#{subfiledir} bs=1 seek=8 count=4 conv=notrunc"
end
end
end
end
##===============================================================================
# Example how to use above functions
##===============================================================================
modifyCovfiles(".")