summaryrefslogtreecommitdiff
path: root/tests/library.at
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-11-09 15:58:36 -0800
committerBen Pfaff <blp@nicira.com>2010-11-10 10:56:01 -0800
commit6e170b4c7802f4f388ec63d4c1146de830d98669 (patch)
tree9156b13a42a07e4f872fb5bde1764556e5645648 /tests/library.at
parente61c056cb94aeffc86cb314ea32726be9b666724 (diff)
downloadopenvswitch-6e170b4c7802f4f388ec63d4c1146de830d98669.tar.gz
socket-util: Work around Unix domain socket path name limits on Linux.
Many Open vSwitch tests fail on Debian's automatic build machines because the builds occur in deeply nested directories with long names. OVS tries to bind and connect to Unix domain sockets using absolute path names, which in combination with long directory names means that the socket's name exceeds the limit for Unix domain socket names (108 bytes on Linux). This commit works around the problem on Linux by indirecting through /proc/self/fd/<dirfd>/<basename> when names exceed the maximum that can be used directly. Reported-by: Hector Oron <hector.oron@gmail.com> Reported-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Reported-by: Roger Leigh <rleigh@codelibre.net> Debian bug #602891. Debian bug #602911.
Diffstat (limited to 'tests/library.at')
-rw-r--r--tests/library.at27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/library.at b/tests/library.at
index 1dca2b850..cab8e2c9b 100644
--- a/tests/library.at
+++ b/tests/library.at
@@ -38,3 +38,30 @@ AT_SETUP([test byte order conversion])
AT_KEYWORDS([byte order])
AT_CHECK([test-byte-order], [0], [ignore])
AT_CLEANUP
+
+AT_SETUP([test unix socket -- short pathname])
+AT_CHECK([test-unix-socket x])
+AT_CLEANUP
+
+dnl Unix sockets with long names are problematic because the name has to
+dnl go in a fixed-length field in struct sockaddr_un. Generally the limit
+dnl is about 100 bytes. On Linux, we work around this by indirecting through
+dnl a directory fd using /proc/self/fd/<dirfd>. We do not have a workaround
+dnl for other platforms, so we skip the test there.
+AT_SETUP([test unix socket -- long pathname])
+AT_CHECK([dnl
+ case `uname` in dnl (
+ *[[lL]]inux*)
+ exit 0
+ ;; dnl (
+ *)
+ dnl Magic exit code to tell Autotest to skip this test.
+ exit 77
+ ;;
+ esac
+])
+dnl Linux has a 108 byte limit; this is 150 bytes long.
+mkdir 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+cd 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+AT_CHECK([test-unix-socket ../012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/socket socket])
+AT_CLEANUP