8
8
9
9
class TestEnvironmentVariables
10
10
module Common
11
- IMAGE_NAME = "larskanis/rake-compiler-dock-mri-x86-mingw32:#{ RakeCompilerDock ::IMAGE_VERSION } "
11
+ TEST_PLATFORM = ENV [ "TEST_PLATFORM" ] || "x64-mingw-ucrt"
12
+ DOCKERHUB_USER = ENV [ 'DOCKERHUB_USER' ] || "larskanis"
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 } "
12
17
13
18
def rcd_env
14
19
self . class . instance_variable_get ( "@rcd_env" ) || begin
@@ -23,24 +28,26 @@ def rcd_env
23
28
end
24
29
end
25
30
26
- def test_RUBY_CC_VERSION
27
- df = File . read ( File . expand_path ( "../../Dockerfile.mri.erb" , __FILE__ ) )
28
- df =~ /^ENV RUBY_CC_VERSION\s +(.*)\s +$/
29
- assert_equal $1, rcd_env [ 'RUBY_CC_VERSION' ]
30
- 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
31
37
32
- def test_RAKE_EXTENSION_TASK_NO_NATIVE
33
- assert_equal "true" , rcd_env [ 'RAKE_EXTENSION_TASK_NO_NATIVE' ]
34
- end
38
+ def test_RAKE_EXTENSION_TASK_NO_NATIVE
39
+ assert_equal "true" , rcd_env [ 'RAKE_EXTENSION_TASK_NO_NATIVE' ]
40
+ end
35
41
36
- def test_symlink_rake_compiler
37
- cmd = invocation ( "if test -h $HOME/.rake-compiler ; then echo yes ; else echo no ; fi" )
38
- assert_equal ( "yes" , %x(#{ cmd } ) . strip )
39
- 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
40
46
41
- def test_gem_directory
42
- cmd = invocation ( "if test -d $HOME/.gem ; then echo yes ; else echo no ; fi" )
43
- 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
44
51
end
45
52
end
46
53
@@ -49,7 +56,7 @@ class UsingWrapper < Test::Unit::TestCase
49
56
50
57
def invocation ( command )
51
58
idir = File . join ( File . dirname ( __FILE__ ) , '../lib' )
52
- "#{ 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 } '"
53
60
end
54
61
55
62
def test_HOST_RUBY_PLATFORM
@@ -61,7 +68,7 @@ def test_HOST_RUBY_VERSION
61
68
end
62
69
63
70
def test_IMAGE
64
- assert_equal IMAGE_NAME , rcd_env [ 'RCD_IMAGE' ]
71
+ assert_equal TEST_IMAGE_NAME , rcd_env [ 'RCD_IMAGE' ]
65
72
end
66
73
67
74
def test_PWD
@@ -73,7 +80,7 @@ class AsIfContinuousIntegration < Test::Unit::TestCase
73
80
include Common
74
81
75
82
def invocation ( command )
76
- "docker run -it #{ IMAGE_NAME } bash -c '#{ command } '"
83
+ "docker run --rm #{ TEST_IMAGE_NAME } bash -c '#{ command } '"
77
84
end
78
85
end
79
86
end
0 commit comments