summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-12-04 16:40:02 +0100
committerBenoit Daloze <eregontp@gmail.com>2020-12-04 16:45:54 +0100
commitb4ec4a41c24105efbb43f9b70ca7f36d22f98294 (patch)
tree6e257f60ef031d6ea815123c0ce0ed85e10a66be /test/net
parent83e983ab61b532d17a1177c66e3e43a5042edc1f (diff)
Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) &&
* Otherwise those tests, etc cannot run on alternative Ruby implementations.
Diffstat (limited to 'test/net')
-rw-r--r--test/net/ftp/test_ftp.rb30
-rw-r--r--test/net/http/test_httpresponse.rb2
2 files changed, 16 insertions, 16 deletions
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb
index 0907df5..023e794 100644
--- a/test/net/ftp/test_ftp.rb
+++ b/test/net/ftp/test_ftp.rb
@@ -762,7 +762,7 @@ class FTPTest < Test::Unit::TestCase
begin
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
ftp.login
assert_match(/\AUSER /, commands.shift)
@@ -807,7 +807,7 @@ class FTPTest < Test::Unit::TestCase
begin
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
ftp.login
assert_match(/\AUSER /, commands.shift)
@@ -1545,7 +1545,7 @@ EOF
begin
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
assert_equal(['LANG EN*', 'UTF8'], ftp.features)
assert_equal("FEAT\r\n", commands.shift)
@@ -1568,7 +1568,7 @@ EOF
begin
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
assert_raise(Net::FTPPermError) do
ftp.features
@@ -1594,7 +1594,7 @@ EOF
begin
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
ftp.option("UTF8", "ON")
assert_equal("OPTS UTF8 ON\r\n", commands.shift)
@@ -1653,7 +1653,7 @@ EOF
begin
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
entry = ftp.mlst("foo")
assert_equal("/foo", entry.pathname)
@@ -1740,7 +1740,7 @@ EOF
begin
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
ftp.login
assert_match(/\AUSER /, commands.shift)
@@ -1779,7 +1779,7 @@ EOF
def test_parse257
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
assert_equal('/foo/bar',
ftp.send(:parse257, '257 "/foo/bar" directory created'))
assert_equal('/foo/bar"baz',
@@ -1918,7 +1918,7 @@ EOF
port: port,
ssl: { ca_file: CA_FILE },
passive: false)
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
begin
assert_equal("AUTH TLS\r\n", commands.shift)
assert_equal("PBSZ 0\r\n", commands.shift)
@@ -2003,7 +2003,7 @@ EOF
port: port,
ssl: { ca_file: CA_FILE },
passive: true)
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
begin
assert_equal("AUTH TLS\r\n", commands.shift)
assert_equal("PBSZ 0\r\n", commands.shift)
@@ -2079,7 +2079,7 @@ EOF
ssl: { ca_file: CA_FILE },
private_data_connection: false,
passive: false)
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
begin
assert_equal("AUTH TLS\r\n", commands.shift)
ftp.login
@@ -2149,7 +2149,7 @@ EOF
ssl: { ca_file: CA_FILE },
private_data_connection: false,
passive: true)
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
begin
assert_equal("AUTH TLS\r\n", commands.shift)
ftp.login
@@ -2230,7 +2230,7 @@ EOF
ftp = Net::FTP.new(SERVER_NAME,
port: server.port,
ssl: { ca_file: CA_FILE })
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
assert_equal("AUTH TLS\r\n", commands.shift)
assert_equal("PBSZ 0\r\n", commands.shift)
assert_equal("PROT P\r\n", commands.shift)
@@ -2342,7 +2342,7 @@ EOF
chdir_to_tmpdir do
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
ftp.login
assert_match(/\AUSER /, commands.shift)
@@ -2448,7 +2448,7 @@ EOF
end
begin
ftp = Net::FTP.new
- ftp.read_timeout *= 5 if RubyVM::MJIT.enabled? # for --jit-wait
+ ftp.read_timeout *= 5 if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait
ftp.connect(SERVER_ADDR, server.port)
ftp.login
assert_match(/\AUSER /, commands.shift)
diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb
index 6284144..a70a9bc 100644
--- a/test/net/http/test_httpresponse.rb
+++ b/test/net/http/test_httpresponse.rb
@@ -78,7 +78,7 @@ EOS
def test_read_body_block_mod
# http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3019353
- skip 'too unstable with --jit-wait, and extending read_timeout did not help it' if RubyVM::MJIT.enabled?
+ skip 'too unstable with --jit-wait, and extending read_timeout did not help it' if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
IO.pipe do |r, w|
buf = 'x' * 1024
buf.freeze