Remove --disable-gems in assert_in_out_err
assert_in_out_err adds --disable=gems so we don't need to add --disable-gems in the args list.
This commit is contained in:
parent
caf48487ca
commit
91de37c23e
Notes:
git
2023-08-28 19:05:40 +00:00
@ -22,8 +22,7 @@ class TestBugReporter < Test::Unit::TestCase
|
|||||||
tmpdir = Dir.mktmpdir
|
tmpdir = Dir.mktmpdir
|
||||||
|
|
||||||
no_core = "Process.setrlimit(Process::RLIMIT_CORE, 0); " if defined?(Process.setrlimit) && defined?(Process::RLIMIT_CORE)
|
no_core = "Process.setrlimit(Process::RLIMIT_CORE, 0); " if defined?(Process.setrlimit) && defined?(Process::RLIMIT_CORE)
|
||||||
args = ["--disable-gems", "-r-test-/bug_reporter",
|
args = ["-r-test-/bug_reporter", "-C", tmpdir]
|
||||||
"-C", tmpdir]
|
|
||||||
args.push("--yjit") if yjit_enabled? # We want the printed description to match this process's RUBY_DESCRIPTION
|
args.push("--yjit") if yjit_enabled? # We want the printed description to match this process's RUBY_DESCRIPTION
|
||||||
args.unshift({"RUBY_ON_BUG" => nil})
|
args.unshift({"RUBY_ON_BUG" => nil})
|
||||||
stdin = "#{no_core}register_sample_bug_reporter(12345); Process.kill :SEGV, $$"
|
stdin = "#{no_core}register_sample_bug_reporter(12345); Process.kill :SEGV, $$"
|
||||||
|
@ -233,7 +233,7 @@ EOT
|
|||||||
|
|
||||||
def test_gc
|
def test_gc
|
||||||
if respond_to?(:assert_in_out_err) && !(RUBY_PLATFORM =~ /java/)
|
if respond_to?(:assert_in_out_err) && !(RUBY_PLATFORM =~ /java/)
|
||||||
assert_in_out_err(%w[-rjson --disable-gems], <<-EOS, [], [])
|
assert_in_out_err(%w[-rjson], <<-EOS, [], [])
|
||||||
bignum_too_long_to_embed_as_string = 1234567890123456789012345
|
bignum_too_long_to_embed_as_string = 1234567890123456789012345
|
||||||
expect = bignum_too_long_to_embed_as_string.to_s
|
expect = bignum_too_long_to_embed_as_string.to_s
|
||||||
GC.stress = true
|
GC.stress = true
|
||||||
|
@ -228,12 +228,12 @@ class TestGc < Test::Unit::TestCase
|
|||||||
def test_latest_gc_info
|
def test_latest_gc_info
|
||||||
omit 'stress' if GC.stress
|
omit 'stress' if GC.stress
|
||||||
|
|
||||||
assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom'
|
assert_separately([], __FILE__, __LINE__, <<-'RUBY')
|
||||||
GC.start
|
GC.start
|
||||||
count = GC.stat(:heap_free_slots) + GC.stat(:heap_allocatable_pages) * GC::INTERNAL_CONSTANTS[:HEAP_PAGE_OBJ_LIMIT]
|
count = GC.stat(:heap_free_slots) + GC.stat(:heap_allocatable_pages) * GC::INTERNAL_CONSTANTS[:HEAP_PAGE_OBJ_LIMIT]
|
||||||
count.times{ "a" + "b" }
|
count.times{ "a" + "b" }
|
||||||
assert_equal :newobj, GC.latest_gc_info[:gc_by]
|
assert_equal :newobj, GC.latest_gc_info[:gc_by]
|
||||||
eom
|
RUBY
|
||||||
|
|
||||||
GC.latest_gc_info(h = {}) # allocate hash and rehearsal
|
GC.latest_gc_info(h = {}) # allocate hash and rehearsal
|
||||||
GC.start
|
GC.start
|
||||||
@ -335,7 +335,7 @@ class TestGc < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_stress_compile_send
|
def test_stress_compile_send
|
||||||
assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "")
|
assert_in_out_err([], <<-EOS, [], [], "")
|
||||||
GC.stress = true
|
GC.stress = true
|
||||||
begin
|
begin
|
||||||
eval("A::B.c(1, 1, d: 234)")
|
eval("A::B.c(1, 1, d: 234)")
|
||||||
@ -345,7 +345,7 @@ class TestGc < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_singleton_method
|
def test_singleton_method
|
||||||
assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "[ruby-dev:42832]")
|
assert_in_out_err([], <<-EOS, [], [], "[ruby-dev:42832]")
|
||||||
GC.stress = true
|
GC.stress = true
|
||||||
10.times do
|
10.times do
|
||||||
obj = Object.new
|
obj = Object.new
|
||||||
@ -357,7 +357,7 @@ class TestGc < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_singleton_method_added
|
def test_singleton_method_added
|
||||||
assert_in_out_err(%w[--disable-gems], <<-EOS, [], [], "[ruby-dev:44436]")
|
assert_in_out_err([], <<-EOS, [], [], "[ruby-dev:44436]")
|
||||||
class BasicObject
|
class BasicObject
|
||||||
undef singleton_method_added
|
undef singleton_method_added
|
||||||
def singleton_method_added(mid)
|
def singleton_method_added(mid)
|
||||||
@ -404,7 +404,7 @@ class TestGc < Test::Unit::TestCase
|
|||||||
"RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" => "0.4",
|
"RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" => "0.4",
|
||||||
}
|
}
|
||||||
# always full GC when RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR < 1.0
|
# always full GC when RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR < 1.0
|
||||||
assert_in_out_err([env, "--disable-gems", "-e", "GC.start; 1000_000.times{Object.new}; p(GC.stat[:minor_gc_count] < GC.stat[:major_gc_count])"], "", ['true'], //, "")
|
assert_in_out_err([env, "-e", "GC.start; 1000_000.times{Object.new}; p(GC.stat[:minor_gc_count] < GC.stat[:major_gc_count])"], "", ['true'], //, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
@ -505,7 +505,7 @@ class TestGc < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_profiler_clear
|
def test_profiler_clear
|
||||||
omit "for now"
|
omit "for now"
|
||||||
assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom', timeout: 30
|
assert_separately([], __FILE__, __LINE__, <<-'RUBY', timeout: 30)
|
||||||
GC::Profiler.enable
|
GC::Profiler.enable
|
||||||
|
|
||||||
GC.start
|
GC.start
|
||||||
@ -517,7 +517,7 @@ class TestGc < Test::Unit::TestCase
|
|||||||
assert_equal(200, GC::Profiler.raw_data.size)
|
assert_equal(200, GC::Profiler.raw_data.size)
|
||||||
GC::Profiler.clear
|
GC::Profiler.clear
|
||||||
assert_equal(0, GC::Profiler.raw_data.size)
|
assert_equal(0, GC::Profiler.raw_data.size)
|
||||||
eom
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_profiler_total_time
|
def test_profiler_total_time
|
||||||
@ -531,13 +531,13 @@ class TestGc < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_finalizing_main_thread
|
def test_finalizing_main_thread
|
||||||
assert_in_out_err(%w[--disable-gems], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]")
|
assert_in_out_err([], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]")
|
||||||
ObjectSpace.define_finalizer(Thread.main) { p 'finalize' }
|
ObjectSpace.define_finalizer(Thread.main) { p 'finalize' }
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_expand_heap
|
def test_expand_heap
|
||||||
assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'eom'
|
assert_separately([], __FILE__, __LINE__, <<~'RUBY')
|
||||||
GC.start
|
GC.start
|
||||||
base_length = GC.stat[:heap_eden_pages]
|
base_length = GC.stat[:heap_eden_pages]
|
||||||
(base_length * 500).times{ 'a' }
|
(base_length * 500).times{ 'a' }
|
||||||
@ -552,13 +552,13 @@ class TestGc < Test::Unit::TestCase
|
|||||||
(base_length * 500).times{ a << 'a'; nil }
|
(base_length * 500).times{ a << 'a'; nil }
|
||||||
GC.start
|
GC.start
|
||||||
assert_operator base_length, :<, GC.stat[:heap_eden_pages] + 1
|
assert_operator base_length, :<, GC.stat[:heap_eden_pages] + 1
|
||||||
eom
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_thrashing_for_young_objects
|
def test_thrashing_for_young_objects
|
||||||
# This test prevents bugs like [Bug #18929]
|
# This test prevents bugs like [Bug #18929]
|
||||||
|
|
||||||
assert_separately %w[--disable-gem], __FILE__, __LINE__, <<-'RUBY'
|
assert_separately([], __FILE__, __LINE__, <<-'RUBY')
|
||||||
# Grow the heap
|
# Grow the heap
|
||||||
@ary = 100_000.times.map { Object.new }
|
@ary = 100_000.times.map { Object.new }
|
||||||
|
|
||||||
@ -648,11 +648,11 @@ class TestGc < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_finalizer_passed_object_id
|
def test_finalizer_passed_object_id
|
||||||
assert_in_out_err(%w[--disable-gems], <<-EOS, ["true"], [])
|
assert_in_out_err([], <<~RUBY, ["true"], [])
|
||||||
o = Object.new
|
o = Object.new
|
||||||
obj_id = o.object_id
|
obj_id = o.object_id
|
||||||
ObjectSpace.define_finalizer(o, ->(id){ p id == obj_id })
|
ObjectSpace.define_finalizer(o, ->(id){ p id == obj_id })
|
||||||
EOS
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_verify_internal_consistency
|
def test_verify_internal_consistency
|
||||||
|
@ -193,7 +193,7 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
File.write(req, "p :ok\n")
|
File.write(req, "p :ok\n")
|
||||||
assert_file.exist?(req)
|
assert_file.exist?(req)
|
||||||
req[/.rb$/i] = ""
|
req[/.rb$/i] = ""
|
||||||
assert_in_out_err(['--disable-gems'], <<-INPUT, %w(:ok), [])
|
assert_in_out_err([], <<-INPUT, %w(:ok), [])
|
||||||
require "#{req}"
|
require "#{req}"
|
||||||
require "#{req}"
|
require "#{req}"
|
||||||
INPUT
|
INPUT
|
||||||
@ -681,7 +681,7 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
Dir.mktmpdir {|tmp|
|
Dir.mktmpdir {|tmp|
|
||||||
Dir.chdir(tmp) {
|
Dir.chdir(tmp) {
|
||||||
open("foo.rb", "w") {}
|
open("foo.rb", "w") {}
|
||||||
assert_in_out_err([{"RUBYOPT"=>nil}, '--disable-gems'], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7158)
|
assert_in_out_err([{"RUBYOPT"=>nil}], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7158)
|
||||||
begin;
|
begin;
|
||||||
$:.replace([IO::NULL])
|
$:.replace([IO::NULL])
|
||||||
a = Object.new
|
a = Object.new
|
||||||
@ -709,7 +709,7 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
Dir.mktmpdir {|tmp|
|
Dir.mktmpdir {|tmp|
|
||||||
Dir.chdir(tmp) {
|
Dir.chdir(tmp) {
|
||||||
open("foo.rb", "w") {}
|
open("foo.rb", "w") {}
|
||||||
assert_in_out_err([{"RUBYOPT"=>nil}, '--disable-gems'], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7158)
|
assert_in_out_err([{"RUBYOPT"=>nil}], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7158)
|
||||||
begin;
|
begin;
|
||||||
$:.replace([IO::NULL])
|
$:.replace([IO::NULL])
|
||||||
a = Object.new
|
a = Object.new
|
||||||
@ -739,7 +739,7 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
open("foo.rb", "w") {}
|
open("foo.rb", "w") {}
|
||||||
Dir.mkdir("a")
|
Dir.mkdir("a")
|
||||||
open(File.join("a", "bar.rb"), "w") {}
|
open(File.join("a", "bar.rb"), "w") {}
|
||||||
assert_in_out_err(['--disable-gems'], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7383)
|
assert_in_out_err([], "#{<<~"begin;"}\n#{<<~"end;"}", %w(:ok), [], bug7383)
|
||||||
begin;
|
begin;
|
||||||
$:.replace([IO::NULL])
|
$:.replace([IO::NULL])
|
||||||
$:.#{add} "#{tmp}"
|
$:.#{add} "#{tmp}"
|
||||||
@ -963,7 +963,7 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_require_with_public_method_missing
|
def test_require_with_public_method_missing
|
||||||
# [Bug #19793]
|
# [Bug #19793]
|
||||||
assert_separately(["-W0", "--disable-gems", "-rtempfile"], __FILE__, __LINE__, <<~RUBY)
|
assert_separately(["-W0", "-rtempfile"], __FILE__, __LINE__, <<~RUBY)
|
||||||
GC.stress = true
|
GC.stress = true
|
||||||
|
|
||||||
class Object
|
class Object
|
||||||
|
@ -135,12 +135,12 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_debug
|
def test_debug
|
||||||
assert_in_out_err(["--disable-gems", "-de", "p $DEBUG"], "", %w(true), [])
|
assert_in_out_err(["-de", "p $DEBUG"], "", %w(true), [])
|
||||||
|
|
||||||
assert_in_out_err(["--disable-gems", "--debug", "-e", "p $DEBUG"],
|
assert_in_out_err(["--debug", "-e", "p $DEBUG"],
|
||||||
"", %w(true), [])
|
"", %w(true), [])
|
||||||
|
|
||||||
assert_in_out_err(["--disable-gems", "--debug-", "-e", "p $DEBUG"], "", %w(), /invalid option --debug-/)
|
assert_in_out_err(["--debug-", "-e", "p $DEBUG"], "", %w(), /invalid option --debug-/)
|
||||||
end
|
end
|
||||||
|
|
||||||
q = Regexp.method(:quote)
|
q = Regexp.method(:quote)
|
||||||
@ -211,9 +211,9 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
assert_in_out_err(%w(--disable foobarbazqux -e) + [""], "", [],
|
assert_in_out_err(%w(--disable foobarbazqux -e) + [""], "", [],
|
||||||
/unknown argument for --disable: `foobarbazqux'/)
|
/unknown argument for --disable: `foobarbazqux'/)
|
||||||
assert_in_out_err(%w(--disable), "", [], /missing argument for --disable/)
|
assert_in_out_err(%w(--disable), "", [], /missing argument for --disable/)
|
||||||
assert_in_out_err(%w(--disable-gems -e) + ['p defined? Gem'], "", ["nil"], [])
|
assert_in_out_err(%w(-e) + ['p defined? Gem'], "", ["nil"], [])
|
||||||
assert_in_out_err(%w(--disable-did_you_mean -e) + ['p defined? DidYouMean'], "", ["nil"], [])
|
assert_in_out_err(%w(--disable-did_you_mean -e) + ['p defined? DidYouMean'], "", ["nil"], [])
|
||||||
assert_in_out_err(%w(--disable-gems -e) + ['p defined? DidYouMean'], "", ["nil"], [])
|
assert_in_out_err(%w(-e) + ['p defined? DidYouMean'], "", ["nil"], [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_kanji
|
def test_kanji
|
||||||
|
@ -395,7 +395,7 @@ class TestThread < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
INPUT
|
INPUT
|
||||||
|
|
||||||
assert_in_out_err(%w(--disable-gems -d), <<-INPUT, %w(false 2), %r".+")
|
assert_in_out_err(%w(-d), <<-INPUT, %w(false 2), %r".+")
|
||||||
p Thread.abort_on_exception
|
p Thread.abort_on_exception
|
||||||
begin
|
begin
|
||||||
t = Thread.new { raise }
|
t = Thread.new { raise }
|
||||||
|
@ -209,8 +209,7 @@ puts Tempfile.new('foo').path
|
|||||||
|
|
||||||
def test_tempfile_finalizer_does_not_run_if_unlinked
|
def test_tempfile_finalizer_does_not_run_if_unlinked
|
||||||
bug8768 = '[ruby-core:56521] [Bug #8768]'
|
bug8768 = '[ruby-core:56521] [Bug #8768]'
|
||||||
args = %w(--disable-gems -rtempfile)
|
assert_in_out_err(%w(-rtempfile), <<-'EOS') do |(filename), (error)|
|
||||||
assert_in_out_err(args, <<-'EOS') do |(filename), (error)|
|
|
||||||
tmp = Tempfile.new('foo')
|
tmp = Tempfile.new('foo')
|
||||||
puts tmp.path
|
puts tmp.path
|
||||||
tmp.close
|
tmp.close
|
||||||
|
Loading…
x
Reference in New Issue
Block a user