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

Set RUBY_FREE_AT_EXIT for Ruby >= 3.3.0 #29

Merged
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
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
Loading