gcov2x 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58d688ca8f1b4d87a11eefe33917c15c194db646
4
- data.tar.gz: 23ceb0bd68c3f8bd06fcf993d40e2d4c67e35f09
3
+ metadata.gz: bc193fe4a3be29c0863a092df1ada25ab1ffb660
4
+ data.tar.gz: 5608d02ef2b141296b09cf08de5b7bc76473d8f4
5
5
  SHA512:
6
- metadata.gz: c88533951e3585ab3ff227086576bcbdb5ec0c92f0a6e3635143bf206a4a63f6d251f765c52b99f261511c28f3ad1b87614025396b35cc12c82e0162b311893f
7
- data.tar.gz: 98dd31b4a441f6b2c37a92ef71fa9c5b54da9aec7e8dbe0532491edf403e8333de8ab4b27c9dc556d6876226c73c8401a9f543c63ff183a3da4d3ba0091a8fb3
6
+ metadata.gz: bb6c7cf682665c724e8d1dfd273990dbd14e7a3fc9b296f56bd8e644cece9363f6e7d694b9314f14b6bd2961ae9014f1e43e2cbc2d0cd69584cacc8890a123da
7
+ data.tar.gz: d2be48bb64447d436613d47ad06a3088e3a39a8b1633cbb7276d8ab78735e1f9852cc0f2512ce481d26d9b27bf25ab802d00aab3e49e4f70a54fc69308dfcbc3
data/bin/gcov2x CHANGED
@@ -7,6 +7,7 @@ require_relative '../lib/ansii_formatter'
7
7
  require_relative '../lib/xml_formatter'
8
8
  require_relative '../lib/html_formatter'
9
9
  require_relative '../lib/json_formatter'
10
+ require_relative '../lib/version'
10
11
 
11
12
  class Util
12
13
  def Util.opt_wrap(s, width=61)
@@ -17,6 +18,10 @@ end
17
18
  class CGOV_CLI
18
19
  include Mixlib::CLI
19
20
 
21
+ banner "gcov2x v#{GCOV::VERSION}
22
+
23
+ Usage:"
24
+
20
25
  option :filter,
21
26
  :long => "--filter FILTER",
22
27
  :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.
data/lib/file.rb CHANGED
@@ -104,8 +104,10 @@ module GCOV
104
104
  file._add_line line
105
105
  end # each line
106
106
  end# file_handle
107
- file._update_stats
108
- files << file
107
+ if file
108
+ file._update_stats
109
+ files << file
110
+ end # if file
109
111
  files
110
112
  end
111
113
 
data/lib/project.rb CHANGED
@@ -81,28 +81,24 @@ module GCOV
81
81
  hash[:filter] = [ hash[:filter] ]
82
82
  end
83
83
 
84
- filenames.select{ |filename|
85
- hash[:filter].nil? or hash[:filter].empty? or hash[:filter].select{|f| f.match(GCOV::File.demangle(filename) ) }.empty?
86
- }.map{|filename| GCOV::File.load filename }.each do |files|
84
+ filenames.map{|filename| GCOV::File.load filename }.each do |files|
87
85
  files.each do |file|
88
86
  if hash[:filter].nil? or hash[:filter].empty? or hash[:filter].select{|f| f.match(::Pathname.new(file.meta['Source']).cleanpath.to_s) }.empty?
89
87
  self << file
90
88
  end # if
91
89
  end # each file
92
- end # each file(s)
93
- end
94
- end
90
+ end # each files
91
+ end # add_files
92
+ end # #add_dir
95
93
 
96
94
  def add_file path, hash={}
97
95
  add_files do
98
- if hash[:filter].nil? or !hash[:filter].match(GCOV::File.demangle(path))
99
- files = GCOV::File.load(path)
100
- files.each do |file|
101
- if hash[:filter].nil? or !hash[:filter].match( ::Pathname.new(file.meta['Source']).cleanpath.to_s )
102
- self << file
103
- end # if
104
- end
105
- end # if
96
+ files = GCOV::File.load(path)
97
+ files.each do |file|
98
+ if hash[:filter].nil? or hash[:filter].empty? or hash[:filter].select{|f| f.match(::Pathname.new(file.meta['Source']).cleanpath.to_s) }.empty?
99
+ self << file
100
+ end # if
101
+ end # each file
106
102
  end # add_files
107
103
  end # add_file
108
104
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module GCOV
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -58,7 +58,39 @@ describe GCOV::Project do
58
58
  it "adds the given file" do
59
59
  project = GCOV::Project.new
60
60
  project.add_file(File.join(File.dirname(__FILE__),"data","test2.cpp.gcov"))
61
- expect(project.files.map{|file|file.name}).to include( a_string_ending_with("test2.cpp") )
61
+ expect(project.files.count).to eq(1)
62
+ expect(project.files[0].name).to eq( "test2.cpp" )
63
+ end
64
+
65
+ it "should split concatenated gcov files into multiple objects" do
66
+ project = GCOV::Project.new
67
+ project.add_file(File.join(File.dirname(__FILE__),"concat","test_cat.cpp.gcov"))
68
+ expect(project.files.count).to eq(2)
69
+ expect(project.files.map(&:name)).to include( "test.cpp" )
70
+ expect(project.files.map(&:name)).to include( "test1.cpp" )
71
+ end
72
+
73
+
74
+ it "should filter using given array of expressions" do
75
+ project = GCOV::Project.new
76
+ project.add_file(File.join(File.dirname(__FILE__),"data","test2.cpp.gcov"), :filter => [/test2\.cpp/,/test3\.cpp/])
77
+ expect(project.files.count).to eq(0)
78
+ end
79
+
80
+ it "should filter out concatenated files that match the filter" do
81
+ project = GCOV::Project.new
82
+ project.add_file(File.join(File.dirname(__FILE__),"concat","test_cat.cpp.gcov"), :filter => [/test\.cpp$/])
83
+ expect(project.files.count).to eq(1)
84
+ expect(project.files.map(&:name)).not_to include( a_string_ending_with("test.cpp") )
85
+ expect(project.files.map(&:name)).to include( a_string_ending_with("test1.cpp") )
86
+ end
87
+
88
+ it "should not filter out concatenated files that don't match the filter" do
89
+ project = GCOV::Project.new
90
+ project.add_file(File.join(File.dirname(__FILE__),"concat","test_cat.cpp.gcov"), :filter => [/test_cat\.cpp\.gcov$/])
91
+ expect(project.files.count).to eq(2)
92
+ expect(project.files.map(&:name)).to include( a_string_ending_with("test.cpp") )
93
+ expect(project.files.map(&:name)).to include( a_string_ending_with("test1.cpp") )
62
94
  end
63
95
  end
64
96
 
@@ -94,6 +126,23 @@ describe GCOV::Project do
94
126
  expect(project.files.map{|file|file.name}).not_to include( a_string_ending_with("test2.cpp") )
95
127
  expect(project.files.map{|file|file.name}).not_to include( a_string_ending_with("test3.cpp") )
96
128
  end
129
+
130
+ it "should filter out concatenated files that match the filter" do
131
+ project = GCOV::Project.new
132
+ project.add_dir(File.join(File.dirname(__FILE__),"concat"), :recursive => true, :filter => [/test\.cpp$/])
133
+ expect(project.files.count).to eq(1)
134
+ expect(project.files.map(&:name)).not_to include( a_string_ending_with("test.cpp") )
135
+ expect(project.files.map(&:name)).to include( a_string_ending_with("test1.cpp") )
136
+ end
137
+
138
+ it "should not filter out concatenated files that don't match the filter" do
139
+ project = GCOV::Project.new
140
+ project.add_dir(File.join(File.dirname(__FILE__),"concat"), :recursive => true, :filter => [/test_cat\.cpp/])
141
+ expect(project.files.count).to eq(2)
142
+ expect(project.files.map(&:name)).to include( a_string_ending_with("test.cpp") )
143
+ expect(project.files.map(&:name)).to include( a_string_ending_with("test1.cpp") )
144
+ end
145
+
97
146
  end
98
147
 
99
148
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcov2x
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattias Bergbom
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  requirements: []
187
187
  rubyforge_project:
188
- rubygems_version: 2.4.2
188
+ rubygems_version: 2.2.0
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: gcov parser and formatter