Skip to content

Commit 77f843f

Browse files
committed
Adjust image tests to work on jruby
1 parent 8d71259 commit 77f843f

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

test/test_environment_variables.rb

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ class TestEnvironmentVariables
1010
module Common
1111
TEST_PLATFORM = ENV["TEST_PLATFORM"] || "x64-mingw-ucrt"
1212
DOCKERHUB_USER = ENV['DOCKERHUB_USER'] || "larskanis"
13-
TEST_IMAGE_NAME = "#{DOCKERHUB_USER}/rake-compiler-dock-mri-#{TEST_PLATFORM}:#{RakeCompilerDock::IMAGE_VERSION}"
13+
14+
IS_JRUBY = TEST_PLATFORM.to_s == "jruby"
15+
platform = IS_JRUBY ? "jruby" : "mri-#{TEST_PLATFORM}"
16+
TEST_IMAGE_NAME = "#{DOCKERHUB_USER}/rake-compiler-dock-#{platform}:#{RakeCompilerDock::IMAGE_VERSION}"
1417

1518
def rcd_env
1619
self.class.instance_variable_get("@rcd_env") || begin
@@ -25,24 +28,26 @@ def rcd_env
2528
end
2629
end
2730

28-
def test_RUBY_CC_VERSION
29-
df = File.read(File.expand_path("../../Dockerfile.mri.erb", __FILE__))
30-
df =~ /^ENV RUBY_CC_VERSION\s+(.*)\s+$/
31-
assert_equal $1, rcd_env['RUBY_CC_VERSION']
32-
end
31+
unless IS_JRUBY
32+
def test_RUBY_CC_VERSION
33+
df = File.read(File.expand_path("../../Dockerfile.mri.erb", __FILE__))
34+
df =~ /^ENV RUBY_CC_VERSION\s+(.*)\s+$/
35+
assert_equal $1, rcd_env['RUBY_CC_VERSION']
36+
end
3337

34-
def test_RAKE_EXTENSION_TASK_NO_NATIVE
35-
assert_equal "true", rcd_env['RAKE_EXTENSION_TASK_NO_NATIVE']
36-
end
38+
def test_RAKE_EXTENSION_TASK_NO_NATIVE
39+
assert_equal "true", rcd_env['RAKE_EXTENSION_TASK_NO_NATIVE']
40+
end
3741

38-
def test_symlink_rake_compiler
39-
cmd = invocation("if test -h $HOME/.rake-compiler ; then echo yes ; else echo no ; fi")
40-
assert_equal("yes", %x(#{cmd}).strip)
41-
end
42+
def test_symlink_rake_compiler
43+
cmd = invocation("if test -h $HOME/.rake-compiler ; then echo yes ; else echo no ; fi")
44+
assert_equal("yes", %x(#{cmd}).strip)
45+
end
4246

43-
def test_gem_directory
44-
cmd = invocation("if test -d $HOME/.gem ; then echo yes ; else echo no ; fi")
45-
assert_equal("yes", %x(#{cmd}).strip)
47+
def test_gem_directory
48+
cmd = invocation("if test -d $HOME/.gem ; then echo yes ; else echo no ; fi")
49+
assert_equal("yes", %x(#{cmd}).strip)
50+
end
4651
end
4752
end
4853

@@ -51,7 +56,7 @@ class UsingWrapper < Test::Unit::TestCase
5156

5257
def invocation(command)
5358
idir = File.join(File.dirname(__FILE__), '../lib')
54-
"RCD_PLATFORM=#{TEST_PLATFORM} #{RbConfig::CONFIG['RUBY_INSTALL_NAME']} -I#{idir.inspect} bin/rake-compiler-dock bash -c '#{command}'"
59+
"RCD_PLATFORM=#{TEST_PLATFORM} RCD_RUBYVM=#{IS_JRUBY ? 'jruby' : 'mri'} #{RbConfig::CONFIG['RUBY_INSTALL_NAME']} -I#{idir.inspect} bin/rake-compiler-dock bash -c '#{command}'"
5560
end
5661

5762
def test_HOST_RUBY_PLATFORM

0 commit comments

Comments
 (0)