From d5da6c53ca75df14d698c5355afb492057e2b814 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Fri, 18 Dec 2015 10:38:53 -0500 Subject: [PATCH] library.at: Run tests for Python 2 and 3. Update Python tests to run for both Python 2 and 3. Signed-off-by: Russell Bryant Acked-by: Ben Pfaff --- tests/library.at | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/tests/library.at b/tests/library.at index 860277884..d82113fbb 100644 --- a/tests/library.at +++ b/tests/library.at @@ -158,28 +158,37 @@ 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]) -AT_SKIP_IF([test $HAVE_PYTHON = no || test "$IS_WIN32" = "yes"]) -AT_CHECK([$PYTHON $srcdir/test-unix-socket.py x]) -AT_CLEANUP +m4_define([UNIX_SOCKET_SHORT_PATHNAME_PYN], + [AT_SETUP([test unix socket, short pathname - $1]) + AT_SKIP_IF([test $2 = no || test "$IS_WIN32" = "yes"]) + AT_KEYWORDS([python unixsocket]) + AT_CHECK([$3 $srcdir/test-unix-socket.py x]) + AT_CLEANUP]) + +UNIX_SOCKET_SHORT_PATHNAME_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) +UNIX_SOCKET_SHORT_PATHNAME_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) 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/. 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 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]) +m4_define([UNIX_SOCKET_LONG_PATHNAME_PYN], + [AT_SETUP([test unix socket, long pathname - $1]) + AT_SKIP_IF([test $2 = no || test "$IS_WIN32" = "yes"]) + AT_KEYWORDS([python unixsocket]) + 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 && $3 $abs_srcdir/test-unix-socket.py ../$longname/socket socket]) + AT_CLEANUP]) -AT_CHECK([cd $longname && $PYTHON $abs_srcdir/test-unix-socket.py ../$longname/socket socket]) -AT_CLEANUP +UNIX_SOCKET_LONG_PATHNAME_PYN([Python2], [$HAVE_PYTHON], [$PYTHON]) +UNIX_SOCKET_LONG_PATHNAME_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3]) AT_SETUP([ovs_assert]) if test "$IS_WIN32" = "yes"; then -- 2.20.1