mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/test_pty.rb: Same as 229281; existence of PTY class do not
guarantee a successful pty operation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9da7920d6b
commit
aa836e539f
2 changed files with 31 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Sep 24 14:19:12 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||||
|
|
||||||
|
* test/test_pty.rb: Same as 229281; existence of PTY class do not
|
||||||
|
guarantee a successful pty operation.
|
||||||
|
|
||||||
Thu Sep 23 23:09:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Sep 23 23:09:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* vm_insnhelper.c (vm_get_cref0): cref is stacked only in normal
|
* vm_insnhelper.c (vm_get_cref0): cref is stacked only in normal
|
||||||
|
|
|
@ -13,6 +13,9 @@ class TestPTY < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_spawn_without_block
|
def test_spawn_without_block
|
||||||
r, w, pid = PTY.spawn(RUBY, '-e', 'puts "a"')
|
r, w, pid = PTY.spawn(RUBY, '-e', 'puts "a"')
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
|
else
|
||||||
assert_equal("a\r\n", r.gets)
|
assert_equal("a\r\n", r.gets)
|
||||||
ensure
|
ensure
|
||||||
Process.wait pid if pid
|
Process.wait pid if pid
|
||||||
|
@ -23,6 +26,8 @@ class TestPTY < Test::Unit::TestCase
|
||||||
assert_equal("b\r\n", r.gets)
|
assert_equal("b\r\n", r.gets)
|
||||||
Process.wait(pid)
|
Process.wait(pid)
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_commandline
|
def test_commandline
|
||||||
|
@ -31,6 +36,8 @@ class TestPTY < Test::Unit::TestCase
|
||||||
assert_equal("foo\r\n", r.gets)
|
assert_equal("foo\r\n", r.gets)
|
||||||
Process.wait(pid)
|
Process.wait(pid)
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_argv0
|
def test_argv0
|
||||||
|
@ -38,10 +45,15 @@ class TestPTY < Test::Unit::TestCase
|
||||||
assert_equal("bar\r\n", r.gets)
|
assert_equal("bar\r\n", r.gets)
|
||||||
Process.wait(pid)
|
Process.wait(pid)
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_open_without_block
|
def test_open_without_block
|
||||||
ret = PTY.open
|
ret = PTY.open
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
|
else
|
||||||
assert_kind_of(Array, ret)
|
assert_kind_of(Array, ret)
|
||||||
assert_equal(2, ret.length)
|
assert_equal(2, ret.length)
|
||||||
assert_equal(IO, ret[0].class)
|
assert_equal(IO, ret[0].class)
|
||||||
|
@ -70,6 +82,9 @@ class TestPTY < Test::Unit::TestCase
|
||||||
assert(File.chardev?(slave.path))
|
assert(File.chardev?(slave.path))
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
|
else
|
||||||
assert(r[0].closed?)
|
assert(r[0].closed?)
|
||||||
assert(r[1].closed?)
|
assert(r[1].closed?)
|
||||||
assert_equal(y, x)
|
assert_equal(y, x)
|
||||||
|
@ -82,6 +97,9 @@ class TestPTY < Test::Unit::TestCase
|
||||||
assert(slave.closed?)
|
assert(slave.closed?)
|
||||||
assert(master.closed?)
|
assert(master.closed?)
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
|
else
|
||||||
assert_nothing_raised {
|
assert_nothing_raised {
|
||||||
PTY.open {|master, slave|
|
PTY.open {|master, slave|
|
||||||
slave.close
|
slave.close
|
||||||
|
@ -97,6 +115,8 @@ class TestPTY < Test::Unit::TestCase
|
||||||
master.puts "bar"
|
master.puts "bar"
|
||||||
assert_equal("bar", slave.gets.chomp)
|
assert_equal("bar", slave.gets.chomp)
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_stat_slave
|
def test_stat_slave
|
||||||
|
@ -105,6 +125,8 @@ class TestPTY < Test::Unit::TestCase
|
||||||
assert_equal(Process.uid, s.uid)
|
assert_equal(Process.uid, s.uid)
|
||||||
assert_equal(0600, s.mode & 0777)
|
assert_equal(0600, s.mode & 0777)
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_close_master
|
def test_close_master
|
||||||
|
@ -112,6 +134,8 @@ class TestPTY < Test::Unit::TestCase
|
||||||
master.close
|
master.close
|
||||||
assert_raise(EOFError) { slave.readpartial(10) }
|
assert_raise(EOFError) { slave.readpartial(10) }
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_close_slave
|
def test_close_slave
|
||||||
|
@ -123,6 +147,8 @@ class TestPTY < Test::Unit::TestCase
|
||||||
Errno::EIO # GNU/Linux
|
Errno::EIO # GNU/Linux
|
||||||
) { master.readpartial(10) }
|
) { master.readpartial(10) }
|
||||||
}
|
}
|
||||||
|
rescue RuntimeError
|
||||||
|
skip $!
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_getpty_nonexistent
|
def test_getpty_nonexistent
|
||||||
|
|
Loading…
Reference in a new issue