[Libguestfs] [PATCH 09/16] src: Convert test-utils to use the test harness.

Richard W.M. Jones rjones at redhat.com
Tue Aug 4 13:19:59 UTC 2015


---
 generator/tests.ml |  7 ++++++
 src/Makefile.am    | 17 +++++----------
 src/tests.mk       | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 12 deletions(-)
 create mode 100644 src/tests.mk

diff --git a/generator/tests.ml b/generator/tests.ml
index 16a731c..dc833f2 100644
--- a/generator/tests.ml
+++ b/generator/tests.ml
@@ -467,4 +467,11 @@ let tests = [
       ]
   };
 
+  "src", {
+    defaults with
+      check_fast = [
+        "test-utils";
+      ]
+  };
+
 ]
diff --git a/src/Makefile.am b/src/Makefile.am
index 38a4f50..85b7091 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,7 +46,8 @@ generator_built = \
 	structs-cleanup.c \
 	structs-compare.c \
 	structs-copy.c \
-	structs-free.c
+	structs-free.c \
+	tests.mk
 
 BUILT_SOURCES = \
 	$(generator_built) \
@@ -247,14 +248,7 @@ libvirt_is_version_CFLAGS = \
 	$(LIBVIRT_CFLAGS)
 endif
 
-# Tests: main tests are in tests/c-api.  Here we just have some
-# internal tests of utility functions.  Note we don't just test what's
-# in utils.c, we can test other functions as well here.
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test $(VG)
-
-TESTS = test-utils
-check_PROGRAMS = test-utils
+# Test program.
 
 test_utils_SOURCES = test-utils.c
 test_utils_CPPFLAGS = \
@@ -268,9 +262,6 @@ test_utils_LDADD = \
 	$(LTLIBINTL) \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
-check-valgrind:
-	$(MAKE) VG="@VG@" check
-
 # Pkgconfig.
 
 pkgconfigdir = $(libdir)/pkgconfig
@@ -297,3 +288,5 @@ stamp-guestfs.pod: guestfs.pod \
 	  --license LGPLv2+ \
 	  $<
 	touch $@
+
+include $(srcdir)/tests.mk
diff --git a/src/tests.mk b/src/tests.mk
new file mode 100644
index 0000000..10e6964
--- /dev/null
+++ b/src/tests.mk
@@ -0,0 +1,63 @@
+# libguestfs generated file
+# WARNING: THIS FILE IS GENERATED FROM:
+#   generator/ *.ml
+# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+#
+# Copyright (C) 2009-2015 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+localtestsdir = $(alltestsdir)/src
+
+localtests_PROGRAMS = \
+	test-utils
+
+# Note that we cannot create a simple 'check:' target since
+# automake will (silently) overrule it, so we do this instead:
+
+TESTS_ENVIRONMENT = $(top_builddir)/run
+TESTS = $(top_builddir)/test-harness
+
+check-valgrind:
+	$(top_builddir)/run $(top_builddir)/test-harness --valgrind
+
+check-direct:
+	$(top_builddir)/run $(top_builddir)/test-harness --direct
+
+check-valgrind-direct:
+	$(top_builddir)/run $(top_builddir)/test-harness --valgrind --direct
+
+check-libvirt:
+	$(top_builddir)/run $(top_builddir)/test-harness --libvirt
+
+check-valgrind-libvirt:
+	$(top_builddir)/run $(top_builddir)/test-harness --valgrind --libvirt
+
+check-uml:
+	$(top_builddir)/run $(top_builddir)/test-harness --uml
+
+check-valgrind-uml:
+	$(top_builddir)/run $(top_builddir)/test-harness --valgrind --uml
+
+check-with-upstream-qemu:
+	$(top_builddir)/run $(top_builddir)/test-harness --upstream-qemu
+
+check-with-upstream-libvirt:
+	$(top_builddir)/run $(top_builddir)/test-harness --upstream-libvirt
+
+check-fast:
+	$(top_builddir)/run $(top_builddir)/test-harness --fast
+
+EXTRA_DIST += tests.mk
-- 
2.5.0




More information about the Libguestfs mailing list