From 28570844204707fc01a735104fc89284d9eae766 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sat, 12 Aug 2023 16:58:55 +1000 Subject: tests: socket: hurd vs Linux hurd does not return the path for unix domain sockets via getsockname() Signed-off-by: Steve Bennett --- tests/socket.test | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/socket.test b/tests/socket.test index d40d1d3..cc7d3d6 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -5,6 +5,7 @@ needs cmd socket needs cmd os.fork constraint eval ipv6 {[socket -ipv6 stream.server ::1:5000] close} +constraint expr linux {$tcl_platform(os) eq "linux"} # Given an IPv4 or IPv6 server socket, return an address # that a client can use to connect to the socket. @@ -73,7 +74,7 @@ test socket-1.4 {unix} -body { stdout flush if {[os.fork] == 0} { # child - set c [socket unix [$s sockname]] + set c [socket unix $path] $s close $c puts hello $c close @@ -90,7 +91,7 @@ test socket-1.5 {unix.dgram} -body { set path [file tempfile] file delete $path set s [socket unix.dgram.server $path] - set c [socket unix.dgram [$s sockname]] + set c [socket unix.dgram $path] $s buffering none $c buffering none $c puts -nonewline hello @@ -204,6 +205,16 @@ test socket-1.11 {stream - ipv6 - port only} -constraints ipv6 -body { set buf } -result {hello} +# On hurd, sockname does not return the path for unix domain sockets +test socket-1.12 {unix} -constraints linux -body { + set path [file tempfile] + file delete $path + set s [socket unix.server $path] + set equal [expr {[$s sockname] eq $path}] + $s close + set equal +} -result {1} + test socket-2.1 {read 1} -body { lassign [socket pipe] r w $w puts -nonewline hello -- cgit v1.1