slather 2.4.4 → 2.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -12
- data/CHANGELOG.md +16 -1
- data/README.md +6 -0
- data/lib/slather/command/coverage_command.rb +6 -0
- data/lib/slather/coverage_service/simple_output.rb +1 -0
- data/lib/slather/project.rb +25 -1
- data/lib/slather/version.rb +1 -1
- data/slather.gemspec +2 -3
- data/spec/slather/coverage_service/simple_output_spec.rb +2 -0
- data/spec/slather/project_spec.rb +12 -4
- metadata +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 10b576bd7bfd395102e3d01454d5f74fdccb560d58b629b5ce88ac7ebcf1aacc
|
4
|
+
data.tar.gz: 21c39f7fe553b008f08f882c7192721b6c0574ec728c7e9d7e6343ab6e0b80a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e8838d258c9570193e9a3d161da02a6ff03f8797c2e85aa3a88c9ff3393d35724da8b66c7a332db543dabec1dd381a6c85821b44e91b4c1796e8c133aed5467
|
7
|
+
data.tar.gz: 96b08ba6c91367fe39efba771caa07cad57208ce8cdb6cce11aa60229a864ca044c4978c9d1d58f3779247476440777898c57acd2bf8b1f31ffddb0bf37d1948
|
data/.travis.yml
CHANGED
@@ -1,20 +1,10 @@
|
|
1
1
|
language: objective-c
|
2
2
|
script: bundle exec rake
|
3
|
-
osx_image:
|
4
|
-
|
5
|
-
# Sets Travis to run the Ruby specs on OS X machines which are required to
|
6
|
-
# build the native extensions of Xcodeproj.
|
7
|
-
|
8
|
-
env:
|
9
|
-
- RVM_RUBY_VERSION=system
|
3
|
+
osx_image: xcode9.2
|
10
4
|
|
11
5
|
before_install:
|
12
6
|
- curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
|
13
|
-
-
|
14
|
-
- if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi
|
15
|
-
- rvm use $RVM_RUBY_VERSION
|
16
|
-
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future; fi
|
17
|
-
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem install bundler --no-ri --no-rdoc; else gem install bundler --no-ri --no-rdoc; fi
|
7
|
+
- gem install bundler --no-ri --no-rdoc
|
18
8
|
|
19
9
|
install:
|
20
10
|
- bundle install --without=documentation
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,24 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v2.4.5
|
4
|
+
|
5
|
+
* Support for specifying a specific binary architecture
|
6
|
+
[ksuther](https://github.com/ksuther), [nickolas-pohilets](https://github.com/nickolas-pohilets)
|
7
|
+
[#367](https://github.com/SlatherOrg/slather/pull/367)
|
8
|
+
|
9
|
+
* Added absolute statement count to simple output (instead of showing just a percentage)
|
10
|
+
[barrault01](https://github.com/barrault01), [ivanbrunel](https://github.com/ivanbruel)
|
11
|
+
[#365](https://github.com/SlatherOrg/slather/pull/365)
|
12
|
+
|
13
|
+
* Updated nokogiri dependency version
|
14
|
+
[#363](https://github.com/SlatherOrg/slather/issues/363), [#366](https://github.com/SlatherOrg/slather/pull/366)
|
15
|
+
|
16
|
+
* slather now requires ruby 2.1 or later (10.13 ships with 2.3.3)
|
17
|
+
|
3
18
|
## v2.4.4
|
4
19
|
|
5
20
|
* Added llvm-cov output format
|
6
|
-
[
|
21
|
+
[sgtsquiggs](https://github.com/sgtsquiggs) [#354](https://github.com/SlatherOrg/slather/pull/354)
|
7
22
|
|
8
23
|
* Exclude swiftmodule from product search
|
9
24
|
[lampietti](https://github.com/lampietti) [#352](https://github.com/SlatherOrg/slather/pull/352)
|
data/README.md
CHANGED
@@ -61,6 +61,12 @@ If you use a different configuration for your tests:
|
|
61
61
|
$ slather coverage -s --scheme YourXcodeSchemeName --configuration YourBuildConfigurationName path/to/project.xcodeproj
|
62
62
|
```
|
63
63
|
|
64
|
+
If your configuration produces a universal binary you need to specify a specific architecture to use:
|
65
|
+
|
66
|
+
```sh
|
67
|
+
$ slather coverage -s --arch x86_64 --scheme YourXcodeSchemeName --configuration YourBuildConfigurationName path/to/project.xcodeproj
|
68
|
+
```
|
69
|
+
|
64
70
|
### Setup for Xcode 5 and 6
|
65
71
|
|
66
72
|
Run this command to enable the `Generate Test Coverage` and `Instrument Program Flow` flags for your project:
|
@@ -30,6 +30,7 @@ class CoverageCommand < Clamp::Command
|
|
30
30
|
option ["--workspace"], "WORKSPACE", "The workspace that the project was built in"
|
31
31
|
option ["--binary-file"], "BINARY_FILE", "The binary file against the which the coverage will be run", :multivalued => true
|
32
32
|
option ["--binary-basename"], "BINARY_BASENAME", "Basename of the file against which the coverage will be run", :multivalued => true
|
33
|
+
option ["--arch"], "ARCH", "Architecture to use from universal binaries"
|
33
34
|
option ["--source-files"], "SOURCE_FILES", "A Dir.glob compatible pattern used to limit the lookup to specific source files. Ignored in gcov mode.", :multivalued => true
|
34
35
|
option ["--decimals"], "DECIMALS", "The amount of decimals to use for % coverage reporting"
|
35
36
|
|
@@ -49,6 +50,7 @@ class CoverageCommand < Clamp::Command
|
|
49
50
|
setup_workspace
|
50
51
|
setup_binary_file
|
51
52
|
setup_binary_basename
|
53
|
+
setup_arch
|
52
54
|
setup_source_files
|
53
55
|
setup_decimals
|
54
56
|
|
@@ -153,6 +155,10 @@ class CoverageCommand < Clamp::Command
|
|
153
155
|
project.binary_basename = binary_basename_list if !binary_basename_list.empty?
|
154
156
|
end
|
155
157
|
|
158
|
+
def setup_arch
|
159
|
+
project.arch = arch
|
160
|
+
end
|
161
|
+
|
156
162
|
def setup_source_files
|
157
163
|
project.source_files = source_files_list if !source_files_list.empty?
|
158
164
|
end
|
data/lib/slather/project.rb
CHANGED
@@ -44,7 +44,7 @@ module Slather
|
|
44
44
|
class Project < Xcodeproj::Project
|
45
45
|
|
46
46
|
attr_accessor :build_directory, :ignore_list, :ci_service, :coverage_service, :coverage_access_token, :source_directory,
|
47
|
-
:output_directory, :xcodeproj, :show_html, :verbose_mode, :input_format, :scheme, :workspace, :binary_file, :binary_basename, :source_files,
|
47
|
+
:output_directory, :xcodeproj, :show_html, :verbose_mode, :input_format, :scheme, :workspace, :binary_file, :binary_basename, :arch, :source_files,
|
48
48
|
:decimals, :llvm_version, :configuration
|
49
49
|
|
50
50
|
alias_method :setup_for_coverage, :slather_setup_for_coverage
|
@@ -212,6 +212,9 @@ module Slather
|
|
212
212
|
end
|
213
213
|
|
214
214
|
llvm_cov_args = %W(show -instr-profile #{profdata_file_arg} #{binary_path})
|
215
|
+
if self.arch
|
216
|
+
llvm_cov_args << "--arch" << self.arch
|
217
|
+
end
|
215
218
|
`xcrun llvm-cov #{llvm_cov_args.shelljoin} #{source_files.shelljoin}`
|
216
219
|
end
|
217
220
|
private :unsafe_profdata_llvm_cov_output
|
@@ -248,6 +251,7 @@ module Slather
|
|
248
251
|
configure_source_directory
|
249
252
|
configure_output_directory
|
250
253
|
configure_input_format
|
254
|
+
configure_arch
|
251
255
|
configure_binary_file
|
252
256
|
configure_decimals
|
253
257
|
|
@@ -370,6 +374,10 @@ module Slather
|
|
370
374
|
end
|
371
375
|
end
|
372
376
|
|
377
|
+
def configure_arch
|
378
|
+
self.arch ||= self.class.yml["arch"] if self.class.yml["arch"]
|
379
|
+
end
|
380
|
+
|
373
381
|
def decimal_f decimal_arg
|
374
382
|
configure_decimals unless decimals
|
375
383
|
decimal = "%.#{decimals}f" % decimal_arg
|
@@ -438,6 +446,12 @@ module Slather
|
|
438
446
|
}.reject { |path|
|
439
447
|
path.end_with? ".dSYM"
|
440
448
|
path.end_with? ".swiftmodule"
|
449
|
+
|
450
|
+
if path and File.directory? path
|
451
|
+
path = find_binary_file_in_bundle(path)
|
452
|
+
end
|
453
|
+
|
454
|
+
!matches_arch(path)
|
441
455
|
}.first
|
442
456
|
|
443
457
|
if found_product and File.directory? found_product
|
@@ -517,6 +531,16 @@ module Slather
|
|
517
531
|
found_buildable_names.uniq
|
518
532
|
end
|
519
533
|
|
534
|
+
def matches_arch(binary_path)
|
535
|
+
if self.arch
|
536
|
+
lipo_output = `lipo -info "#{binary_path}"`
|
537
|
+
archs_in_binary = lipo_output.split(':').last.split(' ')
|
538
|
+
archs_in_binary.include? self.arch
|
539
|
+
else
|
540
|
+
true
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
520
544
|
def find_source_files
|
521
545
|
source_files = load_option_array("source_files")
|
522
546
|
return if source_files.nil?
|
data/lib/slather/version.rb
CHANGED
data/slather.gemspec
CHANGED
@@ -29,9 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_dependency 'clamp', '~> 0.6'
|
31
31
|
spec.add_dependency 'xcodeproj', '~> 1.4'
|
32
|
-
spec.add_dependency 'nokogiri', '
|
32
|
+
spec.add_dependency 'nokogiri', '~> 1.8.2'
|
33
33
|
spec.add_dependency 'CFPropertyList', '~> 2.2'
|
34
34
|
|
35
|
-
|
36
|
-
spec.add_runtime_dependency 'activesupport', '>= 4.0.2', '< 5'
|
35
|
+
spec.add_runtime_dependency 'activesupport', '>= 4.0.2'
|
37
36
|
end
|
@@ -25,6 +25,7 @@ describe Slather::CoverageService::SimpleOutput do
|
|
25
25
|
"spec/fixtures/fixturesTests/fixturesTests.m: 17 of 17 lines (100.00%)",
|
26
26
|
"spec/fixtures/fixturesTests/peekaviewTests💣.m: 11 of 11 lines (100.00%)",
|
27
27
|
"spec/fixtures/fixturesTwo/fixturesTwo.m: 6 of 6 lines (100.00%)",
|
28
|
+
"Tested 66/86 statements",
|
28
29
|
"Test Coverage: 76.74%"
|
29
30
|
].each do |line|
|
30
31
|
expect(fixtures_project).to receive(:puts).with(line)
|
@@ -47,6 +48,7 @@ describe Slather::CoverageService::SimpleOutput do
|
|
47
48
|
"spec/fixtures/fixturesTwo/fixturesTwo.m: 6 of 6 lines (100.00%)",
|
48
49
|
"##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='66']",
|
49
50
|
"##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='86']",
|
51
|
+
"Tested 66/86 statements",
|
50
52
|
"Test Coverage: 76.74%"
|
51
53
|
].each do |line|
|
52
54
|
expect(fixtures_project).to receive(:puts).with(line)
|
@@ -163,12 +163,19 @@ describe Slather::Project do
|
|
163
163
|
|
164
164
|
it "should find the product path for a scheme with no buildable products" do
|
165
165
|
allow(fixtures_project).to receive(:scheme).and_return("fixturesTests")
|
166
|
+
allow(fixtures_project).to receive(:arch).and_return("x86_64")
|
166
167
|
fixtures_project.send(:configure_binary_file)
|
167
168
|
binary_file_location = fixtures_project.send(:binary_file)
|
168
169
|
expect(binary_file_location.count).to eq(1)
|
169
170
|
expect(binary_file_location.first).to end_with("Debug/fixturesTests.xctest/Contents/MacOS/fixturesTests")
|
170
171
|
end
|
171
172
|
|
173
|
+
it "should not find a product path for an invalid architecture" do
|
174
|
+
allow(fixtures_project).to receive(:scheme).and_return("fixturesTests")
|
175
|
+
allow(fixtures_project).to receive(:arch).and_return("arm64")
|
176
|
+
expect { fixtures_project.send(:configure_binary_file) }.to raise_error.with_message(/No product binary found in (.+)./)
|
177
|
+
end
|
178
|
+
|
172
179
|
it "should find multiple unique paths for a scheme with serveral buildable/testable products" do
|
173
180
|
allow(fixtures_project).to receive(:scheme).and_return("aggregateFixturesTests")
|
174
181
|
fixtures_project.send(:configure_binary_file)
|
@@ -509,9 +516,9 @@ describe Slather::Project do
|
|
509
516
|
it "should print out environment info when in verbose_mode" do
|
510
517
|
project_root = Pathname("./").realpath
|
511
518
|
|
512
|
-
[
|
519
|
+
[/\nProcessing coverage file: #{project_root}\/spec\/DerivedData\/libfixtures\/Build\/ProfileData\/[A-Z0-9-]+\/Coverage.profdata/,
|
513
520
|
"Against binary files:",
|
514
|
-
"\t#{project_root}/spec/DerivedData/libfixtures/Build/
|
521
|
+
"\t#{project_root}/spec/DerivedData/libfixtures/Build/Products/Debug/fixturesTests.xctest/Contents/MacOS/fixturesTests",
|
515
522
|
"\n"
|
516
523
|
].each do |line|
|
517
524
|
expect(fixtures_project).to receive(:puts).with(line)
|
@@ -525,7 +532,7 @@ describe Slather::Project do
|
|
525
532
|
|
526
533
|
project_root = Pathname("./").realpath
|
527
534
|
|
528
|
-
[
|
535
|
+
[/\nProcessing coverage file: #{project_root}\/spec\/DerivedData\/libfixtures\/Build\/ProfileData\/[A-Z0-9-]+\/Coverage.profdata/,
|
529
536
|
"No binary files found.",
|
530
537
|
"\n",
|
531
538
|
].each do |line|
|
@@ -558,6 +565,7 @@ describe Slather::Project do
|
|
558
565
|
it "should print out the coverage for each file, and then total coverage" do
|
559
566
|
["spec/fixtures/fixtures/fixtures.m: 3 of 6 lines (50.00%)",
|
560
567
|
"spec/fixtures/fixturesTwo/fixturesTwo.m: 6 of 6 lines (100.00%)",
|
568
|
+
"Tested 9/12 statements",
|
561
569
|
"Test Coverage: 75.00%"
|
562
570
|
].each do |line|
|
563
571
|
expect(fixtures_project).to receive(:puts).with(line)
|
@@ -587,7 +595,7 @@ describe Slather::Project do
|
|
587
595
|
let(:configuration) { 'Debug' }
|
588
596
|
let(:project_root) { Pathname("./").realpath }
|
589
597
|
let(:coverage_dir) { "#{project_root}/spec/DerivedData/DerivedData/Build/Intermediates/CodeCoverage" }
|
590
|
-
let(:search_dir) { "#{coverage_dir}
|
598
|
+
let(:search_dir) { "#{coverage_dir}/../../Products/#{configuration}*/fixtures*" }
|
591
599
|
let(:binary_file) { "#{coverage_dir}/Products/#{configuration}-iphonesimulator/fixtures.app/fixtures" }
|
592
600
|
|
593
601
|
before do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Larsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -168,22 +168,16 @@ dependencies:
|
|
168
168
|
name: nokogiri
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '1.6'
|
174
|
-
- - "<"
|
171
|
+
- - "~>"
|
175
172
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
173
|
+
version: 1.8.2
|
177
174
|
type: :runtime
|
178
175
|
prerelease: false
|
179
176
|
version_requirements: !ruby/object:Gem::Requirement
|
180
177
|
requirements:
|
181
|
-
- - "
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: '1.6'
|
184
|
-
- - "<"
|
178
|
+
- - "~>"
|
185
179
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
180
|
+
version: 1.8.2
|
187
181
|
- !ruby/object:Gem::Dependency
|
188
182
|
name: CFPropertyList
|
189
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,9 +199,6 @@ dependencies:
|
|
205
199
|
- - ">="
|
206
200
|
- !ruby/object:Gem::Version
|
207
201
|
version: 4.0.2
|
208
|
-
- - "<"
|
209
|
-
- !ruby/object:Gem::Version
|
210
|
-
version: '5'
|
211
202
|
type: :runtime
|
212
203
|
prerelease: false
|
213
204
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -215,9 +206,6 @@ dependencies:
|
|
215
206
|
- - ">="
|
216
207
|
- !ruby/object:Gem::Version
|
217
208
|
version: 4.0.2
|
218
|
-
- - "<"
|
219
|
-
- !ruby/object:Gem::Version
|
220
|
-
version: '5'
|
221
209
|
description:
|
222
210
|
email:
|
223
211
|
- mark@venmo.com
|
@@ -338,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
338
326
|
version: '0'
|
339
327
|
requirements: []
|
340
328
|
rubyforge_project:
|
341
|
-
rubygems_version: 2.
|
329
|
+
rubygems_version: 2.7.3
|
342
330
|
signing_key:
|
343
331
|
specification_version: 4
|
344
332
|
summary: Test coverage reports for Xcode projects
|