Skip to content

Refine MMTk tests for different plans #25

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

Merged
merged 3 commits into from
Sep 2, 2022
Merged
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
10 changes: 8 additions & 2 deletions test/ruby/test_mmtk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def test_description
def test_enable
ENABLE_OPTIONS.each do |version_args|
assert_in_out_err(['--version'] + version_args) do |stdout, stderr|
assert_equal(RUBY_DESCRIPTION, stdout.first)
# Need to scrub the description because --mmtk etc will use the default plan
assert_equal(scrub_desc(RUBY_DESCRIPTION), scrub_desc(stdout.first))
assert_equal([], stderr)
end
end
Expand All @@ -47,7 +48,8 @@ def test_enable_from_rubyopt
ENABLE_OPTIONS.each do |version_args|
mmtk_child_env = {'RUBYOPT' => version_args.join(' ')}
assert_in_out_err([mmtk_child_env, '--version'], '') do |stdout, stderr|
assert_equal(RUBY_DESCRIPTION, stdout.first)
# Need to scrub the description because --mmtk etc will use the default plan
assert_equal(scrub_desc(RUBY_DESCRIPTION), scrub_desc(stdout.first))
assert_equal([], stderr)
end
end
Expand Down Expand Up @@ -107,4 +109,8 @@ def test_gc_stat
assert_operator(GC.stat(:mmtk_free_bytes), :<=, GC.stat(:mmtk_total_bytes))
assert_operator(GC.stat(:mmtk_used_bytes), :<=, GC.stat(:mmtk_total_bytes))
end

def scrub_desc(desc)
desc.gsub(/\((MarkSweep|NoGC)\)/, '(XGC)')
end
end