---
generator/test_harness.ml | 6 +++-
generator/tests.ml | 26 +++++++++++++++
generator/tests_mk.ml | 3 +-
perl/Makefile.am | 26 +++------------
perl/run-bindtests | 22 -------------
perl/run-bindtests.sh | 22 +++++++++++++
perl/run-perl-tests | 21 -------------
perl/t/910-pod.t | 2 ++
perl/tests.mk | 80 +++++++++++++++++++++++++++++++++++++++++++++++
9 files changed, 142 insertions(+), 66 deletions(-)
delete mode 100755 perl/run-bindtests
create mode 100755 perl/run-bindtests.sh
delete mode 100755 perl/run-perl-tests
create mode 100644 perl/tests.mk
diff --git a/generator/test_harness.ml b/generator/test_harness.ml
index af8182c..1f6bf90 100644
--- a/generator/test_harness.ml
+++ b/generator/test_harness.ml
@@ -608,6 +608,9 @@ Options:" in
not (Filename.check_suffix test ".pl") &&
not (Filename.check_suffix test ".sh") in
+ (* Perl tests need to use the 'prove' program. *)
+ let is_perl_test = Filename.check_suffix test ".t" in
+
(* We run each test in its own temporary directory. *)
let tmpdir = mkdtemp () in
@@ -616,7 +619,7 @@ Options:" in
putenv "tmpdir" tmpdir;
let cmd =
- sprintf "%s%s%s%s$abs_srcdir/%s%s > output 2>&1"
+ sprintf "%s%s%s%s%s$abs_srcdir/%s%s > output 2>&1"
(if upstream_libvirt then libvirtdir // "run " else
"")
(if timeout then
sprintf "timeout --foreground -k %s %s "
@@ -624,6 +627,7 @@ Options:" in
else "")
(if have_libtool then "libtool --mode=execute " else
"")
(if is_program && valgrind then "$VG " else
"")
+ (if is_perl_test then "prove " else "")
test
(String.concat ""
(List.map ((^) " ") (List.map Filename.quote args))) in
diff --git a/generator/tests.ml b/generator/tests.ml
index ce04687..a214fa7 100644
--- a/generator/tests.ml
+++ b/generator/tests.ml
@@ -597,6 +597,32 @@ let tests = [
];
};
+ "perl", {
+ defaults with
+ check_fast = [
+ "run-bindtests.sh";
+ "t/010-load.t";
+ "t/020-create.t";
+ "t/030-create-flags.t";
+ "t/040-create-multiple.t";
+ "t/060-handle-properties.t";
+ "t/070-optargs.t";
+ "t/410-close-event.t";
+ "t/420-log-messages.t";
+ "t/800-explicit-close.t";
+ "t/900-introspection.t";
+ "t/910-pod.t";
+ "t/920-pod-coverage.t";
+ ];
+ check = [
+ "t/100-launch.t";
+ "t/810-mkdir-eexist.t";
+ ];
+ check_data = [
+ "bindtests.pl";
+ ];
+ };
+
(* Test tools written in OCaml. *)
"mllib", {
diff --git a/generator/tests_mk.ml b/generator/tests_mk.ml
index 7e98297..38d8630 100644
--- a/generator/tests_mk.ml
+++ b/generator/tests_mk.ml
@@ -43,8 +43,9 @@ let generate_tests_mk dir tests () =
* localtests_SCRIPTS. Others are added to localtests_PROGRAMS.
*)
let scripts_extensions = [
- ".bc"; ".opt"; (* for OCaml *)
+ ".bc"; ".opt"; (* for OCaml *)
".pl";
+ ".t"; (* Perl tests *)
".sh"
] in
diff --git a/perl/Makefile.am b/perl/Makefile.am
index 1eb0469..a408812 100644
--- a/perl/Makefile.am
+++ b/perl/Makefile.am
@@ -19,8 +19,7 @@ include $(top_srcdir)/subdir-rules.mk
generator_built = \
Guestfs.xs \
- lib/Sys/Guestfs.pm \
- bindtests.pl
+ lib/Sys/Guestfs.pm
EXTRA_DIST = \
$(generator_built) \
@@ -28,8 +27,7 @@ EXTRA_DIST = \
examples/README \
examples/LICENSE \
examples/*.pl \
- run-bindtests \
- run-perl-tests \
+ run-bindtests.sh \
t/*.t \
typemap
@@ -41,26 +39,10 @@ if HAVE_PERL
# src/ dependencies
src_deps: $(top_builddir)/src/libguestfs.la $(generator_built)
-# Images used by tests.
-test_images:
- $(MAKE) -C $(top_builddir)/tests/data
-
# Build the appliance.
appliance:
$(MAKE) -C $(top_builddir)/appliance
-TESTS = run-bindtests
-test_prereq = src_deps all test_images
-
-if ENABLE_APPLIANCE
-test_prereq += appliance
-TESTS += run-perl-tests
-endif
-
-$(TESTS): $(test_prereq)
-
-TESTS_ENVIRONMENT = $(top_builddir)/run --test
-
INSTALLDIRS = site
all: Makefile-pl src_deps
@@ -83,4 +65,6 @@ install-data-hook:
endif
-.PHONY: appliance src_deps test_images
+.PHONY: appliance src_deps
+
+include $(srcdir)/tests.mk
diff --git a/perl/run-bindtests b/perl/run-bindtests
deleted file mode 100755
index 3fefd05..0000000
--- a/perl/run-bindtests
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh -
-# libguestfs Perl bindings
-# Copyright (C) 2009 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.
-
-set -e
-
-perl $srcdir/bindtests.pl > bindtests.tmp
-diff -u $srcdir/../bindtests bindtests.tmp
diff --git a/perl/run-bindtests.sh b/perl/run-bindtests.sh
new file mode 100755
index 0000000..3fefd05
--- /dev/null
+++ b/perl/run-bindtests.sh
@@ -0,0 +1,22 @@
+#!/bin/sh -
+# libguestfs Perl bindings
+# Copyright (C) 2009 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.
+
+set -e
+
+perl $srcdir/bindtests.pl > bindtests.tmp
+diff -u $srcdir/../bindtests bindtests.tmp
diff --git a/perl/run-perl-tests b/perl/run-perl-tests
deleted file mode 100755
index 0e7e9ab..0000000
--- a/perl/run-perl-tests
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh -
-# libguestfs Perl bindings
-# Copyright (C) 2009 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.
-
-set -e
-
-make -f Makefile-pl test "$@"
diff --git a/perl/t/910-pod.t b/perl/t/910-pod.t
index e53caaf..b46062f 100644
--- a/perl/t/910-pod.t
+++ b/perl/t/910-pod.t
@@ -19,6 +19,8 @@ use Test::More;
use strict;
use warnings;
+chdir "$ENV{builddir}";
+
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok ();
diff --git a/perl/tests.mk b/perl/tests.mk
new file mode 100644
index 0000000..4782291
--- /dev/null
+++ b/perl/tests.mk
@@ -0,0 +1,80 @@
+# 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)/perl
+
+localtests_DATA = \
+ bindtests.pl
+
+localtests_SCRIPTS = \
+ run-bindtests.sh \
+ t/010-load.t \
+ t/020-create.t \
+ t/030-create-flags.t \
+ t/040-create-multiple.t \
+ t/060-handle-properties.t \
+ t/070-optargs.t \
+ t/100-launch.t \
+ t/410-close-event.t \
+ t/420-log-messages.t \
+ t/800-explicit-close.t \
+ t/810-mkdir-eexist.t \
+ t/900-introspection.t \
+ t/910-pod.t \
+ t/920-pod-coverage.t
+
+# 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