[ovs-dev] [PATCH v2 2/9] ovsdb raft: Move ovsdb cluster tests to separate testsuite.

Han Zhou zhouhan at gmail.com
Fri Apr 12 23:26:21 UTC 2019


From: Han Zhou <hzhou8 at ebay.com>

Tests in ovsdb-cluster.at are relatively slow, especially torture
tests, and they will be changed in the future costing high CPU, to
make the tests more effective. So we move the tests to a separate
testsuite, so that we can execute them separately, probably with
lower parallelism to avoid exhausting system resources.

Signed-off-by: Han Zhou <hzhou8 at ebay.com>
---
Note: I have to add a dummy test case to avoid the autom4te error:
    possibly undefined macro: AT_capture_files
See details in the comment at XXX. It would be highly appreciated if
there is a better way to avoid this.

 tests/automake.mk                | 23 ++++++++++++++++++++++-
 tests/ovsdb-cluster-testsuite.at | 15 +++++++++++++++
 tests/ovsdb.at                   |  1 -
 3 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 tests/ovsdb-cluster-testsuite.at

diff --git a/tests/automake.mk b/tests/automake.mk
index 92d56b2..017d2d4 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -6,11 +6,13 @@ EXTRA_DIST += \
 	$(SYSTEM_USERSPACE_TESTSUITE_AT) \
 	$(SYSTEM_OFFLOADS_TESTSUITE_AT) \
 	$(SYSTEM_DPDK_TESTSUITE_AT) \
+	$(OVSDB_CLUSTER_TESTSUITE_AT) \
 	$(TESTSUITE) \
 	$(SYSTEM_KMOD_TESTSUITE) \
 	$(SYSTEM_USERSPACE_TESTSUITE) \
 	$(SYSTEM_OFFLOADS_TESTSUITE) \
 	$(SYSTEM_DPDK_TESTSUITE) \
+	$(OVSDB_CLUSTER_TESTSUITE) \
 	tests/atlocal.in \
 	$(srcdir)/package.m4 \
 	$(srcdir)/tests/testsuite \
@@ -91,7 +93,6 @@ TESTSUITE_AT = \
 	tests/ovsdb-idl.at \
 	tests/ovsdb-lock.at \
 	tests/ovsdb-rbac.at \
-	tests/ovsdb-cluster.at \
 	tests/ovs-vsctl.at \
 	tests/ovs-xapi-sync.at \
 	tests/stp.at \
@@ -141,6 +142,10 @@ $(srcdir)/tests/fuzz-regression-list.at: tests/automake.mk
 	    echo "TEST_FUZZ_REGRESSION([$$basename])"; \
 	done > $@.tmp && mv $@.tmp $@
 
+OVSDB_CLUSTER_TESTSUITE_AT = \
+	tests/ovsdb-cluster-testsuite.at \
+	tests/ovsdb-cluster.at
+
 SYSTEM_KMOD_TESTSUITE_AT = \
 	tests/system-common-macros.at \
 	tests/system-kmod-testsuite.at \
@@ -178,6 +183,7 @@ SYSTEM_KMOD_TESTSUITE = $(srcdir)/tests/system-kmod-testsuite
 SYSTEM_USERSPACE_TESTSUITE = $(srcdir)/tests/system-userspace-testsuite
 SYSTEM_OFFLOADS_TESTSUITE = $(srcdir)/tests/system-offloads-testsuite
 SYSTEM_DPDK_TESTSUITE = $(srcdir)/tests/system-dpdk-testsuite
+OVSDB_CLUSTER_TESTSUITE = $(srcdir)/tests/ovsdb-cluster-testsuite
 DISTCLEANFILES += tests/atconfig tests/atlocal
 
 AUTOTEST_PATH = utilities:vswitchd:ovsdb:vtep:tests:$(PTHREAD_WIN32_DIR_DLL):$(SSL_DIR):ovn/controller-vtep:ovn/northd:ovn/utilities:ovn/controller
@@ -260,6 +266,12 @@ check-valgrind: all $(valgrind_wrappers) $(check_DATA)
 	@echo '----------------------------------------------------------------------'
 	@echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
 	@echo '----------------------------------------------------------------------'
+check-ovsdb-cluster-valgrind: all $(valgrind_wrappers) $(check_DATA)
+	$(SHELL) '$(OVSDB_CLUSTER_TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS) -j1
+	@echo
+	@echo '----------------------------------------------------------------------'
+	@echo 'Valgrind output can be found in tests/ovsdb-cluster-testsuite.dir/*/valgrind.*'
+	@echo '----------------------------------------------------------------------'
 check-kernel-valgrind: all $(valgrind_wrappers) $(check_DATA)
 	$(SHELL) '$(SYSTEM_KMOD_TESTSUITE)' -C tests VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS) -j1
 	@echo
@@ -312,6 +324,11 @@ check-dpdk: all
 
 clean-local:
 	test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
+
+# Run OVSDB cluster tests.
+check-ovsdb-cluster: all
+	set $(SHELL) '$(OVSDB_CLUSTER_TESTSUITE)' -C tests  AUTOTEST_PATH='$(AUTOTEST_PATH)'; \
+	"$$@" $(TESTSUITEFLAGS) -j1 || (test X'$(RECHECK)' = Xyes && "$$@" --recheck)
 
 AUTOTEST = $(AUTOM4TE) --language=autotest
 
@@ -342,6 +359,10 @@ $(SYSTEM_DPDK_TESTSUITE): package.m4 $(SYSTEM_TESTSUITE_AT) $(SYSTEM_DPDK_TESTSU
 	$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
 	$(AM_V_at)mv $@.tmp $@
 
+$(OVSDB_CLUSTER_TESTSUITE): package.m4 $(OVSDB_CLUSTER_TESTSUITE_AT) $(COMMON_MACROS_AT)
+	$(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+	$(AM_V_at)mv $@.tmp $@
+
 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
 	$(AM_V_GEN):;{ \
diff --git a/tests/ovsdb-cluster-testsuite.at b/tests/ovsdb-cluster-testsuite.at
new file mode 100644
index 0000000..6c205c1
--- /dev/null
+++ b/tests/ovsdb-cluster-testsuite.at
@@ -0,0 +1,15 @@
+AT_INIT
+
+m4_ifdef([AT_COLOR_TESTS], [AT_COLOR_TESTS])
+
+m4_include([tests/ovs-macros.at])
+m4_include([tests/ovsdb-macros.at])
+m4_include([tests/ofproto-macros.at])
+
+# XXX: below dummy test is to invoke AT_SETUP before including any tests.
+# Without this, there will be error: possibly undefined macro: AT_capture_files
+# when parsing .at files that use OVS_START_SHELL_HELPERS.
+AT_SETUP([dummy])
+AT_CHECK([:])
+AT_CLEANUP
+m4_include([tests/ovsdb-cluster.at])
diff --git a/tests/ovsdb.at b/tests/ovsdb.at
index b388ccf..afefeff 100644
--- a/tests/ovsdb.at
+++ b/tests/ovsdb.at
@@ -19,4 +19,3 @@ m4_include([tests/ovsdb-monitor.at])
 m4_include([tests/ovsdb-idl.at])
 m4_include([tests/ovsdb-lock.at])
 m4_include([tests/ovsdb-rbac.at])
-m4_include([tests/ovsdb-cluster.at])
-- 
2.1.0



More information about the dev mailing list