Skip to content

Commit

Permalink
Merge pull request #29 from flavorjones/flavorjones-ruby-free-at-exit
Browse files Browse the repository at this point in the history
Set `RUBY_FREE_AT_EXIT` for Ruby >= 3.3.0
  • Loading branch information
peterzhu2118 authored Dec 21, 2023
2 parents b5067c1 + 72e957c commit 98f2773
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/ruby_memcheck/test_task_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def run_ruby_with_valgrind(&block)
def setup
ENV["RUBY_MEMCHECK_LOADED_FEATURES_FILE"] = File.expand_path(configuration.loaded_features_file)
ENV["RUBY_MEMCHECK_RUNNING"] = "1"
ENV["RUBY_FREE_AT_EXIT"] = "1"
end

def report_valgrind_errors
Expand Down
14 changes: 13 additions & 1 deletion test/ruby_memcheck/shared_test_task_reporter_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def test_test_helper_is_loaded
end
end

def test_envionment_variable_RUBY_MEMCHECK_RUNNING
def test_environment_variable_RUBY_MEMCHECK_RUNNING
Tempfile.create do |tempfile|
ok = run_with_memcheck(<<~RUBY, raise_on_failure: false)
File.write(#{tempfile.path.inspect}, ENV["RUBY_MEMCHECK_RUNNING"])
Expand All @@ -235,6 +235,18 @@ def test_envionment_variable_RUBY_MEMCHECK_RUNNING
end
end

def test_environment_variable_RUBY_FREE_AT_EXIT
Tempfile.create do |tempfile|
ok = run_with_memcheck(<<~RUBY, raise_on_failure: false)
File.write(#{tempfile.path.inspect}, ENV["RUBY_FREE_AT_EXIT"])
RUBY

assert(ok)
assert_empty(@test_task.reporter.errors)
assert_includes(tempfile.read, "1")
end
end

def test_configration_binary_name
build_configuration(binary_name: "ruby_memcheck_c_test_one")
error = assert_raises do
Expand Down

0 comments on commit 98f2773

Please sign in to comment.