Skip to content

Introduce gcov #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,29 @@ language:

rvm:
- '2.0'
- '2.1'
- '2.2'
- '2.3.0'
- '2.3.1'

matrix:
fast_finish:
true

install: true

before_install:
- sudo apt-get update -qq
- sudo apt-get install ruby gcc ruby-dev rake make -y
- sudo apt-get install -y lcov

cache: bundler


before_script:
- bundle exec rake compile -- --enable-gcov

script:
- gem build numo-narray.gemspec
- gem install numo-narray-0.9.0.3.gem
- bundle exec rake spec
- bundle exec gem build numo-narray.gemspec
- bundle exec gem install numo-narray-0.9.0.3.gem

after_success:
- cd ${TRAVIS_BUILD_DIR}
- lcov --directory tmp --capture --output-file coverage.info # capture coverage info
- lcov --remove coverage.info '*.h' --output-file coverage.info # remove *.h coverages
- lcov --list coverage.info # debug before upload
- bundle exec coveralls-lcov --repo-token ${COVERALLS_TOKEN} coverage.info # uploads to coveralls
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ begin
require "rake/extensiontask"
require "rake_compiler_dock"
require "shellwords"
require "rspec/core/rake_task"


spec = Bundler::GemHelper.gemspec

Expand All @@ -12,6 +14,9 @@ Rake::ExtensionTask.new("numo/narray", spec) do |ext|
ext.cross_platform = cross_platforms
end

RSpec::Core::RakeTask.new("spec")
Rake::Task[:spec].prerequisites << :compile

pkg_dir = "pkg"
windows_gem_paths = cross_platforms.collect do |platform|
File.join(pkg_dir, "#{spec.full_name}-#{platform}.gem")
Expand Down
2 changes: 1 addition & 1 deletion ext/numo/narray/depend.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ DEPENDS = $(C_TMPL) $(DTYPE) <%= __dir__ %>/gen/*.rb

src : <%= type_c.join(" ") %>

CLEANOBJS = *.o */*.o *.bak types/*.c
CLEANOBJS = *.o */*.o *.bak types/*.c *.gcno *.gcda *.gcov types/*.gcno types/*.gcda types/*.gcov
5 changes: 5 additions & 0 deletions ext/numo/narray/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
$INSTALLFILES << ['libnarray.a', '$(archdir)']
end

if enable_config("gcov")
$CFLAGS += " -coverage"
$LDFLAGS += " -coverage"
end

srcs = %w(
narray
array
Expand Down
1 change: 1 addition & 0 deletions numo-narray.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rspec", "~> 3"
spec.add_development_dependency "rake-compiler", ">= 1.0.1"
spec.add_development_dependency "rake-compiler-dock"
spec.add_development_dependency "coveralls-lcov"
end
2 changes: 1 addition & 1 deletion spec/bit_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), "../ext/numo/narray/narray")
require_relative '../lib/numo/narray.so'
#Numo::NArray.debug = true

RSpec.configure do |config|
Expand Down
2 changes: 1 addition & 1 deletion spec/narray_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.join(File.dirname(__FILE__), "../ext/numo/narray/narray")
require_relative "../lib/numo/narray.so"
#Numo::NArray.debug = true

RSpec.configure do |config|
Expand Down