diff options
author | Steve Bennett <steveb@workware.net.au> | 2023-08-12 16:58:55 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2023-08-12 16:59:52 +1000 |
commit | 28570844204707fc01a735104fc89284d9eae766 (patch) | |
tree | a16d32774226642a4d04f546ee74b5ec84300189 | |
parent | ff35f0ed44aac0a1ff1492ae41d6b4266db95211 (diff) | |
download | jimtcl-28570844204707fc01a735104fc89284d9eae766.zip jimtcl-28570844204707fc01a735104fc89284d9eae766.tar.gz jimtcl-28570844204707fc01a735104fc89284d9eae766.tar.bz2 |
tests: socket: hurd vs Linux
hurd does not return the path for unix domain sockets
via getsockname()
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | tests/socket.test | 15 |
1 files 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 |