Skip to content

Commit 5046980

Browse files
peterzhu2118matzbot
authored andcommitted
[ruby/mmtk] Use RUBY_TEST_TIMEOUT_SCALE for tests
RUBY_TEST_TIMEOUT_SCALE is set for debug builds because they are slower to run. We should respect this environment variable in MMTk tests too. ruby/mmtk@0a66c518bf
1 parent b4bf3ed commit 5046980

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

test/mmtk/helper.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ class TestCase < ::Test::Unit::TestCase
99

1010
def setup
1111
omit "Not running on MMTk" unless using_mmtk?
12+
13+
@original_timeout_scale = EnvUtil.timeout_scale
14+
timeout_scale = ENV["RUBY_TEST_TIMEOUT_SCALE"].to_f
15+
EnvUtil.timeout_scale = timeout_scale if timeout_scale > 0
16+
1217
super
1318
end
1419

20+
def teardown
21+
EnvUtil.timeout_scale = @original_timeout_scale
22+
end
23+
1524
private
1625

1726
def using_mmtk?

test/mmtk/test_configuration.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
2+
23
require_relative "helper"
4+
35
module MMTk
46
class TestConfiguration < TestCase
57
def test_MMTK_THREADS

0 commit comments

Comments
 (0)