File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,3 +2,5 @@ source 'https://rubygems.org'
22
33# Specify your gem's dependencies in zstd_ruby.gemspec
44gemspec
5+
6+ gem 'ruby_memcheck' , '~> 3.0' if RUBY_PLATFORM . include? ( 'linux' )
Original file line number Diff line number Diff line change 1515
1616task :default => [ :clobber , :compile , :spec ]
1717
18+ if RUBY_PLATFORM . include? ( 'linux' )
19+ begin
20+ require 'ruby_memcheck'
21+ require 'ruby_memcheck/rspec/rake_task'
22+
23+ RubyMemcheck . config (
24+ binary_name : 'zstdruby' ,
25+ # Valgrind and YJIT interfere with each other, adding noise and slowdown,
26+ # so keep YJIT disabled while running under Valgrind.
27+ ruby : "#{ FileUtils ::RUBY } --disable-yjit"
28+ )
29+
30+ namespace :spec do
31+ task :check_valgrind do
32+ unless system ( 'command -v valgrind > /dev/null 2>&1' )
33+ abort ( "\n Valgrind is required for `rake spec:valgrind` but was not found.\n " \
34+ "Install it first (Linux only), e.g. `sudo apt-get install valgrind`.\n " )
35+ end
36+ end
37+
38+ RubyMemcheck ::RSpec ::RakeTask . new ( valgrind : [ :check_valgrind , :compile ] )
39+ end
40+ rescue LoadError
41+ # ruby_memcheck is an optional, Linux-only development dependency. If it is
42+ # not installed just skip defining the task instead of breaking the Rakefile.
43+ end
44+ end
45+
1846desc 'Sync zstd libs dirs to ext/zstdruby/libzstd'
1947task :zstd_update do
2048 FileUtils . rm_r ( "ext/zstdruby/libzstd" )
You can’t perform that action at this time.
0 commit comments