mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 02:23:59 +02:00
* gc.c (rb_gc_set_params): allow GC parameter configuration by
environment variables. based on a patch from funny-falcon at https://gist.github.com/856296, but honors safe level. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c414d861c1
commit
eb807d42ec
67 changed files with 773 additions and 1845 deletions
|
@ -1776,37 +1776,4 @@ End
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_fcntl_lock
|
||||
return if /x86_64-linux/ !~ RUBY_PLATFORM # A binary form of struct flock depend on platform
|
||||
|
||||
pad=0
|
||||
Tempfile.open(self.class.name) do |f|
|
||||
r, w = IO.pipe
|
||||
pid = fork do
|
||||
r.close
|
||||
lock = [Fcntl::F_WRLCK, IO::SEEK_SET, pad, 12, 34, 0].pack("s!s!i!L!L!i!")
|
||||
f.fcntl Fcntl::F_SETLKW, lock
|
||||
w.syswrite "."
|
||||
sleep
|
||||
end
|
||||
w.close
|
||||
assert_equal ".", r.read(1)
|
||||
r.close
|
||||
pad = 0
|
||||
getlock = [Fcntl::F_WRLCK, 0, pad, 0, 0, 0].pack("s!s!i!L!L!i!")
|
||||
f.fcntl Fcntl::F_GETLK, getlock
|
||||
|
||||
ptype, whence, pad, start, len, lockpid = getlock.unpack("s!s!i!L!L!i!")
|
||||
|
||||
assert_equal(ptype, Fcntl::F_WRLCK)
|
||||
assert_equal(whence, IO::SEEK_SET)
|
||||
assert_equal(start, 12)
|
||||
assert_equal(len, 34)
|
||||
assert_equal(pid, lockpid)
|
||||
|
||||
Process.kill :TERM, pid
|
||||
Process.waitpid2(pid)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -962,7 +962,6 @@ class TestM17N < Test::Unit::TestCase
|
|||
|
||||
assert_equal("X\u3042\u3044X", "A\u3042\u3044\u3046".tr("^\u3042\u3044", "X"))
|
||||
assert_equal("\u3042\u3046" * 100, ("\u3042\u3044" * 100).tr("\u3044", "\u3046"))
|
||||
assert_equal("Y", "\u3042".tr("^X", "Y"))
|
||||
end
|
||||
|
||||
def test_tr_s
|
||||
|
|
|
@ -384,20 +384,16 @@ class TestProcess < Test::Unit::TestCase
|
|||
Process.wait Process.spawn(*ECHO["c"], STDERR=>STDOUT, STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644])
|
||||
assert_equal("c", File.read("out").chomp)
|
||||
File.open("out", "w") {|f|
|
||||
Process.wait Process.spawn(*ECHO["d"], STDOUT=>f)
|
||||
Process.wait Process.spawn(*ECHO["d"], f=>STDOUT, STDOUT=>f)
|
||||
assert_equal("d", File.read("out").chomp)
|
||||
}
|
||||
opts = {STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644]}
|
||||
if /mswin|mingw/ !~ RUBY_PLATFORM
|
||||
opts.merge(3=>STDOUT, 4=>STDOUT, 5=>STDOUT, 6=>STDOUT, 7=>STDOUT)
|
||||
end
|
||||
Process.wait Process.spawn(*ECHO["e"], opts)
|
||||
Process.wait Process.spawn(*ECHO["e"], STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644],
|
||||
3=>STDOUT, 4=>STDOUT, 5=>STDOUT, 6=>STDOUT, 7=>STDOUT)
|
||||
assert_equal("e", File.read("out").chomp)
|
||||
opts = {STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644]}
|
||||
if /mswin|mingw/ !~ RUBY_PLATFORM
|
||||
opts.merge(3=>0, 4=>:in, 5=>STDIN, 6=>1, 7=>:out, 8=>STDOUT, 9=>2, 10=>:err, 11=>STDERR)
|
||||
end
|
||||
Process.wait Process.spawn(*ECHO["ee"], opts)
|
||||
Process.wait Process.spawn(*ECHO["ee"], STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644],
|
||||
3=>0, 4=>:in, 5=>STDIN,
|
||||
6=>1, 7=>:out, 8=>STDOUT,
|
||||
9=>2, 10=>:err, 11=>STDERR)
|
||||
assert_equal("ee", File.read("out").chomp)
|
||||
if /mswin|mingw/ !~ RUBY_PLATFORM
|
||||
# passing non-stdio fds is not supported on Windows
|
||||
|
|
|
@ -1944,36 +1944,4 @@ class TestString < Test::Unit::TestCase
|
|||
assert_equal(S("hello world"), a)
|
||||
assert_equal(S("hello "), b)
|
||||
end
|
||||
|
||||
def u(str)
|
||||
str.force_encoding(Encoding::UTF_8)
|
||||
end
|
||||
|
||||
def test_byteslice
|
||||
assert_equal("h", "hello".byteslice(0))
|
||||
assert_equal(nil, "hello".byteslice(5))
|
||||
assert_equal("o", "hello".byteslice(-1))
|
||||
assert_equal(nil, "hello".byteslice(-6))
|
||||
|
||||
assert_equal("", "hello".byteslice(0, 0))
|
||||
assert_equal("hello", "hello".byteslice(0, 6))
|
||||
assert_equal("hello", "hello".byteslice(0, 6))
|
||||
assert_equal("", "hello".byteslice(5, 1))
|
||||
assert_equal("o", "hello".byteslice(-1, 6))
|
||||
assert_equal(nil, "hello".byteslice(-6, 1))
|
||||
assert_equal(nil, "hello".byteslice(0, -1))
|
||||
|
||||
assert_equal("h", "hello".byteslice(0..0))
|
||||
assert_equal("", "hello".byteslice(5..0))
|
||||
assert_equal("o", "hello".byteslice(4..5))
|
||||
assert_equal(nil, "hello".byteslice(6..0))
|
||||
assert_equal("", "hello".byteslice(-1..0))
|
||||
assert_equal("llo", "hello".byteslice(-3..5))
|
||||
|
||||
assert_equal(u("\x81"), "\u3042".byteslice(1))
|
||||
assert_equal(u("\x81\x82"), "\u3042".byteslice(1, 2))
|
||||
assert_equal(u("\x81\x82"), "\u3042".byteslice(1..2))
|
||||
|
||||
assert_equal(u("\x82")+("\u3042"*9), ("\u3042"*10).byteslice(2, 28))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -91,13 +91,24 @@ class TestSystem < Test::Unit::TestCase
|
|||
def test_system_at
|
||||
if /mswin|mingw/ =~ RUBY_PLATFORM
|
||||
bug4393 = '[ruby-core:35218]'
|
||||
bug4396 = '[ruby-core:35227]'
|
||||
|
||||
# @ + builtin command
|
||||
assert_equal("foo\n", `@echo foo`, bug4393);
|
||||
assert_equal("foo\n", `@@echo foo`, bug4393);
|
||||
assert_equal("@@foo\n", `@@echo @@foo`, bug4393);
|
||||
|
||||
# @ + non builtin command
|
||||
# "" + @ + built-in
|
||||
assert_equal("@@foo\n", `"echo" @@foo`, bug4396);
|
||||
assert_equal("@@foo\n", `"@@echo" @@foo`, bug4396);
|
||||
assert_equal("@@foo\n", `"@@echo @@foo"`, bug4396);
|
||||
assert_equal('"@foo"\n', `"echo" "@foo"`, bug4396);
|
||||
|
||||
# ^ + @ + built-in
|
||||
assert_equal(nil, system('^@echo foo'), bug4396);
|
||||
assert_equal(nil, system('"^@echo foo"'), bug4396);
|
||||
assert_equal("@foo\n", `echo ^@foo`);
|
||||
|
||||
Dir.mktmpdir("ruby_script_tmp") {|tmpdir|
|
||||
tmpfilename = "#{tmpdir}/ruby_script_tmp.#{$$}"
|
||||
|
||||
|
@ -105,23 +116,16 @@ class TestSystem < Test::Unit::TestCase
|
|||
tmp.print "foo\nbar\nbaz\n@foo";
|
||||
tmp.close
|
||||
|
||||
# @ + non builtin command
|
||||
assert_match(/\Abar\nbaz\n?\z/, `@@findstr "ba" #{tmpfilename.gsub("/", "\\")}`, bug4393);
|
||||
|
||||
# "" + @ + non built-in
|
||||
assert_match(/\Abar\nbaz\n?\z/, `"@@findstr" "ba" #{tmpfilename.gsub("/", "\\")}`, bug4396);
|
||||
assert_match(/\A@foo\n?\z/, `"@@findstr" "@foo" #{tmpfilename.gsub("/", "\\")}`, bug4396);
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def test_system_redirect_win
|
||||
if /mswin|mingw/ !~ RUBY_PLATFORM
|
||||
return
|
||||
end
|
||||
|
||||
cmd = "%WINDIR%/system32/ping.exe \"BFI3CHL671\" > out.txt 2>NUL"
|
||||
assert_equal(false, system(cmd), '[ruby-talk:258939]');
|
||||
|
||||
cmd = "\"%WINDIR%/system32/ping.exe BFI3CHL671\" > out.txt 2>NUL"
|
||||
assert_equal(false, system(cmd), '[ruby-talk:258939]');
|
||||
end
|
||||
|
||||
def test_empty_evstr
|
||||
assert_equal("", eval('"#{}"', nil, __FILE__, __LINE__), "[ruby-dev:25113]")
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue