run gcov to produce .gcov files in a temporary directory
This commit is contained in:
parent
7a34aa2c65
commit
e61ec033a9
@ -1,12 +1,30 @@
|
||||
require_relative "gcovinator/version"
|
||||
require "tmpdir"
|
||||
|
||||
module Gcovinator
|
||||
|
||||
class << self
|
||||
|
||||
def run(build_dir, source_dirs, files, output_dir)
|
||||
build_dir = File.expand_path(build_dir)
|
||||
source_dirs = ["."] if source_dirs.empty?
|
||||
source_dirs = source_dirs.map do |s|
|
||||
File.expand_path(s)
|
||||
end
|
||||
files = Dir["#{build_dir}/**/*.gcda"] if files.empty?
|
||||
files = files.map do |f|
|
||||
File.expand_path(f)
|
||||
end
|
||||
output_dir = File.expand_path(output_dir)
|
||||
Dir.mktmpdir do |dir|
|
||||
Dir.chdir(dir) do
|
||||
files.each do |f|
|
||||
IO.popen(["gcov", "-bmi", f]) do |io|
|
||||
io.read
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ module Gcovinator
|
||||
|
||||
end.parse!(argv)
|
||||
|
||||
Gcovinator.run(build_dir, source_dirs, argv)
|
||||
Gcovinator.run(build_dir, source_dirs, argv, output_dir)
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user