summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2019-09-20 08:30:42 -0700
committerBen Pfaff <blp@ovn.org>2019-09-27 09:23:50 -0700
commit1ca0323e7c29dc7ef5a615c265df0460208f92de (patch)
tree377630fee2130b269cfe2fd348c9e8c6bc5a814a /tests
parent187bb41fbf447acf9fb6ac117dc923bbe649e78c (diff)
downloadopenvswitch-1ca0323e7c29dc7ef5a615c265df0460208f92de.tar.gz
Require Python 3 and remove support for Python 2.
Python 2 reaches end-of-life on January 1, 2020, which is only a few months away. This means that OVS needs to stop depending on in the next release that should occur roughly that same time. Therefore, this commit removes all support for Python 2. It also makes Python 3 a mandatory build dependency. Some of the interesting consequences: - HAVE_PYTHON, HAVE_PYTHON2, and HAVE_PYTHON3 conditionals have been removed, since we now know that Python3 is available. - $PYTHON and $PYTHON2 are removed, and $PYTHON3 is always available. - Many tests for Python 2 support have been removed, and the ones that depended on Python 3 now run unconditionally. This allowed several macros in the testsuite to be removed, making the code clearer. This does make some of the changes to the testsuite files large due to indentation level changes. - #! lines for Python now use /usr/bin/python3 instead of /usr/bin/python. - Packaging depends on Python 3 packages. Acked-by: Numan Siddique <nusiddiq@redhat.com> Tested-by: Numan Siddique <nusiddiq@redhat.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/atlocal.in42
-rw-r--r--tests/automake.mk2
-rw-r--r--tests/check-structs.at3
-rwxr-xr-xtests/checkpatch.at17
-rw-r--r--tests/daemon-py.at453
-rwxr-xr-xtests/flowgen.py2
-rw-r--r--tests/interface-reconfigure.at2
-rw-r--r--tests/json.at57
-rw-r--r--tests/jsonrpc-py.at67
-rw-r--r--tests/library.at42
-rw-r--r--tests/ofproto-dpif.at10
-rw-r--r--tests/ofproto.at4
-rw-r--r--tests/ovs-macros.at2
-rw-r--r--tests/ovs-xapi-sync.at3
-rw-r--r--tests/ovsdb-data.at9
-rw-r--r--tests/ovsdb-idl.at188
-rw-r--r--tests/ovsdb-macros.at52
-rw-r--r--tests/ovsdb-monitor.at20
-rw-r--r--tests/reconnect.at13
-rw-r--r--tests/system-common-macros.at2
-rw-r--r--tests/system-kmod-macros.at3
-rw-r--r--tests/system-traffic.at16
-rw-r--r--tests/system-userspace-macros.at4
-rw-r--r--tests/unixctl-py.at208
-rw-r--r--tests/vlog.at219
25 files changed, 533 insertions, 907 deletions
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 556f8681c..1dc7cd5d0 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -1,28 +1,14 @@
# -*- shell-script -*-
HAVE_OPENSSL='@HAVE_OPENSSL@'
OPENSSL_SUPPORTS_SNI='@OPENSSL_SUPPORTS_SNI@'
-HAVE_PYTHON='@HAVE_PYTHON@'
-HAVE_PYTHON2='@HAVE_PYTHON2@'
-HAVE_PYTHON3='@HAVE_PYTHON3@'
HAVE_UNBOUND='@HAVE_UNBOUND@'
EGREP='@EGREP@'
+PYTHON3='@PYTHON3@'
-if test x"$PYTHON" = x; then
- PYTHON='@PYTHON@'
-fi
-
-if test x"$PYTHON2" = x; then
- PYTHON2='@PYTHON2@'
-fi
-
-if test x"$PYTHON3" = x; then
- PYTHON3='@PYTHON3@'
-
- # PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on
- # stderr that breaks almost any Python3 test (PEP 0538)
- PYTHONCOERCECLOCALE=0
- export PYTHONCOERCECLOCALE
-fi
+# PYTHONCOERCECLOCALE=0 disables the Unicode compatibility warning on
+# stderr that breaks almost any Python3 test (PEP 0538)
+PYTHONCOERCECLOCALE=0
+export PYTHONCOERCECLOCALE
PYTHONPATH=$abs_top_srcdir/python:$abs_top_builddir/tests:$PYTHONPATH
export PYTHONPATH
@@ -63,7 +49,7 @@ Linux)
# in particular the patch attached there, which was applied to glibc CVS as
# "Restore locking in free_check." between 1.11 and 1.11.1.
vswitchd=$abs_top_builddir/vswitchd/ovs-vswitchd
- glibc=`ldd $vswitchd | sed -n 's/^ libc\.[^ ]* => \([^ ]*\) .*/\1/p'`
+ glibc=`ldd $vswitchd | sed -n 's/^ libc\.[^ ]* => \([^ ]*\) .*/\1/p'`
glibc_version=`$glibc | sed -n '1s/.*version \([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p'`
case $glibc_version in
2.[0-9] | 2.1[01]) mcheck=disabled ;;
@@ -116,7 +102,7 @@ FreeBSD|NetBSD)
;;
esac
-if test x"$PYTHON3" != x && test "$IS_WIN32" = yes; then
+if test "$IS_WIN32" = yes; then
# enables legacy windows unicode printing needed for Python3 compatibility
# with the Python2 tests
PYTHONLEGACYWINDOWSFSENCODING=true
@@ -126,7 +112,7 @@ if test x"$PYTHON3" != x && test "$IS_WIN32" = yes; then
fi
# Check whether to run IPv6 tests.
-$PYTHON -c '
+$PYTHON3 -c '
import errno
import socket
import sys
@@ -140,7 +126,7 @@ except socket.error as e:
case $? in
0) HAVE_IPV6=yes ;;
2) HAVE_IPV6=no ;;
- *) echo "$0: unexpected error probing $PYTHON for IPv6 support" >&2 ;;
+ *) echo "$0: unexpected error probing $PYTHON3 for IPv6 support" >&2 ;;
esac
# Look for a python L7 library 'LIB' in the system. If it is found, defines
@@ -149,13 +135,9 @@ find_l7_lib()
{
set +x
var=HAVE_`echo "$1" | tr '[a-z]' '[A-Z]'`
- if test "$HAVE_PYTHON" = "yes"; then
- result=$($PYTHON $abs_top_srcdir/tests/test-l7.py --help | grep "$1")
- if test "x${result}" != x; then
- eval ${var}="yes"
- else
- eval ${var}="no"
- fi
+ result=$($PYTHON3 $abs_top_srcdir/tests/test-l7.py --help | grep "$1")
+ if test "x${result}" != x; then
+ eval ${var}="yes"
else
eval ${var}="no"
fi
diff --git a/tests/automake.mk b/tests/automake.mk
index 0b4f29486..0442334ec 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -199,7 +199,7 @@ check-local:
COVERAGE = coverage
COVERAGE_FILE='$(abs_srcdir)/.coverage'
check-pycov: all clean-pycov
- PYTHONDONTWRITEBYTECODE=yes COVERAGE_FILE=$(COVERAGE_FILE) PYTHON='$(COVERAGE) run -p' $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
+ PYTHONDONTWRITEBYTECODE=yes COVERAGE_FILE=$(COVERAGE_FILE) PYTHON3='$(COVERAGE) run -p' $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=$(AUTOTEST_PATH) $(TESTSUITEFLAGS)
@cd $(srcdir) && $(COVERAGE) combine && COVERAGE_FILE=$(COVERAGE_FILE) $(COVERAGE) annotate
@echo
@echo '----------------------------------------------------------------------'
diff --git a/tests/check-structs.at b/tests/check-structs.at
index 4163c30d6..15ca53611 100644
--- a/tests/check-structs.at
+++ b/tests/check-structs.at
@@ -3,10 +3,9 @@ AT_BANNER([struct alignment checker unit tests])
m4_define([check_structs], [$top_srcdir/build-aux/check-structs])
m4_define([RUN_STRUCT_CHECKER],
[AT_KEYWORDS([check-structs])
- AT_SKIP_IF([test $HAVE_PYTHON = no])
AT_DATA([test.h], [$1
])
- AT_CHECK_UNQUOTED([$PYTHON check_structs test.h], [$2], [$3], [$4])])
+ AT_CHECK_UNQUOTED([$PYTHON3 check_structs test.h], [$2], [$3], [$4])])
AT_SETUP([check struct tail padding])
RUN_STRUCT_CHECKER(
diff --git a/tests/checkpatch.at b/tests/checkpatch.at
index fe21acdf2..6c7394772 100755
--- a/tests/checkpatch.at
+++ b/tests/checkpatch.at
@@ -3,10 +3,9 @@ AT_BANNER([checkpatch])
OVS_START_SHELL_HELPERS
# try_checkpatch PATCH [ERRORS]
#
-# Runs checkpatch under Python 2 and Python 3, if installed, on the given
-# PATCH, expecting the specified set of ERRORS (and warnings).
+# Runs checkpatch, if installed, on the given PATCH, expecting the
+# specified set of ERRORS (and warnings).
try_checkpatch() {
- AT_SKIP_IF([test $HAVE_PYTHON2 = no && test $HAVE_PYTHON3 = no])
# Take the patch to test from $1. Remove an initial four-space indent
# from it and, if it is just headers with no body, add a null body.
echo "$1" | sed 's/^ //' > test.patch
@@ -22,18 +21,12 @@ try_checkpatch() {
: > expout
fi
- try_checkpatch__ "$HAVE_PYTHON2" "$PYTHON2"
- try_checkpatch__ "$HAVE_PYTHON3" "$PYTHON3"
-}
-try_checkpatch__() {
- if test $1 = no; then
- :
- elif test -s expout; then
- AT_CHECK([$2 $top_srcdir/utilities/checkpatch.py -q test.patch],
+ if test -s expout; then
+ AT_CHECK([$PYTHON3 $top_srcdir/utilities/checkpatch.py -q test.patch],
[1], [stdout])
AT_CHECK([sed '/^Lines checked:/,$d' stdout], [0], [expout])
else
- AT_CHECK([$2 $top_srcdir/utilities/checkpatch.py -q test.patch])
+ AT_CHECK([$PYTHON3 $top_srcdir/utilities/checkpatch.py -q test.patch])
fi
}
OVS_END_SHELL_HELPERS
diff --git a/tests/daemon-py.at b/tests/daemon-py.at
index 6adea3c85..883e45a5a 100644
--- a/tests/daemon-py.at
+++ b/tests/daemon-py.at
@@ -1,252 +1,205 @@
-AT_BANNER([daemon unit tests - Python])
-
-m4_define([DAEMON_PYN],
- [AT_SETUP([daemon - $1])
- AT_SKIP_IF([test $2 = no])
- # Skip this test for Windows, echo $! gives shell pid instead of parent process
- AT_SKIP_IF([test "$IS_WIN32" = "yes"])
- AT_KEYWORDS([python daemon])
-
- on_exit 'kill $(cat *.pid)'
- pidfile=test-daemon.py.pid
-
- # Start the daemon and wait for the pidfile to get created
- # and that its contents are the correct pid.
- AT_CHECK([$3 $srcdir/test-daemon.py --pidfile & echo $!], [0], [stdout])
- pid=$(cat stdout)
-
- OVS_WAIT_UNTIL([test -s $pidfile], [kill $pid])
- AT_CHECK([test $pid = $(cat $pidfile)])
- AT_CHECK([kill -0 $pid])
-
- # Kill the daemon and make sure that the pidfile gets deleted.
- kill $pid
- OVS_WAIT_WHILE([kill -0 $pid])
- AT_CHECK([test ! -e $pidfile])
- AT_CLEANUP])
-
-DAEMON_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([DAEMON_MONITOR_PYN],
- [AT_SETUP([daemon --monitor - $1])
- AT_SKIP_IF([test $2 = no])
-
- # Skip this test for Windows, echo $! gives shell pid instead of parent process
- AT_SKIP_IF([test "$IS_WIN32" = "yes"])
-
- on_exit 'kill $(cat *.pid)'
- pidfile=test-daemon.py.pid
-
- # Start the daemon and wait for the pidfile to get created.
- AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --monitor & echo $!], [0], [stdout])
- monitor=$(cat stdout)
- OVS_WAIT_UNTIL([test -s $pidfile])
- child=$(cat $pidfile)
-
- # Check that the pidfile names a running process,
- # and that the parent process of that process is our child process.
- check_ancestors $child $monitor
-
- # Kill the daemon process, making it look like a segfault,
- # and wait for a new child process to get spawned.
- AT_CHECK([kill -SEGV $child])
- OVS_WAIT_WHILE([kill -0 $child])
- OVS_WAIT_UNTIL([test -s $pidfile && test $(cat $pidfile) != $child])
- child2=$(cat $pidfile)
-
- # Check that the pidfile names a running process,
- # and that the parent process of that process is our child process.
- check_ancestors $child2 $monitor
-
- # Kill the daemon process with SIGTERM, and wait for the daemon
- # and the monitor processes to go away and the pidfile to get deleted.
- AT_CHECK([kill $child2])
- OVS_WAIT_WHILE([kill -0 $monitor || kill -0 $child2 || test -e $pidfile])
- AT_CLEANUP])
-
-DAEMON_MONITOR_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([DAEMON_MONITOR_RESTART_PYN],
- [AT_SETUP([daemon --monitor restart exit code - $1])
- AT_SKIP_IF([test $2 = no])
- # Skip this test for Windows, echo $! gives shell pid instead of parent process
- AT_SKIP_IF([test "$IS_WIN32" = "yes"])
-
- on_exit 'kill $(cat *.pid)'
- pidfile=test-daemon.py.pid
-
- # Start the daemon and wait for the pidfile to get created.
- AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --monitor & echo $!], [0], [stdout])
- monitor=$(cat stdout)
- OVS_WAIT_UNTIL([test -s $pidfile])
- child=$(cat $pidfile)
-
- # Check that the pidfile names a running process,
- # and that the parent process of that process is our child process.
- check_ancestors $child $monitor
-
- # HUP the daemon process causing it to throw an exception,
- # and wait for a new child process to get spawned.
- AT_CHECK([kill -HUP $child])
- OVS_WAIT_WHILE([kill -0 $child])
- OVS_WAIT_UNTIL([test -s $pidfile && test $child != $(cat $pidfile)])
- child2=$(cat $pidfile)
-
- # Check that the pidfile names a running process,
- # and that the parent process of that process is our child process.
- check_ancestors $child2 $monitor
-
- # Kill the daemon process with SIGTERM, and wait for the daemon
- # and the monitor processes to go away and the pidfile to get deleted.
- AT_CHECK([kill $child2])
- OVS_WAIT_WHILE([kill -0 $monitor || kill -0 $child2 || test -e $pidfile])
- AT_CLEANUP])
-
-DAEMON_MONITOR_RESTART_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_MONITOR_RESTART_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([DAEMON_DETACH_PYN],
- [AT_SETUP([daemon --detach - $1])
- AT_SKIP_IF([test $2 = no])
-
- # Skip this test for Windows, the pid file not removed if the daemon is killed
- AT_SKIP_IF([test "$IS_WIN32" = "yes"])
-
- on_exit 'kill $(cat *.pid)'
- pidfile=test-daemon.py.pid
-
- # Start the daemon and make sure that the pidfile exists immediately.
- # We don't wait for the pidfile to get created because the daemon is
- # supposed to do so before the parent exits.
- AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --detach --no-chdir], [0])
- AT_CHECK([test -s $pidfile])
- pid=$(cat $pidfile)
- check_ancestors $pid 1
-
- # Kill the daemon and make sure that the pidfile gets deleted.
- AT_CHECK([kill $pid])
- OVS_WAIT_WHILE([kill -0 $pid])
- AT_CHECK([test ! -e $pidfile])
- AT_CLEANUP])
-
-DAEMON_DETACH_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_DETACH_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([DAEMON_DETACH_MONITOR_PYN],
- [AT_SETUP([daemon --detach --monitor - $1])
- AT_SKIP_IF([test $2 = no])
-
- # Skip this test for Windows, uses Linux specific kill signal
- AT_SKIP_IF([test "$IS_WIN32" = "yes"])
-
- on_exit 'kill $(cat *.pid)'
- pidfile=test-daemon.py.pid
-
- # Start the daemon and make sure that the pidfile exists immediately.
- # We don't wait for the pidfile to get created because the daemon is
- # supposed to do so before the parent exits.
- AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --detach --no-chdir --monitor], [0])
- AT_CHECK([test -s $pidfile])
- child=$(cat $pidfile)
- AT_CHECK([parent_pid $child], [0], [stdout])
- monitor=$(cat stdout)
-
- # Check that the pidfile names a running process,
- # and that the parent process of that process is a running process,
- # and that the parent process of that process is init.
- check_ancestors $child $monitor 1
-
- # Kill the daemon process, making it look like a segfault,
- # and wait for a new daemon process to get spawned.
- AT_CHECK([kill -SEGV $child])
- OVS_WAIT_WHILE([kill -0 $child])
- OVS_WAIT_UNTIL([test -s $pidfile && test $(cat $pidfile) != $child])
- child2=$(cat $pidfile)
-
- # Check that the pidfile names a running process,
- # and that the parent process of that process is our child process.
- check_ancestors $child2 $monitor 1
-
- # Kill the daemon process with SIGTERM, and wait for the daemon
- # and the monitor processes to go away and the pidfile to get deleted.
- AT_CHECK([kill $child2])
- OVS_WAIT_WHILE([kill -0 $child2 || kill -0 $monitor || test -e $pidfile])
- AT_CLEANUP])
-
-DAEMON_DETACH_MONITOR_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_DETACH_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([DAEMON_DETACH_ERRORS_PYN],
- [AT_SETUP([daemon --detach startup errors - $1])
- AT_SKIP_IF([test $2 = no])
- AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --detach --no-chdir --bail], [1], [], [stderr])
- AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as requested' stderr],
- [0], [ignore])
- AT_CHECK([test ! -s test-daemon.py.pid])
- AT_CLEANUP])
-
-DAEMON_DETACH_ERRORS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_DETACH_ERRORS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([DAEMON_DETACH_MONITOR_ERRORS_PYN],
- [AT_SETUP([daemon --detach --monitor startup errors - $1])
- AT_SKIP_IF([test $2 = no])
- AT_CAPTURE_FILE([pid])
- AT_CHECK([$3 $srcdir/test-daemon.py --pidfile --detach --no-chdir --monitor --bail], [1], [], [stderr])
- AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as requested' stderr],
- [0], [ignore])
- AT_CHECK([test ! -s test-daemon.py.pid])
- AT_CLEANUP])
-
-DAEMON_DETACH_MONITOR_ERRORS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_DETACH_MONITOR_ERRORS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([DAEMON_DETACH_CLOSES_FDS_PYN],
- [AT_SETUP([daemon --detach closes standard fds - $1])
- AT_SKIP_IF([test $2 = no])
-
- # Skip this test for Windows, uses Linux specific kill signal
- AT_SKIP_IF([test "$IS_WIN32" = "yes"])
-
- AT_CHECK([(yes 2>stderr; echo $? > status) | $3 $srcdir/test-daemon.py --pidfile --detach --no-chdir])
- AT_CHECK([kill $(cat test-daemon.py.pid)])
- AT_CHECK([test -s status])
- if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then
- # Something in the environment caused SIGPIPE to be ignored, but
- # 'yes' at least told us that it got EPIPE. Good enough; we know
- # that stdout was closed.
- :
- else
- # Otherwise make sure that 'yes' died from SIGPIPE.
- AT_CHECK([kill -l `cat status`], [0], [PIPE
+AT_BANNER([daemon unit tests - Python3])
+
+AT_SETUP([daemon - Python3])
+# Skip this test for Windows, echo $! gives shell pid instead of parent process
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+AT_KEYWORDS([python daemon])
+
+on_exit 'kill $(cat *.pid)'
+pidfile=test-daemon.py.pid
+
+# Start the daemon and wait for the pidfile to get created
+# and that its contents are the correct pid.
+AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile & echo $!], [0], [stdout])
+pid=$(cat stdout)
+
+OVS_WAIT_UNTIL([test -s $pidfile], [kill $pid])
+AT_CHECK([test $pid = $(cat $pidfile)])
+AT_CHECK([kill -0 $pid])
+
+# Kill the daemon and make sure that the pidfile gets deleted.
+kill $pid
+OVS_WAIT_WHILE([kill -0 $pid])
+AT_CHECK([test ! -e $pidfile])
+AT_CLEANUP
+
+AT_SETUP([daemon --monitor - Python3])
+# Skip this test for Windows, echo $! gives shell pid instead of parent process
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+
+on_exit 'kill $(cat *.pid)'
+pidfile=test-daemon.py.pid
+
+# Start the daemon and wait for the pidfile to get created.
+AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile --monitor & echo $!], [0], [stdout])
+monitor=$(cat stdout)
+OVS_WAIT_UNTIL([test -s $pidfile])
+child=$(cat $pidfile)
+
+# Check that the pidfile names a running process,
+# and that the parent process of that process is our child process.
+check_ancestors $child $monitor
+
+# Kill the daemon process, making it look like a segfault,
+# and wait for a new child process to get spawned.
+AT_CHECK([kill -SEGV $child])
+OVS_WAIT_WHILE([kill -0 $child])
+OVS_WAIT_UNTIL([test -s $pidfile && test $(cat $pidfile) != $child])
+child2=$(cat $pidfile)
+
+# Check that the pidfile names a running process,
+# and that the parent process of that process is our child process.
+check_ancestors $child2 $monitor
+
+# Kill the daemon process with SIGTERM, and wait for the daemon
+# and the monitor processes to go away and the pidfile to get deleted.
+AT_CHECK([kill $child2])
+OVS_WAIT_WHILE([kill -0 $monitor || kill -0 $child2 || test -e $pidfile])
+AT_CLEANUP
+
+AT_SETUP([daemon --monitor restart exit code - Python3])
+# Skip this test for Windows, echo $! gives shell pid instead of parent process
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+
+on_exit 'kill $(cat *.pid)'
+pidfile=test-daemon.py.pid
+
+# Start the daemon and wait for the pidfile to get created.
+AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile --monitor & echo $!], [0], [stdout])
+monitor=$(cat stdout)
+OVS_WAIT_UNTIL([test -s $pidfile])
+child=$(cat $pidfile)
+
+# Check that the pidfile names a running process,
+# and that the parent process of that process is our child process.
+check_ancestors $child $monitor
+
+# HUP the daemon process causing it to throw an exception,
+# and wait for a new child process to get spawned.
+AT_CHECK([kill -HUP $child])
+OVS_WAIT_WHILE([kill -0 $child])
+OVS_WAIT_UNTIL([test -s $pidfile && test $child != $(cat $pidfile)])
+child2=$(cat $pidfile)
+
+# Check that the pidfile names a running process,
+# and that the parent process of that process is our child process.
+check_ancestors $child2 $monitor
+
+# Kill the daemon process with SIGTERM, and wait for the daemon
+# and the monitor processes to go away and the pidfile to get deleted.
+AT_CHECK([kill $child2])
+OVS_WAIT_WHILE([kill -0 $monitor || kill -0 $child2 || test -e $pidfile])
+AT_CLEANUP
+
+AT_SETUP([daemon --detach - Python3])
+
+# Skip this test for Windows, the pid file not removed if the daemon is killed
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+
+on_exit 'kill $(cat *.pid)'
+pidfile=test-daemon.py.pid
+
+# Start the daemon and make sure that the pidfile exists immediately.
+# We don't wait for the pidfile to get created because the daemon is
+# supposed to do so before the parent exits.
+AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile --detach --no-chdir], [0])
+AT_CHECK([test -s $pidfile])
+pid=$(cat $pidfile)
+check_ancestors $pid 1
+
+# Kill the daemon and make sure that the pidfile gets deleted.
+AT_CHECK([kill $pid])
+OVS_WAIT_WHILE([kill -0 $pid])
+AT_CHECK([test ! -e $pidfile])
+AT_CLEANUP
+
+AT_SETUP([daemon --detach --monitor - Python3])
+
+# Skip this test for Windows, uses Linux specific kill signal
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+
+on_exit 'kill $(cat *.pid)'
+pidfile=test-daemon.py.pid
+
+# Start the daemon and make sure that the pidfile exists immediately.
+# We don't wait for the pidfile to get created because the daemon is
+# supposed to do so before the parent exits.
+AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile --detach --no-chdir --monitor], [0])
+AT_CHECK([test -s $pidfile])
+child=$(cat $pidfile)
+AT_CHECK([parent_pid $child], [0], [stdout])
+monitor=$(cat stdout)
+
+# Check that the pidfile names a running process,
+# and that the parent process of that process is a running process,
+# and that the parent process of that process is init.
+check_ancestors $child $monitor 1
+
+# Kill the daemon process, making it look like a segfault,
+# and wait for a new daemon process to get spawned.
+AT_CHECK([kill -SEGV $child])
+OVS_WAIT_WHILE([kill -0 $child])
+OVS_WAIT_UNTIL([test -s $pidfile && test $(cat $pidfile) != $child])
+child2=$(cat $pidfile)
+
+# Check that the pidfile names a running process,
+# and that the parent process of that process is our child process.
+check_ancestors $child2 $monitor 1
+
+# Kill the daemon process with SIGTERM, and wait for the daemon
+# and the monitor processes to go away and the pidfile to get deleted.
+AT_CHECK([kill $child2])
+OVS_WAIT_WHILE([kill -0 $child2 || kill -0 $monitor || test -e $pidfile])
+AT_CLEANUP
+
+AT_SETUP([daemon --detach startup errors - Python3])
+AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile --detach --no-chdir --bail], [1], [], [stderr])
+AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as requested' stderr],
+ [0], [ignore])
+AT_CHECK([test ! -s test-daemon.py.pid])
+AT_CLEANUP
+
+AT_SETUP([daemon --detach --monitor startup errors - Python3])
+AT_CAPTURE_FILE([pid])
+AT_CHECK([$PYTHON3 $srcdir/test-daemon.py --pidfile --detach --no-chdir --monitor --bail], [1], [], [stderr])
+AT_CHECK([grep 'test-daemon.py: exiting after daemonize_start() as requested' stderr],
+ [0], [ignore])
+AT_CHECK([test ! -s test-daemon.py.pid])
+AT_CLEANUP
+
+AT_SETUP([daemon --detach closes standard fds - Python3])
+# Skip this test for Windows, uses Linux specific kill signal
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+
+AT_CHECK([(yes 2>stderr; echo $? > status) | $PYTHON3 $srcdir/test-daemon.py --pidfile --detach --no-chdir])
+AT_CHECK([kill $(cat test-daemon.py.pid)])
+AT_CHECK([test -s status])
+if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then
+ # Something in the environment caused SIGPIPE to be ignored, but
+ # 'yes' at least told us that it got EPIPE. Good enough; we know
+ # that stdout was closed.
+ :
+else
+ # Otherwise make sure that 'yes' died from SIGPIPE.
+ AT_CHECK([kill -l `cat status`], [0], [PIPE
])
- fi
- AT_CLEANUP])
-
-DAEMON_DETACH_CLOSES_FDS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_DETACH_CLOSES_FDS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([DAEMON_DETACH_MONITOR_CLOSES_FDS_PYN],
- [AT_SETUP([daemon --detach --monitor closes standard fds - $1])
- AT_SKIP_IF([test $2 = no])
- # Skip this test for Windows, uses Linux specific kill signal
- AT_SKIP_IF([test "$IS_WIN32" = "yes"])
- AT_CHECK([(yes 2>stderr; echo $? > status) | $3 $srcdir/test-daemon.py --pidfile --detach --no-chdir], [0], [], [])
- AT_CHECK([kill $(cat test-daemon.py.pid)])
- AT_CHECK([test -s status])
- if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then
- # Something in the environment caused SIGPIPE to be ignored, but
- # 'yes' at least told us that it got EPIPE. Good enough; we know
- # that stdout was closed.
- :
- else
- # Otherwise make sure that 'yes' died from SIGPIPE.
- AT_CHECK([kill -l `cat status`], [0], [PIPE
+fi
+AT_CLEANUP
+
+AT_SETUP([daemon --detach --monitor closes standard fds - Python3])
+# Skip this test for Windows, uses Linux specific kill signal
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+AT_CHECK([(yes 2>stderr; echo $? > status) | $PYTHON3 $srcdir/test-daemon.py --pidfile --detach --no-chdir], [0], [], [])
+AT_CHECK([kill $(cat test-daemon.py.pid)])
+AT_CHECK([test -s status])
+if grep '[[bB]]roken pipe' stderr >/dev/null 2>&1; then
+ # Something in the environment caused SIGPIPE to be ignored, but
+ # 'yes' at least told us that it got EPIPE. Good enough; we know
+ # that stdout was closed.
+ :
+else
+ # Otherwise make sure that 'yes' died from SIGPIPE.
+ AT_CHECK([kill -l `cat status`], [0], [PIPE
])
- fi
- AT_CLEANUP])
-
-DAEMON_DETACH_MONITOR_CLOSES_FDS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-DAEMON_DETACH_MONITOR_CLOSES_FDS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+fi
+AT_CLEANUP
diff --git a/tests/flowgen.py b/tests/flowgen.py
index 976fe7a97..7ef32d13c 100755
--- a/tests/flowgen.py
+++ b/tests/flowgen.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
# Copyright (c) 2009, 2010, 2011, 2012, 2015, 2017 Nicira, Inc.
#
diff --git a/tests/interface-reconfigure.at b/tests/interface-reconfigure.at
index 035b00956..f4ceb284a 100644
--- a/tests/interface-reconfigure.at
+++ b/tests/interface-reconfigure.at
@@ -681,7 +681,7 @@ EOF
}
ifr_run () {
- $PYTHON ./interface-reconfigure --root-prefix="`pwd`" --no-syslog "$@"
+ $PYTHON3 ./interface-reconfigure --root-prefix="`pwd`" --no-syslog "$@"
}
ifr_filter () {
diff --git a/tests/json.at b/tests/json.at
index bfe0f1967..527ce8e64 100644
--- a/tests/json.at
+++ b/tests/json.at
@@ -8,45 +8,21 @@ m4_define([JSON_CHECK_POSITIVE_C],
])
AT_CLEANUP])
-# JSON_CHECK_POSITIVE_PY(TITLE, INPUT, OUTPUT, TEST-JSON-ARGS,
-# PYTHON-CHCEK, PYTHON-BIN)
+# JSON_CHECK_POSITIVE_PY(TITLE, INPUT, OUTPUT, TEST-JSON-ARGS)
#
m4_define([JSON_CHECK_POSITIVE_PY],
[AT_SETUP([$1])
AT_KEYWORDS([json positive Python])
- AT_SKIP_IF([test $5 = no])
AT_CHECK([printf %s "AS_ESCAPE([$2])" > input])
AT_CAPTURE_FILE([input])
- AT_CHECK([$6 $srcdir/test-json.py $4 input], [0], [stdout], [])
- AT_CHECK([cat stdout], [0], [$3
-])
- AT_CLEANUP])
-
-m4_define([JSON_CHECK_POSITIVE_UCS4PY],
- [AT_SETUP([$1])
- AT_KEYWORDS([json positive Python])
- AT_SKIP_IF([test $HAVE_PYTHON2 = no])
- AT_XFAIL_IF([test $HAVE_PYTHON2 = yes &&
- $PYTHON2 -c "exit(len(u'\U00010800'))"; test $? -ne 1])
- AT_CHECK([printf %s "AS_ESCAPE([$2])" > input])
- AT_CAPTURE_FILE([input])
- AT_CHECK([$PYTHON2 $srcdir/test-json.py $4 input], [0], [stdout], [])
+ AT_CHECK([$PYTHON3 $srcdir/test-json.py $4 input], [0], [stdout], [])
AT_CHECK([cat stdout], [0], [$3
])
AT_CLEANUP])
m4_define([JSON_CHECK_POSITIVE],
[JSON_CHECK_POSITIVE_C([$1 - C], [$2], [$3], [$4])
- JSON_CHECK_POSITIVE_PY([$1 - Python2], [$2], [$3], [$4],
- [$HAVE_PYTHON2], [$PYTHON2])
- JSON_CHECK_POSITIVE_PY([$1 - Python3], [$2], [$3], [$4],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
-m4_define([JSON_CHECK_POSITIVE_PY23],
- [JSON_CHECK_POSITIVE_PY([$1 - Python2], [$2], [$3], [$4],
- [$HAVE_PYTHON2], [$PYTHON2])
- JSON_CHECK_POSITIVE_PY([$1 - Python3], [$2], [$3], [$4],
- [$HAVE_PYTHON3], [$PYTHON3])])
+ JSON_CHECK_POSITIVE_PY([$1 - Python3], [$2], [$3], [$4])])
m4_define([JSON_CHECK_NEGATIVE_C],
[AT_SETUP([$1])
@@ -58,26 +34,21 @@ m4_define([JSON_CHECK_NEGATIVE_C],
])
AT_CLEANUP])
-# JSON_CHECK_NEGATIVE_PY(TITLE, INPUT, OUTPUT, TEST-JSON-ARGS,
-# PYTHON-CHCEK, PYTHON-BIN)
+# JSON_CHECK_NEGATIVE_PY(TITLE, INPUT, OUTPUT, TEST-JSON-ARGS)
#
m4_define([JSON_CHECK_NEGATIVE_PY],
[AT_SETUP([$1])
AT_KEYWORDS([json negative Python])
- AT_SKIP_IF([test $5 = no])
AT_CHECK([printf %s "AS_ESCAPE([$2])" > input])
AT_CAPTURE_FILE([input])
- AT_CHECK([$6 $srcdir/test-json.py $4 input], [1], [stdout], [])
+ AT_CHECK([$PYTHON3 $srcdir/test-json.py $4 input], [1], [stdout], [])
AT_CHECK([[sed 's/^error: [^:]*:/error:/' < stdout]], [0], [$3
])
AT_CLEANUP])
m4_define([JSON_CHECK_NEGATIVE],
[JSON_CHECK_NEGATIVE_C([$1 - C], [$2], [$3], [$4])
- JSON_CHECK_NEGATIVE_PY([$1 - Python2], [$2], [$3], [$4],
- [$HAVE_PYTHON2], [$PYTHON2])
- JSON_CHECK_NEGATIVE_PY([$1 - Python3], [$2], [$3], [$4],
- [$HAVE_PYTHON3], [$PYTHON3])])
+ JSON_CHECK_NEGATIVE_PY([$1 - Python3], [$2], [$3], [$4])])
AT_BANNER([JSON -- arrays])
@@ -109,9 +80,6 @@ JSON_CHECK_POSITIVE([Unicode escape sequences],
JSON_CHECK_POSITIVE_C([surrogate pairs - C],
[[["\ud834\udd1e"]]],
[[["𝄞"]]])
-JSON_CHECK_POSITIVE_UCS4PY([surrogate pairs - Python],
- [[["\ud834\udd1e"]]],
- [[["𝄞"]]])
JSON_CHECK_NEGATIVE([a string by itself is not valid JSON], ["xxx"],
[error: syntax error at beginning of input])
JSON_CHECK_NEGATIVE([end of line in quoted string],
@@ -154,15 +122,6 @@ AT_CHECK([printf '"xxx' | ovstest test-json -], [1],
])
AT_CLEANUP
-AT_SETUP([end of input in quoted string - Python])
-AT_KEYWORDS([json negative Python])
-AT_SKIP_IF([test $HAVE_PYTHON2 = no])
-AT_CHECK([printf '"xxx' > input
-$PYTHON2 $srcdir/test-json.py input], [1],
- [error: line 0, column 4, byte 4: unexpected end of input in quoted string
-])
-AT_CLEANUP
-
AT_BANNER([JSON -- objects])
JSON_CHECK_POSITIVE([empty object], [[{ }]], [[{}]])
@@ -227,7 +186,7 @@ JSON_CHECK_POSITIVE_C(
[C - large integers that overflow to reals],
[[[9223372036854775807000, -92233720368547758080000]]],
[[[9.22337203685478e+21,-9.22337203685478e+22]]])
-JSON_CHECK_POSITIVE_PY23(
+JSON_CHECK_POSITIVE_PY(
[large integers that overflow to reals],
[[[9223372036854775807000, -92233720368547758080000]]],
[[[9.223372036854776e+21,-9.223372036854776e+22]]])
@@ -252,7 +211,7 @@ JSON_CHECK_POSITIVE_C(
[C - +/- DBL_MAX],
[[[1.7976931348623157e+308, -1.7976931348623157e+308]]],
[[[1.79769313486232e+308,-1.79769313486232e+308]]])
-JSON_CHECK_POSITIVE_PY23(
+JSON_CHECK_POSITIVE_PY(
[+/- DBL_MAX],
[[[1.7976931348623157e+308, -1.7976931348623157e+308]]],
[[[1.7976931348623157e+308,-1.7976931348623157e+308]]])
diff --git a/tests/jsonrpc-py.at b/tests/jsonrpc-py.at
index e75ac4551..3a304dad8 100644
--- a/tests/jsonrpc-py.at
+++ b/tests/jsonrpc-py.at
@@ -1,46 +1,31 @@
-AT_BANNER([JSON-RPC - Python])
+AT_BANNER([JSON-RPC - Python3])
-m4_define([JSONRPC_REQ_REPLY_SUCCESS_PYN],
- [AT_SETUP([JSON-RPC request and successful reply - $1])
- AT_SKIP_IF([test $2 = no])
- AT_KEYWORDS([python jsonrpc])
- AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
- on_exit 'kill `cat test-jsonrpc.py.pid`'
- AT_CHECK(
- [[$3 $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0],
- [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
+AT_SETUP([JSON-RPC request and successful reply - Python3])
+AT_KEYWORDS([python jsonrpc])
+AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
+on_exit 'kill `cat test-jsonrpc.py.pid`'
+AT_CHECK(
+ [[$PYTHON3 $srcdir/test-jsonrpc.py request unix:socket echo '[{"a": "b", "x": null}]']], [0],
+ [[{"error":null,"id":0,"result":[{"a":"b","x":null}]}
]])
- AT_CLEANUP])
+AT_CLEANUP
-JSONRPC_REQ_REPLY_SUCCESS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-JSONRPC_REQ_REPLY_SUCCESS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([JSONRPC_REQ_REPLY_ERROR_PYN],
- [AT_SETUP([JSON-RPC request and error reply - $1])
- AT_SKIP_IF([test $2 = no])
- AT_KEYWORDS([python jsonrpc])
- AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
- on_exit 'kill `cat test-jsonrpc.py.pid`'
- AT_CHECK(
- [[$3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
- [[{"error":{"error":"unknown method"},"id":0,"result":null}
+AT_SETUP([JSON-RPC request and error reply - Python3])
+AT_KEYWORDS([python jsonrpc])
+AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
+on_exit 'kill `cat test-jsonrpc.py.pid`'
+AT_CHECK(
+ [[$PYTHON3 $srcdir/test-jsonrpc.py request unix:socket bad-request '[]']], [0],
+ [[{"error":{"error":"unknown method"},"id":0,"result":null}
]])
- AT_CLEANUP])
-
-JSONRPC_REQ_REPLY_ERROR_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-JSONRPC_REQ_REPLY_ERROR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([JSONRPC_NOTIFICATION_PYN],
- [AT_SETUP([JSON-RPC notification - $1])
- AT_SKIP_IF([test $2 = no])
- AT_KEYWORDS([python jsonrpc])
- AT_CHECK([$3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
- on_exit 'kill `cat test-jsonrpc.py.pid`'
- AT_CHECK([test -e test-jsonrpc.py.pid])
- AT_CHECK([[$3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']])
- # Wait for test-jsonrpc to die, based on its pidfile disappearing
- OVS_WAIT_WHILE([test -e test-jsonrpc.py.pid])
- AT_CLEANUP])
+AT_CLEANUP
-JSONRPC_NOTIFICATION_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-JSONRPC_NOTIFICATION_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_SETUP([JSON-RPC notification - Python3])
+AT_KEYWORDS([python jsonrpc])
+AT_CHECK([$PYTHON3 $srcdir/test-jsonrpc.py --pidfile --detach --no-chdir listen punix:socket])
+on_exit 'kill `cat test-jsonrpc.py.pid`'
+AT_CHECK([test -e test-jsonrpc.py.pid])
+AT_CHECK([[$PYTHON3 $srcdir/test-jsonrpc.py notify unix:socket shutdown '[]']])
+# Wait for test-jsonrpc to die, based on its pidfile disappearing
+OVS_WAIT_WHILE([test -e test-jsonrpc.py.pid])
+AT_CLEANUP
diff --git a/tests/library.at b/tests/library.at
index ecb9268d4..ac4ea4abf 100644
--- a/tests/library.at
+++ b/tests/library.at
@@ -1,7 +1,7 @@
AT_BANNER([library unit tests])
AT_SETUP([flow extractor])
-AT_CHECK([$PYTHON $srcdir/flowgen.py >/dev/null])
+AT_CHECK([$PYTHON3 $srcdir/flowgen.py >/dev/null])
AT_CHECK([ovstest test-flows flows pcap], [0], [checked 247 packets, 0 errors
])
AT_CLEANUP
@@ -176,37 +176,29 @@ AT_CHECK([mkdir $longname || exit 77])
AT_CHECK([cd $longname && ovstest test-unix-socket ../$longname/socket socket])
AT_CLEANUP
-m4_define([UNIX_SOCKET_SHORT_PATHNAME_PYN],
- [AT_SETUP([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_PYTHON2], [$PYTHON2])
-UNIX_SOCKET_SHORT_PATHNAME_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_SETUP([unix socket, short pathname - Python3])
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+AT_KEYWORDS([python unixsocket])
+AT_CHECK([$PYTHON3 $srcdir/test-unix-socket.py 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.
-m4_define([UNIX_SOCKET_LONG_PATHNAME_PYN],
- [AT_SETUP([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_SETUP([unix socket, long pathname - Python3])
+AT_SKIP_IF([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
-UNIX_SOCKET_LONG_PATHNAME_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-UNIX_SOCKET_LONG_PATHNAME_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+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 && $PYTHON3 $abs_srcdir/test-unix-socket.py ../$longname/socket socket])
+AT_CLEANUP
AT_SETUP([ovs_assert])
if test "$IS_WIN32" = "yes"; then
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index b530d5782..8d9908858 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -5394,7 +5394,7 @@ AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=
])
# The packet should be received by port 2
-AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
+AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
OVS_VSWITCHD_STOP
AT_CLEANUP
@@ -5429,7 +5429,7 @@ AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=
])
# The packet should be received by port 2
-AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
+AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
OVS_VSWITCHD_STOP
AT_CLEANUP
@@ -5470,7 +5470,7 @@ AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=
])
# The packet should be received by port 1
-AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p1-tx.pcap | wc -l`])
+AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p1-tx.pcap | wc -l`])
OVS_VSWITCHD_STOP
AT_CLEANUP
@@ -5506,8 +5506,8 @@ ovs-vsctl show
ovs-ofctl dump-flows br0
# The packet should be received by port 2 and not port 3
-AT_CHECK([test 1 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
-AT_CHECK([test 0 = `$PYTHON "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
+AT_CHECK([test 1 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p2-tx.pcap | wc -l`])
+AT_CHECK([test 0 = `$PYTHON3 "$top_srcdir/utilities/ovs-pcap.in" p3-tx.pcap | wc -l`])
# NXT_RESUMEs should be 1 and reg1 should be set to 0x5.
OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep NXT_RESUME | grep -c reg1=0x5`])
diff --git a/tests/ofproto.at b/tests/ofproto.at
index a810dd604..c81409d9d 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -4769,7 +4769,7 @@ m4_divert_push([PREPARE_TESTS])
# past the nearest line that does not start with a space.
[
multiline_sort () {
- $PYTHON -c '
+ $PYTHON3 -c '
import sys
buffer = []
@@ -5056,7 +5056,7 @@ ovs-appctl -t ovs-ofctl ofctl/block
# Add $n_msgs flows.
(echo "in_port=2,actions=output:2"
-$PYTHON -c '
+$PYTHON3 -c '
for i in range('$n_msgs'):
print("cookie=1,reg1=%d,actions=drop" % i)
') > flows.txt
diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index b6add7fda..e07c4b908 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -184,7 +184,7 @@ wc () {
}
uuidfilt () {
- $PYTHON "$top_srcdir"/tests/uuidfilt.py "$@"
+ $PYTHON3 "$top_srcdir"/tests/uuidfilt.py "$@"
}
# run_as PROGRAM_NAME COMMAND [ARG...]
diff --git a/tests/ovs-xapi-sync.at b/tests/ovs-xapi-sync.at
index 2f00704ba..ab96c4d53 100644
--- a/tests/ovs-xapi-sync.at
+++ b/tests/ovs-xapi-sync.at
@@ -1,7 +1,6 @@
AT_BANNER([ovs-xapi-sync])
AT_SETUP([ovs-xapi-sync])
-AT_SKIP_IF([test $HAVE_PYTHON = no])
# Mock up the XenAPI.
cp "$top_srcdir/tests/MockXenAPI.py" XenAPI.py
@@ -26,7 +25,7 @@ ovs_vsctl () {
OVS_VSCTL_SETUP
# Start ovs-xapi-sync.
-AT_CHECK([$PYTHON ./ovs-xapi-sync "--pidfile=ovs-xapi-sync.pid" \
+AT_CHECK([$PYTHON3 ./ovs-xapi-sync "--pidfile=ovs-xapi-sync.pid" \
"--root-prefix=`pwd`" unix:db.sock >log 2>&1 &])
AT_CAPTURE_FILE([log])
diff --git a/tests/ovsdb-data.at b/tests/ovsdb-data.at
index 8c40bcfbf..8cd2a26cb 100644
--- a/tests/ovsdb-data.at
+++ b/tests/ovsdb-data.at
@@ -260,7 +260,7 @@ dnl
dnl <C0> is not allowed anywhere in a UTF-8 string.
dnl (<ED A0 80> is not allowed in UTF-8 but Python doesn't care.)
dnl <ED 80 7F> is not allowed in UTF-8.
-OVSDB_CHECK_POSITIVE_PY([no invalid UTF-8 sequences in strings - Python],
+OVSDB_CHECK_POSITIVE_PY3([no invalid UTF-8 sequences in strings - Python],
[parse-atoms '[["string"]]' \
'@<:@"m4_esyscmd([printf "\300"])"@:>@' \
'@<:@"m4_esyscmd([printf "\355\200\177"])"@:>@' \
@@ -533,12 +533,7 @@ OVSDB_CHECK_POSITIVE_CPY([strings at least 2 characters long],
constraint violation: "a" length 1 is less than minimum allowed length 2
"ab"
"abc"
-constraint violation: "𝄞" length 1 is less than minimum allowed length 2]],
- [],
- [],
- [dnl This test requires a wide build of Python.
- AT_CHECK([$PYTHON -c 'unichr(0x10000)' || exit 77],
- [0], [ignore], [ignore])])
+constraint violation: "𝄞" length 1 is less than minimum allowed length 2]])
OVSDB_CHECK_POSITIVE_CPY([strings no more than 2 characters long],
[[parse-atoms '{"type": "string", "maxLength": 2}' \
diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
index 7c937f742..cc38d69c1 100644
--- a/tests/ovsdb-idl.at
+++ b/tests/ovsdb-idl.at
@@ -112,74 +112,52 @@ m4_define([OVSDB_CHECK_IDL_TCP6_C],
AT_CLEANUP])
# same as OVSDB_CHECK_IDL but uses the Python IDL implementation.
-m4_define([OVSDB_CHECK_IDL_PYN],
- [AT_SETUP([$1])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_PY],
+ [AT_SETUP([$1 - Python3])
AT_KEYWORDS([ovsdb server idl positive Python $5])
AT_CHECK([ovsdb_start_idltest])
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
[0], [$4])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_PY],
- [OVSDB_CHECK_IDL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
-m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN],
- [AT_SETUP([$1 - register_columns])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY],
+ [AT_SETUP([$1 - Python3 - register_columns])
AT_KEYWORDS([ovsdb server idl positive Python register_columns $5])
AT_CHECK([ovsdb_start_idltest])
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1?singleton:name $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket ?simple:b,ba,i,ia,r,ra,s,sa,u,ua?link1:i,k,ka,l2?link2:i,l1?singleton:name $3],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
[0], [$4])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_REGISTER_COLUMNS_PY],
- [OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_REGISTER_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp
-m4_define([OVSDB_CHECK_IDL_TCP_PYN],
- [AT_SETUP([$1 - tcp])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_TCP_PY],
+ [AT_SETUP([$1 - Python3 - tcp])
AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:127.0.0.1:$TCP_PORT $3],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
[0], [$4])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_TCP_PY],
- [OVSDB_CHECK_IDL_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp
# with multiple remotes with only one remote reachable
-m4_define([OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PYN],
- [AT_SETUP([$1 - tcp])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PY],
+ [AT_SETUP([$1 - Python3 (multiple remotes) - tcp])
AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
@@ -188,23 +166,16 @@ m4_define([OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PYN],
remote=tcp:127.0.0.1:$WRONG_PORT_1,tcp:127.0.0.1:$TCP_PORT,tcp:127.0.0.1:$WRONG_PORT_2
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact tcp:127.0.0.1:$TCP_PORT $2], [0], [ignore], [ignore])])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t20 idl $srcdir/idltest.ovsschema $remote $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t20 idl $srcdir/idltest.ovsschema $remote $3],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
[0], [$4])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PY],
- [OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PYN([$1 - Python2 (multiple remotes)], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON], [$PYTHON])
- OVSDB_CHECK_IDL_TCP_MULTIPLE_REMOTES_PYN([$1 - Python3 (multiple remotes)], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with tcp6
-m4_define([OVSDB_CHECK_IDL_TCP6_PYN],
- [AT_SETUP([$1 - tcp6])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_TCP6_PY],
+ [AT_SETUP([$1 - Python3 - tcp6])
AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_SKIP_IF([test $HAVE_IPV6 = no])
AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
@@ -214,22 +185,15 @@ m4_define([OVSDB_CHECK_IDL_TCP6_PYN],
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema tcp:[[::1]]:$TCP_PORT $3],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
[0], [$4])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_TCP6_PY],
- [OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_TCP6_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
-m4_define([OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PYN],
- [AT_SETUP([$1 - tcp6])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PY],
+ [AT_SETUP([$1 - Python3 - tcp6])
AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_SKIP_IF([test $HAVE_IPV6 = no])
AT_KEYWORDS([ovsdb server idl positive Python with tcp6 socket $5])
@@ -240,25 +204,18 @@ m4_define([OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PYN],
remote="tcp:[[::1]]:$WRONG_PORT_1,tcp:[[::1]]:$TCP_PORT,tcp:[[::1]]:$WRONG_PORT_2"
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact "tcp:[[::1]]:$TCP_PORT" $2], [0], [ignore], [ignore])])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t20 idl $srcdir/idltest.ovsschema $remote $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t20 idl $srcdir/idltest.ovsschema $remote $3],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
[0], [$4])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PY],
- [OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PYN([$1 - Python2 (multiple remotes)], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON], [$PYTHON])
- OVSDB_CHECK_IDL_TCP6_MULTIPLE_REMOTES_PYN([$1 - Python3 (multiple remotes)], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
# same as OVSDB_CHECK_IDL but uses the Python IDL implementation with SSL
-m4_define([OVSDB_CHECK_IDL_SSL_PYN],
- [AT_SETUP([$1 - SSL])
+m4_define([OVSDB_CHECK_IDL_SSL_PY],
+ [AT_SETUP([$1 - Python3 - SSL])
AT_SKIP_IF([test "$HAVE_OPENSSL" = no])
- AT_SKIP_IF([test $7 = no])
- $8 -c "import OpenSSL.SSL"
+ $PYTHON3 -c "import OpenSSL.SSL"
SSL_PRESENT=$?
AT_SKIP_IF([test $SSL_PRESENT != 0])
AT_KEYWORDS([ovsdb server idl positive Python with ssl socket $5])
@@ -279,7 +236,7 @@ m4_define([OVSDB_CHECK_IDL_SSL_PYN],
--certificate=$PKIDIR/testpki-cert2.pem \
--ca-cert=$PKIDIR/testpki-cacert.pem \
transact "ssl:127.0.0.1:$TCP_PORT" $2], [0], [ignore], [ignore])])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema \
ssl:127.0.0.1:$TCP_PORT $PKIDIR/testpki-privkey.pem \
$PKIDIR/testpki-cert.pem $PKIDIR/testpki-cacert.pem $3],
[0], [stdout], [ignore])
@@ -288,12 +245,6 @@ m4_define([OVSDB_CHECK_IDL_SSL_PYN],
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_SSL_PY],
- [OVSDB_CHECK_IDL_SSL_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON], [$PYTHON])
- OVSDB_CHECK_IDL_SSL_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
m4_define([OVSDB_CHECK_IDL],
[OVSDB_CHECK_IDL_C($@)
OVSDB_CHECK_IDL_TCP_C($@)
@@ -307,9 +258,8 @@ m4_define([OVSDB_CHECK_IDL],
OVSDB_CHECK_IDL_SSL_PY($@)])
# This test uses the Python IDL implementation with passive tcp
-m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PYN],
- [AT_SETUP([$1 ptcp])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY],
+ [AT_SETUP([$1 - Python3 - ptcp])
AT_KEYWORDS([ovsdb server idl positive Python with tcp socket $5])
# find free TCP port
AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
@@ -319,7 +269,7 @@ m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PYN],
# start OVSDB server in passive mode
AT_CHECK([ovsdb_start_idltest "tcp:127.0.0.1:$TCP_PORT"])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl_passive $srcdir/idltest.ovsschema ptcp:127.0.0.1:$TCP_PORT $3],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
[0], [$4])
@@ -327,12 +277,6 @@ m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PYN],
AT_CLEANUP
])
-m4_define([OVSDB_CHECK_IDL_PASSIVE_TCP_PY],
- [OVSDB_CHECK_IDL_PASSIVE_TCP_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_PASSIVE_TCP_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
OVSDB_CHECK_IDL_PASSIVE_TCP_PY([simple passive idl, initially empty, select empty],
[],
[['["idltest",{"op":"select","table":"link1","where":[]}]']],
@@ -501,14 +445,13 @@ OVSDB_CHECK_IDL([simple idl, writing via IDL with unicode],
003: done
]])
-m4_define([OVSDB_CHECK_IDL_PYN_WITH_EXPOUT],
- [AT_SETUP([$1])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_PY_WITH_EXPOUT],
+ [AT_SETUP([$1 - Python3])
AT_KEYWORDS([ovsdb server idl positive Python $5])
AT_CHECK([ovsdb_start_idltest])
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $3],
[0], [stdout], [ignore])
echo "$4" > expout
AT_CHECK([sort stdout | uuidfilt]m4_if([$6],,, [[| $6]]),
@@ -516,12 +459,6 @@ m4_define([OVSDB_CHECK_IDL_PYN_WITH_EXPOUT],
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_PY_WITH_EXPOUT],
- [OVSDB_CHECK_IDL_PYN_WITH_EXPOUT([$1 - Python2], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_PYN_WITH_EXPOUT([$1 - Python3], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
OVSDB_CHECK_IDL_PY_WITH_EXPOUT([simple idl, writing large data via IDL with unicode],
[['["idltest",
{"op": "insert",
@@ -1036,26 +973,19 @@ AT_CHECK([grep '"monitor\|monitor_cond"' stderr | grep -c '"ua"'], [0], [1
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP
-m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN],
- [AT_SETUP([$1 fetch])
- AT_SKIP_IF([test $8 = no])
+m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY],
+ [AT_SETUP([$1 - Python3 - fetch])
AT_KEYWORDS([ovsdb server idl positive Python increment fetch $6])
AT_CHECK([ovsdb_start_idltest])
m4_if([$2], [], [],
[AT_CHECK([ovsdb-client transact unix:socket $2], [0], [ignore], [ignore])])
- AT_CHECK([$9 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket [$3] $4],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$7],,, [[| $7]]),
[0], [$5])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS_PY],
- [OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN([$1 - Python2], [$2], [$3], [$4], [$5], [$6], [$7],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_FETCH_COLUMNS_PYN([$1 - Python3], [$2], [$3], [$4], [$5], [$6], [$7],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
m4_define([OVSDB_CHECK_IDL_FETCH_COLUMNS],
[OVSDB_CHECK_IDL_FETCH_COLUMNS_PY($@)])
@@ -1087,26 +1017,18 @@ OVSDB_CHECK_IDL_FETCH_COLUMNS([simple idl, initially populated],
003: done
]])
-m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN],
- [AT_SETUP([$1])
- AT_SKIP_IF([test $6 = no])
+m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY],
+ [AT_SETUP([$1 - Python3])
AT_KEYWORDS([ovsdb server idl Python monitor $4])
AT_CHECK([ovsdb_start_idltest])
AT_CHECK([ovs-appctl -t ovsdb-server ovsdb-server/disable-monitor-cond])
- AT_CHECK([$7 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t10 idl $srcdir/idltest.ovsschema unix:socket $2],
[0], [stdout], [ignore])
AT_CHECK([sort stdout | uuidfilt]m4_if([$5],,, [[| $5]]),
[0], [$3])
OVSDB_SERVER_SHUTDOWN
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND_PY],
- [OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN([$1 - Python2], [$2], [$3], [$4], [$5],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_WO_MONITOR_COND_PYN([$1 - Python3], [$2], [$3], [$4], [$5],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
-
m4_define([OVSDB_CHECK_IDL_WO_MONITOR_COND],
[OVSDB_CHECK_IDL_WO_MONITOR_COND_PY($@)])
@@ -1426,28 +1348,9 @@ OVSDB_CHECK_IDL_PY([partial-set idl],
015: done
]])
-m4_define([OVSDB_CHECK_IDL_NOTIFY_PYN],
- [OVSDB_CHECK_IDL_PYN([$1], [], [$2], [$3], [notify $4], [$5], [$6], [$7])])
-
-m4_define([OVSDB_CHECK_IDL_NOTIFY_PY],
- [OVSDB_CHECK_IDL_NOTIFY_PYN([$1 - Python2], [$2], [$3], [$4], [$5],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_NOTIFY_PYN([$1 - Python3], [$2], [$3], [$4], [$5],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
-# This test uses the Python IDL implementation with ssl
-m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PYN],
- [OVSDB_CHECK_IDL_SSL_PYN([$1], [], [$2], [$3], [notify $4], [$5], [$6], [$7])])
-
-m4_define([OVSDB_CHECK_IDL_NOTIFY_SSL_PY],
- [OVSDB_CHECK_IDL_NOTIFY_SSL_PYN([$1 - Python2], [$2], [$3], [$4], [$5],
- [$HAVE_PYTHON2], [$PYTHON2])
- OVSDB_CHECK_IDL_NOTIFY_SSL_PYN([$1 - Python3], [$2], [$3], [$4], [$5],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
m4_define([OVSDB_CHECK_IDL_NOTIFY],
- [OVSDB_CHECK_IDL_NOTIFY_PY($@)
- OVSDB_CHECK_IDL_NOTIFY_SSL_PY($@)])
+ [OVSDB_CHECK_IDL_PY([$1], [], [$2], [$3], [notify $4], [$5])
+ OVSDB_CHECK_IDL_SSL_PY([$1], [], [$2], [$3], [notify $4], [$5])])
OVSDB_CHECK_IDL_NOTIFY([simple idl verify notify],
[['track-notify' \
@@ -1878,8 +1781,7 @@ CHECK_STREAM_OPEN_BLOCK([tcp], [127.0.0.1])
CHECK_STREAM_OPEN_BLOCK([tcp6], [[[::1]]])
m4_define([CHECK_STREAM_OPEN_BLOCK_PY],
- [AT_SETUP([$1])
- AT_SKIP_IF([test $2 = no])
+ [AT_SETUP([$1 - Python3])
AT_KEYWORDS([Check PY Stream open block - $3])
AT_CHECK([ovsdb_start_idltest "ptcp:0:127.0.0.1"])
PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
@@ -1890,14 +1792,10 @@ m4_define([CHECK_STREAM_OPEN_BLOCK_PY],
AT_CHECK([$3 $srcdir/test-stream.py tcp:127.0.0.1:$TCP_PORT], [1], [ignore])
AT_CLEANUP])
-CHECK_STREAM_OPEN_BLOCK_PY([Check PY2 Stream open block], [$HAVE_PYTHON2], [$PYTHON2])
-CHECK_STREAM_OPEN_BLOCK_PY([Check PY3 Stream open block], [$HAVE_PYTHON3], [$PYTHON3])
-
# same as OVSDB_CHECK_IDL but uses Python IDL implementation with tcp
# with multiple remotes to assert the idl connects to the leader of the Raft cluster
-m4_define([OVSDB_CHECK_IDL_LEADER_ONLY_PYN],
- [AT_SETUP([$1])
- AT_SKIP_IF([test $7 = no])
+m4_define([OVSDB_CHECK_IDL_LEADER_ONLY_PY],
+ [AT_SETUP([$1 - Python3 (leader only)])
AT_KEYWORDS([ovsdb server idl Python leader_only with tcp socket])
m4_define([LPBK],[127.0.0.1])
AT_CHECK([ovsdb_cluster_start_idltest $2 "ptcp:0:"LPBK])
@@ -1907,18 +1805,12 @@ m4_define([OVSDB_CHECK_IDL_LEADER_ONLY_PYN],
remotes=tcp:LPBK:$TCP_PORT_1,tcp:LPBK:$TCP_PORT_2,tcp:LPBK:$TCP_PORT_3
pids=$(cat s2.pid s3.pid s1.pid | tr '\n' ',')
echo $pids
- AT_CHECK([$8 $srcdir/test-ovsdb.py -t30 idl-cluster $srcdir/idltest.ovsschema $remotes $pids $3],
+ AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py -t30 idl-cluster $srcdir/idltest.ovsschema $remotes $pids $3],
[0], [stdout], [ignore])
remote=$(ovsdb_cluster_leader $remotes "idltest")
leader=$(echo $remote | cut -d'|' -f 1)
AT_CHECK([grep -F -- "${leader}" stdout], [0], [ignore])
AT_CLEANUP])
-m4_define([OVSDB_CHECK_IDL_LEADER_ONLY_PY],
- [OVSDB_CHECK_IDL_LEADER_ONLY_PYN([$1 - Python2 (leader only)], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON], [$PYTHON])
- OVSDB_CHECK_IDL_LEADER_ONLY_PYN([$1 - Python3 (leader only)], [$2], [$3], [$4], [$5], [$6],
- [$HAVE_PYTHON3], [$PYTHON3])])
-
OVSDB_CHECK_IDL_LEADER_ONLY_PY([Check Python IDL connects to leader], 3, ['remote'])
OVSDB_CHECK_IDL_LEADER_ONLY_PY([Check Python IDL reconnects to leader], 3, ['remote' '+remotestop' 'remote'])
diff --git a/tests/ovsdb-macros.at b/tests/ovsdb-macros.at
index 638894794..1613642d5 100644
--- a/tests/ovsdb-macros.at
+++ b/tests/ovsdb-macros.at
@@ -27,25 +27,6 @@ m4_define([OVSDB_CHECK_POSITIVE],
AT_CLEANUP])
# OVSDB_CHECK_POSITIVE_PY(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ],
-# [PY-CHECK])
-#
-# Runs "test-ovsdb.py TEST-OVSDB-ARGS" and checks that it exits with
-# status 0 and prints OUTPUT on stdout.
-#
-# PY-CHECK is expanded before the check. It can check for features of the
-# Python implementation that are required for the test to pass.
-#
-# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
-m4_define([OVSDB_CHECK_POSITIVE_PY],
- [AT_SETUP([$1])
- AT_SKIP_IF([test $HAVE_PYTHON2 = no])
- $6
- AT_KEYWORDS([ovsdb positive Python $4])
- AT_CHECK([$PYTHON2 $srcdir/test-ovsdb.py $2], [0], [$3
-], [])
- AT_CLEANUP])
-
-# OVSDB_CHECK_POSITIVE_PY3(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ],
# [PY-CHECK])
#
# Runs "test-ovsdb.py TEST-OVSDB-ARGS" and checks that it exits with
@@ -55,9 +36,8 @@ m4_define([OVSDB_CHECK_POSITIVE_PY],
# Python implementation that are required for the test to pass.
#
# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
-m4_define([OVSDB_CHECK_POSITIVE_PY3],
+m4_define([OVSDB_CHECK_POSITIVE_PY],
[AT_SETUP([$1])
- AT_SKIP_IF([test $HAVE_PYTHON3 = no])
$6
AT_KEYWORDS([ovsdb positive Python $4])
AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py $2], [0], [$3
@@ -65,13 +45,12 @@ m4_define([OVSDB_CHECK_POSITIVE_PY3],
AT_CLEANUP])
# OVSDB_CHECK_POSITIVE_CPY(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS],
-# [PREREQ], [PY2-CHECK], [PY3-CHECK])
+# [PREREQ], [PY3-CHECK])
#
# Runs identical C and Python tests, as specified.
m4_define([OVSDB_CHECK_POSITIVE_CPY],
[OVSDB_CHECK_POSITIVE([$1 - C], [$2], [$3], [$4], [$5])
- OVSDB_CHECK_POSITIVE_PY([$1 - Python2], [$2], [$3], [$4], [$5], [$6])
- OVSDB_CHECK_POSITIVE_PY3([$1 - Python3], [$2], [$3], [$4], [$5], [$7])])
+ OVSDB_CHECK_POSITIVE_PY([$1 - Python3], [$2], [$3], [$4], [$5], [$7])])
# OVSDB_CHECK_NEGATIVE(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ])
#
@@ -100,28 +79,6 @@ m4_define([OVSDB_CHECK_NEGATIVE],
# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
m4_define([OVSDB_CHECK_NEGATIVE_PY],
[AT_SETUP([$1])
- AT_SKIP_IF([test $HAVE_PYTHON2 = no])
- AT_KEYWORDS([ovsdb negative $4])
- AT_CHECK([$PYTHON2 $srcdir/test-ovsdb.py $2], [1], [], [stderr])
- m4_assert(m4_len([$3]))
- AT_CHECK(
- [if grep -F -e "AS_ESCAPE([$3])" stderr
- then
- :
- else
- exit 99
- fi],
- [0], [ignore], [ignore])
- AT_CLEANUP])
-
-# OVSDB_CHECK_NEGATIVE_PY3(TITLE, TEST-OVSDB-ARGS, OUTPUT, [KEYWORDS], [PREREQ])
-#
-# Runs "test-ovsdb TEST-OVSDB-ARGS" and checks that it exits with
-# status 1 and that its output on stdout contains substring OUTPUT.
-# TITLE is provided to AT_SETUP and KEYWORDS to AT_KEYWORDS.
-m4_define([OVSDB_CHECK_NEGATIVE_PY],
- [AT_SETUP([$1])
- AT_SKIP_IF([test $HAVE_PYTHON3 = no])
AT_KEYWORDS([ovsdb negative $4])
AT_CHECK([$PYTHON3 $srcdir/test-ovsdb.py $2], [1], [], [stderr])
m4_assert(m4_len([$3]))
@@ -141,8 +98,7 @@ m4_define([OVSDB_CHECK_NEGATIVE_PY],
# Runs identical C and Python tests, as specified.
m4_define([OVSDB_CHECK_NEGATIVE_CPY],
[OVSDB_CHECK_NEGATIVE([$1 - C], [$2], [$3], [$4], [$5])
- OVSDB_CHECK_NEGATIVE_PY([$1 - Python2], [$2], [$3], [$4], [$5])
- OVSDB_CHECK_NEGATIVE_PY3([$1 - Python3], [$2], [$3], [$4], [$5])])
+ OVSDB_CHECK_NEGATIVE_PY([$1 - Python3], [$2], [$3], [$4], [$5])])
OVS_START_SHELL_HELPERS
ovsdb_client_wait() {
diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at
index eb437092c..3b622b3ec 100644
--- a/tests/ovsdb-monitor.at
+++ b/tests/ovsdb-monitor.at
@@ -30,7 +30,7 @@ ovsdb_check_monitor () {
done
OVS_APP_EXIT_AND_WAIT_BY_TARGET([ovsdb-server], [ovsdb-server.pid])
OVS_WAIT_UNTIL([test ! -e ovsdb-client.pid])
- AT_CHECK_UNQUOTED([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [$output], [ignore])
+ AT_CHECK_UNQUOTED([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [$output], [ignore])
}
OVS_END_SHELL_HELPERS
@@ -105,7 +105,7 @@ m4_define([OVSDB_CHECK_MONITOR_COND],
[ignore], [ignore])
AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
- AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [$7], [ignore])
+ AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [$7], [ignore])
AT_CLEANUP])
OVSDB_CHECK_MONITOR([monitor insert into empty table],
@@ -649,7 +649,7 @@ AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
[ignore], [ignore])
AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
-AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [[row,action,name
+AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0], [[row,action,name
<0>,insert,"""ten"""
row,action,name
@@ -701,7 +701,7 @@ AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
[ignore], [ignore])
AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
-AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
+AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
[[found: false, last_id: <0>
row,action,name,number,_version
<1>,initial,"""one""",1,"[""uuid"",""<2>""]"
@@ -770,7 +770,7 @@ AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
[ignore], [ignore])
AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
-AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
+AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
[[found: true, last_id: <0>
row,action,name,number,_version
<1>,insert,"""ten""",10,"[""uuid"",""<2>""]"
@@ -814,7 +814,7 @@ AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
[ignore], [ignore])
AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
-AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
+AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
[[found: true, last_id: <0>
]], [ignore])
AT_CLEANUP
@@ -837,7 +837,7 @@ AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
[ignore], [ignore])
AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
-AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
+AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
[[found: false, last_id: <0>
]], [ignore])
AT_CLEANUP
@@ -876,7 +876,7 @@ AT_CHECK([ovsdb-client transact unix:socket '[["ordinals"]]'], [0],
[ignore], [ignore])
AT_CHECK([ovs-appctl -t ovsdb-server -e exit], [0], [ignore], [ignore])
OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
-AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
+AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
[[found: false, last_id: <0>
row,action,name,number,_version
<1>,initial,"""one""",1,"[""uuid"",""<2>""]"
@@ -945,7 +945,7 @@ OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
# Transaction shouldn't be found, and last_id returned should always
# be the same (all zero uuid)
-AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
+AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
[[found: false, last_id: <0>
row,action,name,number,_version
<1>,initial,"""one""",1,"[""uuid"",""<2>""]"
@@ -1000,7 +1000,7 @@ OVS_WAIT_UNTIL([test ! -e ovsdb-server.pid && test ! -e ovsdb-client.pid])
# Transaction shouldn't be found, and last_id returned should always
# be the same (all zero uuid)
-AT_CHECK([$PYTHON $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
+AT_CHECK([$PYTHON3 $srcdir/ovsdb-monitor-sort.py < output | uuidfilt], [0],
[[found: false, last_id: <0>
row,action,name,number,_version
<1>,initial,"""one""",1,"[""uuid"",""<2>""]"
diff --git a/tests/reconnect.at b/tests/reconnect.at
index ecd76cbc5..2631658be 100644
--- a/tests/reconnect.at
+++ b/tests/reconnect.at
@@ -2,28 +2,19 @@ AT_BANNER([reconnect library])
m4_define([__RECONNECT_CHECK],
[AT_SETUP([$1])
- $2
AT_KEYWORDS([reconnect])
- AT_DATA([input], [$3])
- AT_CHECK([$4], [0], [$5])
+ AT_DATA([input], [$2])
+ AT_CHECK([$3], [0], [$4])
AT_CLEANUP])
m4_define([RECONNECT_CHECK],
[__RECONNECT_CHECK(
[$1 - C],
- [],
[$2],
[ovstest test-reconnect < input],
[$3])
__RECONNECT_CHECK(
- [$1 - Python2],
- [AT_SKIP_IF([test $HAVE_PYTHON2 = no])],
- [$2],
- [$PYTHON2 $srcdir/test-reconnect.py < input],
- [$3])
- __RECONNECT_CHECK(
[$1 - Python3],
- [AT_SKIP_IF([test $HAVE_PYTHON3 = no])],
[$2],
[$PYTHON3 $srcdir/test-reconnect.py < input],
[$3])])
diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 64bf5ec63..68c8774d1 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -267,7 +267,7 @@ m4_define([OVS_CHECK_FIREWALL],
#
m4_define([OVS_START_L7],
[PIDFILE=$(mktemp $2XXX.pid)
- NETNS_DAEMONIZE([$1], [[$PYTHON $srcdir/test-l7.py $2]], [$PIDFILE])
+ NETNS_DAEMONIZE([$1], [[$PYTHON3 $srcdir/test-l7.py $2]], [$PIDFILE])
dnl netstat doesn't print http over IPv6 as "http6"; drop the number.
PROTO=$(echo $2 | sed -e 's/\([[a-zA-Z]]*\).*/\1/')
diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at
index 75b59ae66..283898f81 100644
--- a/tests/system-kmod-macros.at
+++ b/tests/system-kmod-macros.at
@@ -59,8 +59,7 @@ m4_define([CONFIGURE_VETH_OFFLOADS],
# kernel conntrack tables when the test is finished.
#
m4_define([CHECK_CONNTRACK],
- [AT_SKIP_IF([test $HAVE_PYTHON = no])
- m4_foreach([mod], [[nf_conntrack_ipv4], [nf_conntrack_ipv6], [nf_nat_ftp],
+ [m4_foreach([mod], [[nf_conntrack_ipv4], [nf_conntrack_ipv6], [nf_nat_ftp],
[nf_nat_tftp]],
[modprobe mod || echo "Module mod not loaded."
on_exit 'modprobe -r mod'
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index bfc6bb5b4..146d671fb 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -3590,8 +3590,8 @@ table=0,action=normal
AT_CHECK([ovs-ofctl --bundle replace-flows br0 flows.txt])
-NETNS_DAEMONIZE([at_ns0], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp1.pid])
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
+NETNS_DAEMONIZE([at_ns0], [[$PYTHON3 $srcdir/test-l7.py ftp]], [ftp1.pid])
+NETNS_DAEMONIZE([at_ns1], [[$PYTHON3 $srcdir/test-l7.py ftp]], [ftp0.pid])
OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp])
dnl FTP requests from p0->p1 should work fine.
@@ -5357,7 +5357,7 @@ dnl waiting, we get occasional failures due to the following error:
dnl "connect: Cannot assign requested address"
OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2 >/dev/null])
-NETNS_DAEMONIZE([at_ns1], [[$PYTHON $srcdir/test-l7.py ftp]], [ftp0.pid])
+NETNS_DAEMONIZE([at_ns1], [[$PYTHON3 $srcdir/test-l7.py ftp]], [ftp0.pid])
OVS_WAIT_UNTIL([ip netns exec at_ns1 netstat -l | grep ftp])
dnl FTP requests from p0->p1 should work fine.
@@ -6008,7 +6008,7 @@ sleep 1
dnl The hex dump is a TCP syn packet. pkt=eth/ip/tcp
dnl The packet is sent from p0(at_ns0) interface directed to
dnl p1(at_ns1) interface
-NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
+NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
dnl Check the expected nsh encapsulated packet on the egress interface
OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *0fc6" 2>&1 1>/dev/null])
@@ -6040,7 +6040,7 @@ sleep 1
dnl The hex dump is NSH packet with TCP syn payload. pkt=eth/nsh/eth/ip/tcp
dnl The packet is sent from p0(at_ns0) interface directed to
dnl p1(at_ns1) interface
-NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 00 64 03 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
+NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 00 64 03 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
dnl Check the expected de-capsulated TCP packet on the egress interface
OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0000: *f200 *0000 *0002 *f200 *0000 *0001 *0800 *4500" 2>&1 1>/dev/null])
@@ -6073,7 +6073,7 @@ dnl The hex dump is NSH packet with TCP syn payload. pkt=eth/nsh/eth/ip/tcp
dnl The nsh_ttl is 8, nsh_spi is 0x100 and nsh_si is 3
dnl The packet is sent from p0(at_ns0) interface directed to
dnl p1(at_ns1) interface
-NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 01 00 03 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
+NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 01 00 03 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
dnl Check the expected NSH packet with new fields in the header
OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000* 0001 *894f *01c6" 2>&1 1>/dev/null])
@@ -6107,7 +6107,7 @@ NS_CHECK_EXEC([at_ns2], [tcpdump -l -n -xx -U -i p2 > p2.pcap &])
sleep 1
dnl First send packet from at_ns0 --> OVS with SPI=0x100 and SI=2
-NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 01 00 02 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
+NS_CHECK_EXEC([at_ns0], [$PYTHON3 $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 02 06 01 03 00 01 00 02 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
dnl Check for the above packet on p1 interface
OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *0206" 2>&1 1>/dev/null])
@@ -6118,7 +6118,7 @@ OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0040: *c0a8 *000a *0a00 *000a *0400 *0800
OVS_WAIT_UNTIL([cat p1.pcap | egrep "0x0050: *0000 *0000 *5002 *2000 *b85e *0000" 2>&1 1>/dev/null])
dnl Send the second packet from at_ns1 --> OVS with SPI=0x100 and SI=1
-NS_CHECK_EXEC([at_ns1], [$PYTHON $srcdir/sendpkt.py p1 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 01 c6 01 03 00 01 00 01 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
+NS_CHECK_EXEC([at_ns1], [$PYTHON3 $srcdir/sendpkt.py p1 f2 ff 00 00 00 02 f2 ff 00 00 00 01 89 4f 01 c6 01 03 00 01 00 01 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 f2 00 00 00 00 02 f2 00 00 00 00 01 08 00 45 00 00 28 00 01 00 00 40 06 b0 13 c0 a8 00 0a 0a 00 00 0a 04 00 08 00 00 00 00 c8 00 00 00 00 50 02 20 00 b8 5e 00 00 > /dev/null])
dnl Check for the above packet on p2 interface
OVS_WAIT_UNTIL([cat p2.pcap | egrep "0x0000: *f2ff *0000 *0002 *f2ff *0000 *0001 *894f *01c6" 2>&1 1>/dev/null])
diff --git a/tests/system-userspace-macros.at b/tests/system-userspace-macros.at
index 0a21db88a..5d3b8b8e0 100644
--- a/tests/system-userspace-macros.at
+++ b/tests/system-userspace-macros.at
@@ -64,9 +64,7 @@ m4_define([CONFIGURE_VETH_OFFLOADS],
#
# Perform requirements checks for running conntrack tests.
#
-m4_define([CHECK_CONNTRACK],
- [AT_SKIP_IF([test $HAVE_PYTHON = no])]
-)
+m4_define([CHECK_CONNTRACK], [])
# CHECK_CONNTRACK_ALG()
#
diff --git a/tests/unixctl-py.at b/tests/unixctl-py.at
index 5c28e2c01..724006118 100644
--- a/tests/unixctl-py.at
+++ b/tests/unixctl-py.at
@@ -1,122 +1,98 @@
AT_BANNER([unixctl])
m4_define([APPCTL], [ovs-appctl --timeout 20])
-m4_define([PYAPPCTL_PYN], [$1 $srcdir/appctl.py --timeout 20])
+m4_define([PYAPPCTL_PY], [$PYTHON3 $srcdir/appctl.py --timeout 20])
-m4_define([UNIXCTL_EXIT_PYN],
- [AT_SETUP([unixctl ovs-vswitchd exit - $1])
- AT_SKIP_IF([test $2 = no])
- AT_KEYWORDS([python unixctl])
- OVS_VSWITCHD_START
+AT_SETUP([unixctl ovs-vswitchd exit - Python3])
+AT_KEYWORDS([python unixctl])
+OVS_VSWITCHD_START
- AT_CHECK([PYAPPCTL_PYN([$3]) -t ovs-vswitchd exit], [0], [])
- OVS_WAIT_WHILE([test -s ovs-vswitchd.pid])
+AT_CHECK([PYAPPCTL_PY -t ovs-vswitchd exit], [0], [])
+OVS_WAIT_WHILE([test -s ovs-vswitchd.pid])
- AT_CHECK([PYAPPCTL_PYN([$3]) -t ovsdb-server exit], [0], [])
- OVS_WAIT_WHILE([test -s ovsdb-server.pid])
- AT_CLEANUP])
+AT_CHECK([PYAPPCTL_PY -t ovsdb-server exit], [0], [])
+OVS_WAIT_WHILE([test -s ovsdb-server.pid])
+AT_CLEANUP
-UNIXCTL_EXIT_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-UNIXCTL_EXIT_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_SETUP([unixctl ovs-vswitchd list-commands - Python3])
+OVS_VSWITCHD_START
-m4_define([UNIXCTL_LIST_COMMANDS_PYN],
- [AT_SETUP([unixctl ovs-vswitchd list-commands - $1])
- AT_SKIP_IF([test $2 = no])
- OVS_VSWITCHD_START
-
- AT_CHECK([APPCTL list-commands], [0], [stdout])
- AT_CHECK([head -1 stdout], [0], [dnl
+AT_CHECK([APPCTL list-commands], [0], [stdout])
+AT_CHECK([head -1 stdout], [0], [dnl
The available commands are:
])
- mv stdout expout
- AT_CHECK([PYAPPCTL_PYN([$3]) list-commands], [0], [expout])
-
- OVS_VSWITCHD_STOP
- AT_CLEANUP])
+mv stdout expout
+AT_CHECK([PYAPPCTL_PY list-commands], [0], [expout])
-UNIXCTL_LIST_COMMANDS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-UNIXCTL_LIST_COMMANDS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+OVS_VSWITCHD_STOP
+AT_CLEANUP]
-m4_define([UNIXCTL_ARGS_PYN],
- [AT_SETUP([unixctl ovs-vswitchd arguments - $1])
- AT_SKIP_IF([test $2 = no])
- OVS_VSWITCHD_START
+AT_SETUP([unixctl ovs-vswitchd arguments - Python3])
+OVS_VSWITCHD_START
- AT_CHECK([APPCTL bond/hash], [2], [], [stderr])
- AT_CHECK([head -1 stderr], [0], [dnl
+AT_CHECK([APPCTL bond/hash], [2], [], [stderr])
+AT_CHECK([head -1 stderr], [0], [dnl
"bond/hash" command requires at least 1 arguments
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) bond/hash], [2], [], [experr])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY bond/hash], [2], [], [experr])
- AT_CHECK([APPCTL bond/hash mac], [2], [], [stderr])
- AT_CHECK([head -1 stderr], [0], [dnl
+AT_CHECK([APPCTL bond/hash mac], [2], [], [stderr])
+AT_CHECK([head -1 stderr], [0], [dnl
invalid mac
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) bond/hash mac], [2], [], [experr])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY bond/hash mac], [2], [], [experr])
- AT_CHECK([APPCTL bond/hash mac vlan], [2], [], [stderr])
- AT_CHECK([head -1 stderr], [0], [dnl
+AT_CHECK([APPCTL bond/hash mac vlan], [2], [], [stderr])
+AT_CHECK([head -1 stderr], [0], [dnl
invalid vlan
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) bond/hash mac vlan], [2], [], [experr])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY bond/hash mac vlan], [2], [], [experr])
- AT_CHECK([APPCTL bond/hash mac vlan basis], [2], [], [stderr])
- AT_CHECK([head -1 stderr], [0], [dnl
+AT_CHECK([APPCTL bond/hash mac vlan basis], [2], [], [stderr])
+AT_CHECK([head -1 stderr], [0], [dnl
invalid vlan
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) bond/hash vlan basis], [2], [], [experr])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY bond/hash vlan basis], [2], [], [experr])
- AT_CHECK([APPCTL bond/hash mac vlan basis extra], [2], [], [stderr])
- AT_CHECK([head -1 stderr], [0], [dnl
+AT_CHECK([APPCTL bond/hash mac vlan basis extra], [2], [], [stderr])
+AT_CHECK([head -1 stderr], [0], [dnl
"bond/hash" command takes at most 3 arguments
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) bond/hash mac vlan basis extra], [2], [], [experr])
-
- OVS_VSWITCHD_STOP
- AT_CLEANUP])
-
-UNIXCTL_ARGS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-UNIXCTL_ARGS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY bond/hash mac vlan basis extra], [2], [], [experr])
-m4_define([UNIXCTL_BAD_TARGET_PYN],
- [AT_SETUP([unixctl bad target - $1])
- AT_SKIP_IF([test $2 = no])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
- AT_CHECK([PYAPPCTL_PYN([$3]) -t bogus doit], [1], [], [stderr])
- AT_CHECK_UNQUOTED([tail -1 stderr], [0], [dnl
+AT_SETUP([unixctl bad target - Python3])
+AT_CHECK([PYAPPCTL_PY -t bogus doit], [1], [], [stderr])
+AT_CHECK_UNQUOTED([tail -1 stderr], [0], [dnl
appctl.py: cannot read pidfile "`pwd`/bogus.pid" (No such file or directory)
])
- if test "$IS_WIN32" = "no"; then
- AT_CHECK([PYAPPCTL_PYN([$3]) -t /bogus/path.pid doit], [1], [], [stderr])
- AT_CHECK([tail -1 stderr], [0], [dnl
+if test "$IS_WIN32" = "no"; then
+ AT_CHECK([PYAPPCTL_PY -t /bogus/path.pid doit], [1], [], [stderr])
+ AT_CHECK([tail -1 stderr], [0], [dnl
appctl.py: cannot connect to "/bogus/path.pid" (No such file or directory)
])
- else
- AT_CHECK([PYAPPCTL_PYN([$3]) -t c:/bogus/path.pid doit], [1], [], [stderr])
- AT_CHECK([tail -1 stderr], [0], [dnl
+else
+ AT_CHECK([PYAPPCTL_PY -t c:/bogus/path.pid doit], [1], [], [stderr])
+ AT_CHECK([tail -1 stderr], [0], [dnl
appctl.py: cannot connect to "c:/bogus/path.pid" (No such file or directory)
])
- fi
+fi
+AT_CLEANUP
- AT_CLEANUP])
+AT_SETUP([unixctl server - Python3])
+on_exit 'kill `cat test-unixctl.py.pid`'
+AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
+AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --log-file --pidfile --detach --no-chdir])
-UNIXCTL_BAD_TARGET_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-UNIXCTL_BAD_TARGET_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
-
-m4_define([UNIXCTL_SERVER_PYN],
- [AT_SETUP([unixctl server - $1])
- AT_SKIP_IF([test $2 = no])
- on_exit 'kill `cat test-unixctl.py.pid`'
- AT_CAPTURE_FILE([`pwd`/test-unixctl.py.log])
- AT_CHECK([$3 $srcdir/test-unixctl.py --log-file --pidfile --detach --no-chdir])
-
- AT_CHECK([APPCTL -t test-unixctl.py help], [0], [stdout])
- AT_CHECK([cat stdout], [0], [dnl
+AT_CHECK([APPCTL -t test-unixctl.py help], [0], [stdout])
+AT_CHECK([cat stdout], [0], [dnl
The available commands are:
block
echo [[arg ...]]
@@ -130,63 +106,55 @@ The available commands are:
vlog/reopen
vlog/set spec
])
- mv stdout expout
- AT_CHECK([PYAPPCTL_PYN([$3]) -t test-unixctl.py help], [0], [expout])
+mv stdout expout
+AT_CHECK([PYAPPCTL_PY -t test-unixctl.py help], [0], [expout])
- AT_CHECK([ovs-vsctl --version | sed 's/ovs-vsctl/test-unixctl.py/' | head -1 > expout])
- AT_CHECK([APPCTL -t test-unixctl.py version], [0], [expout])
- AT_CHECK([PYAPPCTL_PYN([$3]) -t test-unixctl.py version], [0], [expout])
+AT_CHECK([ovs-vsctl --version | sed 's/ovs-vsctl/test-unixctl.py/' | head -1 > expout])
+AT_CHECK([APPCTL -t test-unixctl.py version], [0], [expout])
+AT_CHECK([PYAPPCTL_PY -t test-unixctl.py version], [0], [expout])
- AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja], [0], [stdout])
- AT_CHECK([cat stdout | sed -e "s/u'/'/g"], [0], [dnl
+AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja], [0], [stdout])
+AT_CHECK([cat stdout | sed -e "s/u'/'/g"], [0], [dnl
[['robot', 'ninja']]
])
- mv stdout expout
- AT_CHECK([PYAPPCTL_PYN([$3]) -t test-unixctl.py echo robot ninja], [0], [expout])
+mv stdout expout
+AT_CHECK([PYAPPCTL_PY -t test-unixctl.py echo robot ninja], [0], [expout])
- AT_CHECK([APPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [stderr])
- AT_CHECK([cat stderr | sed -e "s/u'/'/g"], [0], [dnl
+AT_CHECK([APPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [stderr])
+AT_CHECK([cat stderr | sed -e "s/u'/'/g"], [0], [dnl
[['robot', 'ninja']]
ovs-appctl: test-unixctl.py: server returned an error
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) -t test-unixctl.py echo_error robot ninja], [2], [], [experr])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY -t test-unixctl.py echo_error robot ninja], [2], [], [experr])
- AT_CHECK([APPCTL -t test-unixctl.py echo], [2], [], [stderr])
- AT_CHECK([cat stderr], [0], [dnl
+AT_CHECK([APPCTL -t test-unixctl.py echo], [2], [], [stderr])
+AT_CHECK([cat stderr], [0], [dnl
"echo" command requires at least 1 arguments
ovs-appctl: test-unixctl.py: server returned an error
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) -t test-unixctl.py echo], [2], [], [experr])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY -t test-unixctl.py echo], [2], [], [experr])
- AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [stderr])
- AT_CHECK([cat stderr], [0], [dnl
+AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja pirates], [2], [], [stderr])
+AT_CHECK([cat stderr], [0], [dnl
"echo" command takes at most 2 arguments
ovs-appctl: test-unixctl.py: server returned an error
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) -t test-unixctl.py echo robot ninja pirates], [2], [], [experr])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY -t test-unixctl.py echo robot ninja pirates], [2], [], [experr])
- AT_CHECK([APPCTL -t test-unixctl.py bogus], [2], [], [stderr])
- AT_CHECK([cat stderr], [0], [dnl
+AT_CHECK([APPCTL -t test-unixctl.py bogus], [2], [], [stderr])
+AT_CHECK([cat stderr], [0], [dnl
"bogus" is not a valid command
ovs-appctl: test-unixctl.py: server returned an error
])
- sed 's/ovs-appctl/appctl.py/' stderr > experr
- AT_CHECK([PYAPPCTL_PYN([$3]) -t test-unixctl.py bogus], [2], [], [experr])
-
- AT_CHECK([APPCTL -t test-unixctl.py exit])
- AT_CLEANUP])
-
-UNIXCTL_SERVER_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-UNIXCTL_SERVER_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+sed 's/ovs-appctl/appctl.py/' stderr > experr
+AT_CHECK([PYAPPCTL_PY -t test-unixctl.py bogus], [2], [], [experr])
-m4_define([UNIXCTL_SERVER_ERRORS_PYN],
- [AT_SETUP([unixctl server errors - $1])
- AT_SKIP_IF([test $2 = no])
- AT_CHECK($3 $srcdir/test-unixctl.py --unixctl "`pwd`"/bogus/path, [1], [], [ignore])
- AT_CLEANUP])
+AT_CHECK([APPCTL -t test-unixctl.py exit])
+AT_CLEANUP
-UNIXCTL_SERVER_ERRORS_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-UNIXCTL_SERVER_ERRORS_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_SETUP([unixctl server errors - Python3])
+AT_CHECK($PYTHON3 $srcdir/test-unixctl.py --unixctl "`pwd`"/bogus/path, [1], [], [ignore])
+AT_CLEANUP
diff --git a/tests/vlog.at b/tests/vlog.at
index 2f532a725..3e92e70a9 100644
--- a/tests/vlog.at
+++ b/tests/vlog.at
@@ -1,14 +1,12 @@
AT_BANNER([vlog])
-m4_define([VLOG_PYN],
- [AT_SETUP([vlog - $1])
- AT_SKIP_IF([test $2 = no])
- AT_CAPTURE_FILE([log_file])
- AT_CAPTURE_FILE([stderr_log])
- AT_CHECK([$3 $srcdir/test-vlog.py --log-file log_file \
+AT_SETUP([vlog - Python3])
+AT_CAPTURE_FILE([log_file])
+AT_CAPTURE_FILE([stderr_log])
+AT_CHECK([$PYTHON3 $srcdir/test-vlog.py --log-file log_file \
-v dbg module_1:info module_2:warn syslog:off 2>stderr_log])
- AT_CHECK([sed -e 's/.*-.*-.*T..:..:..Z |//' \
+AT_CHECK([sed -e 's/.*-.*-.*T..:..:..Z |//' \
-e 's/File ".*", line [[0-9]][[0-9]]*,/File <name>, line <number>,/' \
stderr_log], [0], [dnl
0 | module_0 | EMER | emergency
@@ -100,10 +98,7 @@ Traceback (most recent call last):
AssertionError
])
- AT_CLEANUP])
-
-VLOG_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-VLOG_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_CLEANUP
m4_divert_push([PREPARE_TESTS])
vlog_filt () {
@@ -146,37 +141,32 @@ message3
])
AT_CLEANUP
-m4_define([VLOG_REOPEN_PYN],
- [AT_SETUP([vlog - vlog/reopen - $1])
- # This test won't work as-is on Windows because Windows doesn't allow
- # files that are open to be renamed.
- AT_SKIP_IF([test "$IS_WIN32" = "yes"])
- AT_SKIP_IF([test $2 = no])
- on_exit 'kill `cat test-unixctl.py.pid`'
-
- AT_CAPTURE_FILE([log])
- AT_CAPTURE_FILE([log.old])
- AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach --no-chdir])
-
- AT_CHECK([APPCTL -t test-unixctl.py log message])
- mv log log.old
- AT_CHECK([APPCTL -t test-unixctl.py log message2])
- AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
- AT_CHECK([APPCTL -t test-unixctl.py log message3])
- AT_CHECK([APPCTL -t test-unixctl.py exit])
-
- AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
+AT_SETUP([vlog - vlog/reopen - Python3])
+# This test won't work as-is on Windows because Windows doesn't allow
+# files that are open to be renamed.
+AT_SKIP_IF([test "$IS_WIN32" = "yes"])
+on_exit 'kill `cat test-unixctl.py.pid`'
+
+AT_CAPTURE_FILE([log])
+AT_CAPTURE_FILE([log.old])
+AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach --no-chdir])
+
+AT_CHECK([APPCTL -t test-unixctl.py log message])
+mv log log.old
+AT_CHECK([APPCTL -t test-unixctl.py log message2])
+AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
+AT_CHECK([APPCTL -t test-unixctl.py log message3])
+AT_CHECK([APPCTL -t test-unixctl.py exit])
+
+AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
Entering run loop.
message
message2
])
- AT_CHECK([sed 's/.*|//' log], [0], [dnl
+AT_CHECK([sed 's/.*|//' log], [0], [dnl
message3
])
- AT_CLEANUP])
-
-VLOG_REOPEN_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-VLOG_REOPEN_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_CLEANUP
AT_SETUP([vlog - vlog/reopen without log file - C])
on_exit 'kill `cat test-unixctl.pid`'
@@ -190,20 +180,15 @@ ovs-appctl: test-unixctl: server returned an error
OVS_APP_EXIT_AND_WAIT([test-unixctl])
AT_CLEANUP
-m4_define([VLOG_REOPEN_WITHOUT_FILE_PYN],
- [AT_SETUP([vlog - vlog/reopen without log file - $1])
- AT_SKIP_IF([test $2 = no])
- on_exit 'kill `cat test-unixctl.py.pid`'
+AT_SETUP([vlog - vlog/reopen without log file - Python3])
+on_exit 'kill `cat test-unixctl.py.pid`'
- AT_CHECK([$3 $srcdir/test-unixctl.py --pidfile --detach --no-chdir])
+AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --pidfile --detach --no-chdir])
- AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen], [0],
- [Logging to file not configured
+AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen], [0],
+ [Logging to file not configured
])
- AT_CLEANUP])
-
-VLOG_REOPEN_WITHOUT_FILE_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-VLOG_REOPEN_WITHOUT_FILE_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_CLEANUP
dnl This checks that if vlog/reopen can't reopen the log file,
dnl nothing particularly bad (e.g. a crash) happens.
@@ -243,37 +228,32 @@ AT_CLEANUP
dnl This checks that if vlog/reopen can't reopen the log file,
dnl nothing particularly bad (e.g. Python throws an exception and
dnl aborts the program) happens.
-m4_define([VLOG_CANT_REOPEN_PYN],
- [AT_SETUP([vlog - vlog/reopen can't reopen log file - $1])
- AT_SKIP_IF([test $2 = no])
-
- # Verify that /dev/full is a character device that fails writes.
- AT_SKIP_IF([test ! -c /dev/full])
- AT_SKIP_IF([echo > /dev/full])
-
- on_exit 'kill `cat test-unixctl.py.pid`'
-
- AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach --no-chdir])
- AT_CHECK([APPCTL -t test-unixctl.py log message])
- mv log log.old
- ln -s /dev/full log
- AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
- AT_CHECK([APPCTL -t test-unixctl.py log message2])
- rm log
- AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
- AT_CHECK([APPCTL -t test-unixctl.py log message3])
- AT_CHECK([APPCTL -t test-unixctl.py exit])
- AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
+AT_SETUP([vlog - vlog/reopen can't reopen log file - Python3])
+
+# Verify that /dev/full is a character device that fails writes.
+AT_SKIP_IF([test ! -c /dev/full])
+AT_SKIP_IF([echo > /dev/full])
+
+on_exit 'kill `cat test-unixctl.py.pid`'
+
+AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach --no-chdir])
+AT_CHECK([APPCTL -t test-unixctl.py log message])
+mv log log.old
+ln -s /dev/full log
+AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
+AT_CHECK([APPCTL -t test-unixctl.py log message2])
+rm log
+AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
+AT_CHECK([APPCTL -t test-unixctl.py log message3])
+AT_CHECK([APPCTL -t test-unixctl.py exit])
+AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
Entering run loop.
message
])
- AT_CHECK([sed 's/.*|//' log], [0], [dnl
+AT_CHECK([sed 's/.*|//' log], [0], [dnl
message3
])
- AT_CLEANUP])
-
-VLOG_CANT_REOPEN_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-VLOG_CANT_REOPEN_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_CLEANUP
AT_SETUP([vlog - vlog/close - C])
on_exit 'kill `cat test-unixctl.pid`'
@@ -315,44 +295,39 @@ message5
])
AT_CLEANUP
-m4_define([VLOG_CLOSE_PYN],
- [AT_SETUP([vlog - vlog/close - $1])
- AT_SKIP_IF([test $2 = no])
- on_exit 'kill `cat test-unixctl.py.pid`'
+AT_SETUP([vlog - vlog/close - Python3])
+on_exit 'kill `cat test-unixctl.py.pid`'
- AT_CAPTURE_FILE([log])
- AT_CAPTURE_FILE([log.old])
- AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach --no-chdir])
+AT_CAPTURE_FILE([log])
+AT_CAPTURE_FILE([log.old])
+AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach --no-chdir])
- AT_CHECK([APPCTL -t test-unixctl.py log message])
- AT_CHECK([APPCTL -t test-unixctl.py log message2])
+AT_CHECK([APPCTL -t test-unixctl.py log message])
+AT_CHECK([APPCTL -t test-unixctl.py log message2])
- # After closing the log file, message3 won't appear anywhere.
- AT_CHECK([APPCTL -t test-unixctl.py vlog/close])
- mv log log.old
- AT_CHECK([APPCTL -t test-unixctl.py log message3])
+# After closing the log file, message3 won't appear anywhere.
+AT_CHECK([APPCTL -t test-unixctl.py vlog/close])
+mv log log.old
+AT_CHECK([APPCTL -t test-unixctl.py log message3])
- # Closing the log file again is harmless.
- AT_CHECK([APPCTL -t test-unixctl.py vlog/close])
- AT_CHECK([APPCTL -t test-unixctl.py log message4])
+# Closing the log file again is harmless.
+AT_CHECK([APPCTL -t test-unixctl.py vlog/close])
+AT_CHECK([APPCTL -t test-unixctl.py log message4])
- # After reopening the log file, further messages start appearing again.
- AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
- AT_CHECK([APPCTL -t test-unixctl.py log message5])
- AT_CHECK([APPCTL -t test-unixctl.py exit])
+# After reopening the log file, further messages start appearing again.
+AT_CHECK([APPCTL -t test-unixctl.py vlog/reopen])
+AT_CHECK([APPCTL -t test-unixctl.py log message5])
+AT_CHECK([APPCTL -t test-unixctl.py exit])
- AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
+AT_CHECK([sed 's/.*|//' log.old], [0], [dnl
Entering run loop.
message
message2
])
- AT_CHECK([sed 's/.*|//' log], [0], [dnl
+AT_CHECK([sed 's/.*|//' log], [0], [dnl
message5
])
- AT_CLEANUP])
-
-VLOG_CLOSE_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-VLOG_CLOSE_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_CLEANUP
AT_SETUP([vlog - vlog/set and vlog/list - C])
on_exit 'kill `cat test-unixctl.pid`'
@@ -400,15 +375,13 @@ AT_CHECK([grep -q 'I<3OVS' log])
OVS_APP_EXIT_AND_WAIT([test-unixctl])
AT_CLEANUP
-m4_define([VLOG_SET_AND_LIST_PYN],
- [AT_SETUP([vlog - vlog/set and vlog/list - $1])
- AT_SKIP_IF([test $2 = no])
- on_exit 'kill `cat test-unixctl.py.pid`'
+AT_SETUP([vlog - vlog/set and vlog/list - Python3])
+on_exit 'kill `cat test-unixctl.py.pid`'
- AT_CAPTURE_FILE([log])
- AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach --no-chdir])
+AT_CAPTURE_FILE([log])
+AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile --detach --no-chdir])
- AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl
+AT_CHECK([APPCTL -t test-unixctl.py vlog/list], [0], [dnl
console syslog file
------- ------ ------
daemon info info info
@@ -441,19 +414,16 @@ test-unixctl info info dbg
unixctl_server info info dbg
])
- AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern], [0],
+AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern], [0],
[Please supply a valid pattern and destination
])
- AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:nonexistent], [0],
+AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:nonexistent], [0],
[Destination nonexistent does not exist
])
- AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:file:'I<3OVS|%m'])
- AT_CHECK([APPCTL -t test-unixctl.py log patterntest])
- AT_CHECK([grep -q 'I<3OVS' log])
- AT_CLEANUP])
-
-VLOG_SET_AND_LIST_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-VLOG_SET_AND_LIST_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_CHECK([APPCTL -t test-unixctl.py vlog/set pattern:file:'I<3OVS|%m'])
+AT_CHECK([APPCTL -t test-unixctl.py log patterntest])
+AT_CHECK([grep -q 'I<3OVS' log])
+AT_CLEANUP
AT_SETUP([vlog - RFC5424 facility])
on_exit 'kill `cat ovsdb-server.pid`'
@@ -492,24 +462,19 @@ AT_CHECK([tail -1 ovsdb-server.log | awk '{print $1}'], [0], [<191>1
])
AT_CLEANUP
-m4_define([VLOG_RFC5424_PYN],
- [AT_SETUP([vlog - RFC5424 facility - $1])
- AT_SKIP_IF([test $2 = no])
- on_exit 'kill `cat test-unixctl.py.pid`'
+AT_SETUP([vlog - RFC5424 facility - Python3])
+on_exit 'kill `cat test-unixctl.py.pid`'
- AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \
+AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \
-vFACILITY:invalid --detach --no-chdir], [1], [], [test-unixctl.py: processing "FACILITY:invalid": Facility invalid is invalid
])
- AT_CHECK([$3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \
+AT_CHECK([$PYTHON3 $srcdir/test-unixctl.py --log-file=`pwd`/log --pidfile \
-vFACILITY:daemon --detach --no-chdir])
- AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:invalid], [0],
+AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:invalid], [0],
[Facility invalid is invalid
])
- AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:local0])
- AT_CLEANUP])
-
-VLOG_RFC5424_PYN([Python2], [$HAVE_PYTHON2], [$PYTHON2])
-VLOG_RFC5424_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
+AT_CHECK([ovs-appctl -t test-unixctl.py vlog/set FACILITY:local0])
+AT_CLEANUP