Skip to content
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
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in zstd_ruby.gemspec
gemspec

gem 'ruby_memcheck', '~> 3.0' if RUBY_PLATFORM.include?('linux')
28 changes: 28 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,34 @@ end

task :default => [:clobber, :compile, :spec]

if RUBY_PLATFORM.include?('linux')
begin
require 'ruby_memcheck'
require 'ruby_memcheck/rspec/rake_task'

RubyMemcheck.config(
binary_name: 'zstdruby',
# Valgrind and YJIT interfere with each other, adding noise and slowdown,
# so keep YJIT disabled while running under Valgrind.
ruby: "#{FileUtils::RUBY} --disable-yjit"
)

namespace :spec do
task :check_valgrind do
unless system('command -v valgrind > /dev/null 2>&1')
abort("\nValgrind is required for `rake spec:valgrind` but was not found.\n" \
"Install it first (Linux only), e.g. `sudo apt-get install valgrind`.\n")
end
end

RubyMemcheck::RSpec::RakeTask.new(valgrind: [:check_valgrind, :compile])
end
rescue LoadError
# ruby_memcheck is an optional, Linux-only development dependency. If it is
# not installed just skip defining the task instead of breaking the Rakefile.
end
end

desc 'Sync zstd libs dirs to ext/zstdruby/libzstd'
task :zstd_update do
FileUtils.rm_r("ext/zstdruby/libzstd")
Expand Down