[ovs-dev] [PATCH] tests: Better tolerate file system restriction on file name length.

Ben Pfaff blp at ovn.org
Tue Feb 16 19:13:35 UTC 2016


ecryptfs on Linux restricts file names to 143 bytes, but these two tests
used a 150-byte name.  This commit fixes the specific problem on ecryptfs
by reducing the name it test to 143 bytes.  It also fixes the more general
problem of name length restrictions by skipping the test, rather than
failing it, if a directory with the 143-byte name cannot be created, since
the most likely problem is that the name is too long for the file system.

Reported-by: Zoltán Balogh <zoltan.balogh at ericsson.com>
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 tests/library.at | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/tests/library.at b/tests/library.at
index d5dcb12..8602778 100644
--- a/tests/library.at
+++ b/tests/library.at
@@ -147,11 +147,15 @@ 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 - C])
 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
-dnl Linux has a 108 byte limit; this is 150 bytes long.
-longname=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-mkdir $longname
-cd $longname
-AT_CHECK([ovstest test-unix-socket ../$longname/socket socket])
+dnl Linux sockaddr_un has a 108-byte limit, so this needs to be longer.
+dnl Linux "ecryptfs" has a 143-byte limit, so we use that many bytes.
+longname=01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
+
+dnl Skip the test if the directory can't be created (presumably the file
+dnl system doesn't support such long names).
+AT_CHECK([mkdir $longname || exit 77])
+
+AT_CHECK([cd $longname && ovstest test-unix-socket ../$longname/socket socket])
 AT_CLEANUP
 
 AT_SETUP([test unix socket, short pathname - Python])
@@ -166,11 +170,15 @@ 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 - Python])
 AT_SKIP_IF([test $HAVE_PYTHON = no || test "$IS_WIN32" = "yes"])
-dnl Linux has a 108 byte limit; this is 150 bytes long.
-longname=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-mkdir $longname
-cd $longname
-AT_CHECK([$PYTHON $abs_srcdir/test-unix-socket.py ../$longname/socket socket])
+dnl Linux sockaddr_un has a 108-byte limit, so this needs to be longer.
+dnl Linux "ecryptfs" has a 143-byte limit, so we use that many bytes.
+longname=01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012
+
+dnl Skip the test if the directory can't be created (presumably the file
+dnl system doesn't support such long names).
+AT_CHECK([mkdir $longname || exit 77])
+
+AT_CHECK([cd $longname && $PYTHON $abs_srcdir/test-unix-socket.py ../$longname/socket socket])
 AT_CLEANUP
 
 AT_SETUP([ovs_assert])
-- 
2.1.3




More information about the dev mailing list