Skip to content

Commit 2857084

Browse files
committed
tests: socket: hurd vs Linux
hurd does not return the path for unix domain sockets via getsockname() Signed-off-by: Steve Bennett <[email protected]>
1 parent ff35f0e commit 2857084

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/socket.test

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ needs cmd socket
55
needs cmd os.fork
66

77
constraint eval ipv6 {[socket -ipv6 stream.server ::1:5000] close}
8+
constraint expr linux {$tcl_platform(os) eq "linux"}
89

910
# Given an IPv4 or IPv6 server socket, return an address
1011
# that a client can use to connect to the socket.
@@ -73,7 +74,7 @@ test socket-1.4 {unix} -body {
7374
stdout flush
7475
if {[os.fork] == 0} {
7576
# child
76-
set c [socket unix [$s sockname]]
77+
set c [socket unix $path]
7778
$s close
7879
$c puts hello
7980
$c close
@@ -90,7 +91,7 @@ test socket-1.5 {unix.dgram} -body {
9091
set path [file tempfile]
9192
file delete $path
9293
set s [socket unix.dgram.server $path]
93-
set c [socket unix.dgram [$s sockname]]
94+
set c [socket unix.dgram $path]
9495
$s buffering none
9596
$c buffering none
9697
$c puts -nonewline hello
@@ -204,6 +205,16 @@ test socket-1.11 {stream - ipv6 - port only} -constraints ipv6 -body {
204205
set buf
205206
} -result {hello}
206207

208+
# On hurd, sockname does not return the path for unix domain sockets
209+
test socket-1.12 {unix} -constraints linux -body {
210+
set path [file tempfile]
211+
file delete $path
212+
set s [socket unix.server $path]
213+
set equal [expr {[$s sockname] eq $path}]
214+
$s close
215+
set equal
216+
} -result {1}
217+
207218
test socket-2.1 {read 1} -body {
208219
lassign [socket pipe] r w
209220
$w puts -nonewline hello

0 commit comments

Comments
 (0)