gcov2x 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/gcov2x +20 -11
- data/lib/project.rb +10 -3
- data/lib/version.rb +1 -1
- data/spec/gcov2x/project_spec.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 250132fce3ed7347f085dbe31b8f51eacb2a91d8
|
4
|
+
data.tar.gz: 73615a81b7a41d1a4b0ab09ac73f8153ef5ddb54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2168fcd1772a4a6cd9d58132480d231a9101214d6eb966008da33fdfaf69bb8e051b8d61416445929e4cfdfb311f41089f77f8bab41cd7a90496198e66460858
|
7
|
+
data.tar.gz: 58677468ee5076e3ccfa2b339db16c27c9ec7241918964481c3dd1de78dbd5f8a192f552cff654f8fc63399fdd8e16e90ddab8afabed86655ab87b920bf73a6c
|
data/bin/gcov2x
CHANGED
@@ -19,11 +19,17 @@ class CGOV_CLI
|
|
19
19
|
|
20
20
|
option :filter,
|
21
21
|
:long => "--filter FILTER",
|
22
|
-
:description => Util.opt_wrap("A regex
|
23
|
-
|
24
|
-
|
22
|
+
:description => Util.opt_wrap("A semicolon-separated list of regex filters which specify which files NOT to include in the conversion. Will filter on the actual filename (replacing any mangling done by llvm-cov using #'s) as well as the 'Source' meta attribute in the GCOV data.
|
23
|
+
Available presets:
|
24
|
+
:xcode - Xcode system headers
|
25
|
+
:linux - Linux system headers
|
25
26
|
"),
|
26
|
-
:proc => Proc.new { |f|
|
27
|
+
:proc => Proc.new { |f|
|
28
|
+
values = f.split(';')
|
29
|
+
values = values.map{|f| f.size > 0 and f[0] == ":" ? f[1..-1].to_sym : f }
|
30
|
+
values
|
31
|
+
},
|
32
|
+
:on => :tail
|
27
33
|
|
28
34
|
option :format,
|
29
35
|
:short => "-f FORMAT",
|
@@ -66,13 +72,16 @@ fail "Got no filename" unless filenames.is_a? Array and filenames.count > 0
|
|
66
72
|
|
67
73
|
proj = GCOV::Project.new
|
68
74
|
|
69
|
-
filter =
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
75
|
+
filter = []
|
76
|
+
cli.config[:filter].each do |f|
|
77
|
+
filter << case f
|
78
|
+
when :xcode then /Developer\/(Toolchains|Platforms)\/.*\/usr\/include\//
|
79
|
+
when :linux then /\/usr\/include\//
|
80
|
+
when nil then nil
|
81
|
+
else /#{f}/
|
82
|
+
end
|
83
|
+
end # f
|
84
|
+
|
76
85
|
filenames.each do |filename|
|
77
86
|
if File.directory? filename
|
78
87
|
proj.add_dir filename, :recursive => cli.config[:recursive], :filter => filter
|
data/lib/project.rb
CHANGED
@@ -67,9 +67,16 @@ module GCOV
|
|
67
67
|
else
|
68
68
|
filenames = Dir["#{path}/*.gcov"]
|
69
69
|
end
|
70
|
+
|
71
|
+
# legacy support
|
72
|
+
if !hash[:filter].nil? and ( hash[:filter].is_a? Regexp )
|
73
|
+
hash[:filter] = [ hash[:filter] ]
|
74
|
+
end
|
70
75
|
|
71
|
-
filenames.select{
|
72
|
-
|
76
|
+
filenames.select{ |filename|
|
77
|
+
hash[:filter].nil? or hash[:filter].empty? or hash[:filter].select{|f| f.match(GCOV::File.demangle(filename) ) }.empty?
|
78
|
+
}.map{|filename| GCOV::File.load filename }.each do |file|
|
79
|
+
if hash[:filter].nil? or hash[:filter].empty? or hash[:filter].select{|f| f.match(::Pathname.new(file.meta['Source']).cleanpath.to_s) }.empty?
|
73
80
|
self << file
|
74
81
|
end
|
75
82
|
end # files
|
@@ -80,7 +87,7 @@ module GCOV
|
|
80
87
|
add_files do
|
81
88
|
if hash[:filter].nil? or !hash[:filter].match(GCOV::File.demangle(path))
|
82
89
|
file = GCOV::File.load(path)
|
83
|
-
if hash[:filter].nil? or !hash[:filter].match( ::
|
90
|
+
if hash[:filter].nil? or !hash[:filter].match( ::Pathname.new(file.meta['Source']).cleanpath.to_s )
|
84
91
|
self << file
|
85
92
|
end # if
|
86
93
|
end # if
|
data/lib/version.rb
CHANGED
data/spec/gcov2x/project_spec.rb
CHANGED
@@ -78,6 +78,22 @@ describe GCOV::Project do
|
|
78
78
|
expect(project.files.map{|file|file.name}).to include( a_string_ending_with("test2.cpp.gcov") )
|
79
79
|
expect(project.files.map{|file|file.name}).to include( a_string_ending_with("test3.cpp.gcov") )
|
80
80
|
end
|
81
|
+
|
82
|
+
it "filters using given singular expression" do
|
83
|
+
project = GCOV::Project.new
|
84
|
+
project.add_dir(File.join(File.dirname(__FILE__),"data"), :recursive => true, :filter => /test2\.cpp/)
|
85
|
+
expect(project.files.count).to eq(3)
|
86
|
+
expect(project.files.map{|file|file.name}).not_to include( a_string_ending_with("test2.cpp.gcov") )
|
87
|
+
expect(project.files.map{|file|file.name}).to include( a_string_ending_with("test3.cpp.gcov") )
|
88
|
+
end
|
89
|
+
|
90
|
+
it "filters using given array of expressions" do
|
91
|
+
project = GCOV::Project.new
|
92
|
+
project.add_dir(File.join(File.dirname(__FILE__),"data"), :recursive => true, :filter => [/test2\.cpp/,/test3\.cpp/])
|
93
|
+
expect(project.files.count).to eq(2)
|
94
|
+
expect(project.files.map{|file|file.name}).not_to include( a_string_ending_with("test2.cpp.gcov") )
|
95
|
+
expect(project.files.map{|file|file.name}).not_to include( a_string_ending_with("test3.cpp.gcov") )
|
96
|
+
end
|
81
97
|
end
|
82
98
|
|
83
99
|
|