[ovs-dev] [PATCH 54/55] tests: Integrate tox with 'make check'.

Russell Bryant russell at ovn.org
Mon Dec 21 20:47:54 UTC 2015


Add a configure script check for tox, so that we can conditionally run
it from 'make check'.  Create tox.at which runs the py27, py34, and pep8
tox environments.

Signed-off-by: Russell Bryant <russell at ovn.org>
---
 configure.ac       |  1 +
 m4/openvswitch.m4  | 14 ++++++++++++++
 tests/atlocal.in   |  1 +
 tests/automake.mk  |  3 ++-
 tests/testsuite.at |  1 +
 tests/tox.at       | 13 +++++++++++++
 6 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 tests/tox.at

diff --git a/configure.ac b/configure.ac
index 65936d8..6295662 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,7 @@ OVS_CHECK_LIBCAPNG
 OVS_CHECK_LOGDIR
 OVS_CHECK_PYTHON
 OVS_CHECK_PYTHON3
+OVS_CHECK_TOX
 OVS_CHECK_DOT
 OVS_CHECK_IF_PACKET
 OVS_CHECK_IF_DL
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 8b3e660..6f3d662 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -399,6 +399,20 @@ else:
    fi
    AM_CONDITIONAL([HAVE_PYTHON3], [test "$HAVE_PYTHON3" = yes])])
 
+dnl Checks for tox.
+AC_DEFUN([OVS_CHECK_TOX],
+  [AC_CACHE_CHECK(
+    [for tox],
+    [ovs_cv_tox],
+    [if (tox --version) >/dev/null 2>&1; then
+       ovs_cv_tox=yes
+       HAVE_TOX=yes
+     else
+       ovs_cv_tox=no
+       HAVE_TOX=no
+     fi])
+   AM_CONDITIONAL([HAVE_TOX], [test "$ovs_cv_tox" = yes])
+   AC_SUBST([HAVE_TOX])])
 
 dnl Checks for dot.
 AC_DEFUN([OVS_CHECK_DOT],
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 707796f..d4efaa0 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -2,6 +2,7 @@
 HAVE_OPENSSL='@HAVE_OPENSSL@'
 HAVE_PYTHON='@HAVE_PYTHON@'
 HAVE_PYTHON3='@HAVE_PYTHON3@'
+HAVE_TOX='@HAVE_TOX@'
 EGREP='@EGREP@'
 PERL='@PERL@'
 
diff --git a/tests/automake.mk b/tests/automake.mk
index bd06a51..b938cd6 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -91,7 +91,8 @@ TESTSUITE_AT = \
 	tests/ovn-nbctl.at \
 	tests/ovn-sbctl.at \
 	tests/ovn-controller.at \
-	tests/ovn-controller-vtep.at
+	tests/ovn-controller-vtep.at \
+	tests/tox.at
 
 SYSTEM_KMOD_TESTSUITE_AT = \
 	tests/system-common-macros.at \
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 7e3f193..a78866c 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -73,3 +73,4 @@ m4_include([tests/ovn-nbctl.at])
 m4_include([tests/ovn-sbctl.at])
 m4_include([tests/ovn-controller.at])
 m4_include([tests/ovn-controller-vtep.at])
+m4_include([tests/tox.at])
diff --git a/tests/tox.at b/tests/tox.at
new file mode 100644
index 0000000..10f051e
--- /dev/null
+++ b/tests/tox.at
@@ -0,0 +1,13 @@
+AT_BANNER([tox])
+
+m4_define([TOX_PYN],
+  [AT_SETUP([tox - $1])
+   AT_KEYWORDS([python tox $4])
+   AT_SKIP_IF([test $2 = no])
+   AT_SKIP_IF([test $HAVE_TOX = no])
+   AT_CHECK([tox -c $srcdir/python/tox.ini -e $3 >/dev/null 2>&1], [0])
+   AT_CLEANUP])
+
+TOX_PYN([Python2], [$HAVE_PYTHON], [py27])
+TOX_PYN([Python3], [$HAVE_PYTHON3], [py34])
+TOX_PYN([Python PEP8], [$HAVE_PYTHON], [pep8], [pep8])
-- 
2.5.0




More information about the dev mailing list