summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-08 11:30:26 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-08 11:30:26 +0000
commit732b695163362f2ef865a077a22c2bf5187cd4d4 (patch)
tree9497ca7b929a07843083bf1cfd0a6213f1b36c11 /test
parentaa28707309ebec740094065bded6f108ef4481f1 (diff)
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/socket/test_unix.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index 0ea7f5f5be..e783faff3b 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -296,4 +296,22 @@ class TestUNIXSocket < Test::Unit::TestCase
}
end
+ def test_linux_cred
+ return if /linux/ !~ RUBY_PLATFORM
+ Dir.mktmpdir {|d|
+ sockpath = "#{d}/sock"
+ serv = Socket.unix_server_socket(sockpath)
+ c = Socket.unix(sockpath)
+ s, = serv.accept
+ s.setsockopt(:SOCKET, :PASSCRED, 1)
+ c.print "a"
+ msg, cliend_ai, rflags, cred = s.recvmsg
+ p cred
+ assert_equal("a", msg)
+ assert_match(/pid=#{$$} /, cred.inspect)
+ assert_match(/uid=#{Process.uid} /, cred.inspect)
+ assert_match(/gid=#{Process.gid}>/, cred.inspect)
+ }
+ end
+
end if defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM