Skip to content
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

Add test:valgrind rake task and use it in CI #89

Merged
merged 4 commits into from
Oct 21, 2021
Merged
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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,14 @@ jobs:
ruby-version: 2.7
bundler-cache: true
- run: bundle exec rake

valgrind:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install -y valgrind
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: bundle exec rake test:valgrind
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ gemspec

gem "rubocop", "~> 1.22", require: false
gem "rubocop-shopify", "~> 2.3.0", require: false
gem "ruby_memcheck", require: false
18 changes: 16 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,24 @@ end
# ==========================================================

require "rake/testtask"
Rake::TestTask.new("test") do |t|
require "ruby_memcheck"

RubyMemcheck.config(
binary_name: "rotoscope",
skipped_ruby_functions: RubyMemcheck::Configuration::DEFAULT_SKIPPED_RUBY_FUNCTIONS + [
/\Arb_tracepoint_new\z/, # TODO: Fix this upstream ruby bug
],
)

test_config = lambda do |t|
t.test_files = FileList["test/*_test.rb"]
end
task(test: :build)

Rake::TestTask.new(test: :build, &test_config)

namespace :test do
RubyMemcheck::TestTask.new(valgrind: :build, &test_config)
end

task :rubocop do
require "rubocop/rake_task"
Expand Down
2 changes: 1 addition & 1 deletion dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:
ROTOSCOPE_COMPILE_ERROR: '1'

up:
- ruby: 2.5.3
- ruby: 2.7.4
- homebrew:
- clang-format
- bundler
Expand Down
2 changes: 2 additions & 0 deletions test/rotoscope_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

at_exit { GC.start } # to reduce false positives in the test:valgrind rake task

$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
$LOAD_PATH.unshift(File.expand_path("../", __FILE__))
require "rotoscope"
Expand Down