[PATCH] tests/run-xml-to-junit.xsl: allow to define a different classname
by Pino Toscano
Read and use the classname attribute in each test if present, falling
back to "TestSuite" (used so far).
---
tests/run-xml-to-junit.xsl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/run-xml-to-junit.xsl b/tests/run-xml-to-junit.xsl
index b0d56f3..3bae981 100644
--- a/tests/run-xml-to-junit.xsl
+++ b/tests/run-xml-to-junit.xsl
@@ -15,8 +15,9 @@
<xsl:variable name="TestcaseName"><xsl:value-of select="@name"/></xsl:variable>
<xsl:variable name="TestcaseTime"><xsl:value-of select="@time"/></xsl:variable>
<xsl:variable name="TestcaseRescode"><xsl:value-of select="@rescode"/></xsl:variable>
+ <xsl:variable name="TestcaseClassname"><xsl:choose><xsl:when test="@classname"><xsl:value-of select="@classname"/></xsl:when><xsl:otherwise>TestSuite</xsl:otherwise></xsl:choose></xsl:variable>
<xsl:variable name="TestcaseOutput"><xsl:value-of select="."/></xsl:variable>
- <testcase name="{$TestcaseName}" classname="TestSuite" time="{$TestcaseTime}">
+ <testcase name="{$TestcaseName}" classname="{$TestcaseClassname}" time="{$TestcaseTime}">
<xsl:choose>
<xsl:when test="$TestcaseRescode = 0">
<system-out><xsl:value-of select="$TestcaseOutput"/></system-out>
--
1.8.3.1
10 years, 8 months
[PATCH] customize: Move virt-customize-related code to a separate
by Richard W.M. Jones
There's not going to be an easy way to present this patch. It's huge
and interconnected.
Anyway, what it does is lay the groundwork for a new tool which I'm
calling 'virt-customize'. virt-customize is virt-builder, but without
the part where it downloads a template from a respository. Just the
part where it customizes the template, that is, installing packages,
editing configuration files, setting a random seed and so on.
This patch splits the customize bits of virt-builder out into a
separate library (all the code under customize/).
Eventually this subdirectory will evolve into a virt-customize tool,
and virt-sysprep will also use the library. But in the current patch
the library is only used in virt-builder.
Mostly this is painful code motion.
Rich.
10 years, 8 months
[PATCH 1/3] po-docs: There are no *.pl files in the po-docs subdirectories any longer.
by Richard W.M. Jones
---
po-docs/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/po-docs/Makefile.am b/po-docs/Makefile.am
index 71489d8..fd4efbf 100644
--- a/po-docs/Makefile.am
+++ b/po-docs/Makefile.am
@@ -53,7 +53,7 @@ libguestfs-docs.pot: po4a.conf
--msgid-bugs-address libguestfs(a)redhat.com \
--copyright-holder "Red Hat Inc." \
po4a.conf
- for f in `cd $(srcdir); find $(linguas) -name '*.pod' -o -name '*.pl'`; do \
+ for f in `cd $(srcdir); find $(linguas) -name '*.pod'`; do \
echo '=encoding utf8' > $$f.new; \
awk 'FNR >= 14 { print }' < $(srcdir)/$$f >> $$f.new; \
mv $$f.new $$f; \
--
1.8.5.3
10 years, 8 months
[PATCH 1/2] php: make the test suite failures fatal
by Pino Toscano
So far the failure of some test would have not reported a non-zero
return value by run-tests.php. Since now all the PHP tests pass, we can
ask for failures to be fatal, by exporting REPORT_EXIT_STATUS=1 for
run-tests.php.
---
php/run-php-tests.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/php/run-php-tests.sh b/php/run-php-tests.sh
index 6f9ae10..e498987 100755
--- a/php/run-php-tests.sh
+++ b/php/run-php-tests.sh
@@ -44,5 +44,4 @@ printenv | grep -E '^(LIBGUESTFS|LIBVIRT|LIBVIRTD|VIRTLOCKD|LD|MALLOC)_' >> env
TESTS=$(echo guestfs_php_*.phpt)
echo TESTS: $TESTS
-# PHP ignores the result of the tests!
-make test TESTS="$TESTS" PHP_EXECUTABLE="$PWD/php-for-tests.sh"
+make test TESTS="$TESTS" PHP_EXECUTABLE="$PWD/php-for-tests.sh" REPORT_EXIT_STATUS=1
--
1.8.3.1
10 years, 8 months
[PATCH 1/2] podwrapper: Give an error if an --insert or --verbatim pattern is not found in the input.
by Richard W.M. Jones
---
podwrapper.pl.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/podwrapper.pl.in b/podwrapper.pl.in
index 61d5e12..74432ad 100755
--- a/podwrapper.pl.in
+++ b/podwrapper.pl.in
@@ -274,7 +274,10 @@ foreach (@inserts) {
my @a = split /:/, $_, 2;
die "$progname: $input: no colon in parameter of --insert\n" unless @a >= 2;
my $replacement = read_whole_file ($a[0]);
+ my $oldcontent = $content;
$content =~ s/$a[1]/$replacement/ge;
+ die "$progname: $input: could not find pattern '$a[1]' in input file\n"
+ if $content eq $oldcontent;
}
# Perform @verbatims.
@@ -282,7 +285,10 @@ foreach (@verbatims) {
my @a = split /:/, $_, 2;
die "$progname: $input: no colon in parameter of --verbatim\n" unless @a >= 2;
my $replacement = read_verbatim_file ($a[0]);
+ my $oldcontent = $content;
$content =~ s/$a[1]/$replacement/ge;
+ die "$progname: $input: could not find pattern '$a[1]' in input file\n"
+ if $content eq $oldcontent;
}
if ($strict_checks) {
--
1.8.5.3
10 years, 8 months
[PATCH] tests: properly cleanup the temporary directories
by Pino Toscano
Chmod the temporary directory again so we can clean it all, avoid
leaving stray temporary directories.
This is a kind of revert of few parts of commit
22b0662ebf64e93dc275acc1cc37ebd12cce6b49, but adapted to the unique
$tmpdir used now.
---
tests/test-binaries-exist.sh | 4 +++-
tests/test-harder.sh | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/test-binaries-exist.sh b/tests/test-binaries-exist.sh
index 3a2d50d..c40ce93 100755
--- a/tests/test-binaries-exist.sh
+++ b/tests/test-binaries-exist.sh
@@ -58,4 +58,6 @@ fi
# These binaries should be runnable (since they are the same as the host).
`find $d2 -name sync | head`
-rm -rf $tmpdir ||:
+# Need to chmod $d2 since rm -r can't remove unwritable directories.
+chmod -R +w $d2 ||:
+rm -rf $tmpdir
diff --git a/tests/test-harder.sh b/tests/test-harder.sh
index b010c35..e8bb32f 100755
--- a/tests/test-harder.sh
+++ b/tests/test-harder.sh
@@ -127,4 +127,6 @@ case $distro in
;;
esac
-rm -rf $tmpdir ||:
+# Need to chmod $d2 since rm -r can't remove unwritable directories.
+chmod -R +w $d2 ||:
+rm -rf $tmpdir
--
1.8.3.1
10 years, 8 months
[PATCH] sparsify: skip test-virt-sparsify-in-place.sh if discard is not supported
by Pino Toscano
Try adding a dummy drive with discard enabled as test before using
virt-sparsify --in-place (which needs discard).
---
sparsify/test-virt-sparsify-in-place.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/sparsify/test-virt-sparsify-in-place.sh b/sparsify/test-virt-sparsify-in-place.sh
index 56311a0..b098c90 100755
--- a/sparsify/test-virt-sparsify-in-place.sh
+++ b/sparsify/test-virt-sparsify-in-place.sh
@@ -29,7 +29,16 @@ if [ "$(../fish/guestfish get-backend)" = "uml" ]; then
exit 77
fi
-rm -f test-virt-sparsify-in-place.img
+rm -f test-virt-sparsify-in-place.img test-virt-sparsify-in-place-test.img
+
+if ! ../fish/guestfish \
+ disk-create test-virt-sparsify-in-place-test.img raw 200K : \
+ add-drive test-virt-sparsify-in-place-test.img readonly:false discard:enable : \
+ run; then
+ rm -f test-virt-sparsify-in-place-test.img
+ echo "$0: skipping test because discard is not supported"
+ exit 77
+fi
# Create a filesystem, fill it with data, then delete the data. Then
# prove that sparsifying it reduces the size of the final filesystem.
@@ -66,4 +75,4 @@ if [ $size_after -gt 15000 ]; then
exit 1
fi
-rm test-virt-sparsify-in-place.img
+rm test-virt-sparsify-in-place.img test-virt-sparsify-in-place-test.img
--
1.8.3.1
10 years, 8 months
[PATCH 1/4] ocaml: Add Guestfs.Errno submodule exposing useful raw errno numbers.
by Richard W.M. Jones
For use when calling G.last_errno.
---
generator/ocaml.ml | 15 +++++++++++++++
ocaml/guestfs-c.c | 8 ++++++++
2 files changed, 23 insertions(+)
diff --git a/generator/ocaml.ml b/generator/ocaml.ml
index 78cff89..29a9eb6 100644
--- a/generator/ocaml.ml
+++ b/generator/ocaml.ml
@@ -121,10 +121,20 @@ val last_errno : t -> int
(or [0] if there was no errno). Note that the returned integer is the
raw errno number, and it is {i not} related to the {!Unix.error} type.
+ Some raw errno numbers are exposed by the {!Guestfs.Errno} submodule,
+ and we can add more as required.
+
[last_errno] can be overwritten by subsequent operations on a handle,
so if you want to capture the errno correctly, you must call this
in the {!Error} exception handler, before any other operation on [g]. *)
+(** The [Guestfs.Errno] submodule exposes some raw errno numbers,
+ which you can use to test the return value of {!Guestfs.last_errno}. *)
+
+module Errno : sig
+ val errno_ENOTSUP : int
+end
+
";
generate_ocaml_structure_decls ();
@@ -253,6 +263,11 @@ external event_to_string : event list -> string
external last_errno : t -> int = \"ocaml_guestfs_last_errno\"
+module Errno = struct
+ external enotsup : unit -> int = \"ocaml_guestfs_get_ENOTSUP\" \"noalloc\"
+ let errno_ENOTSUP = enotsup ()
+end
+
(* Give the exceptions names, so they can be raised from the C code. *)
let () =
Callback.register_exception \"ocaml_guestfs_error\" (Error \"\");
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 98a9ba0..bd1ffb7 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -63,6 +63,7 @@ value ocaml_guestfs_set_event_callback (value gv, value closure, value events);
value ocaml_guestfs_delete_event_callback (value gv, value eh);
value ocaml_guestfs_event_to_string (value events);
value ocaml_guestfs_last_errno (value gv);
+value ocaml_guestfs_get_ENOTSUP (value unitv);
/* Allocate handles and deal with finalization. */
static void
@@ -438,3 +439,10 @@ ocaml_guestfs_last_errno (value gv)
rv = Val_int (r);
CAMLreturn (rv);
}
+
+/* NB: "noalloc" function. */
+value
+ocaml_guestfs_get_ENOTSUP (value unitv)
+{
+ return Val_int (ENOTSUP);
+}
--
1.8.5.3
10 years, 8 months
[PATCH pkg-libvirt/libguestfs] Remove update-guestfs-appliance
by Richard W.M. Jones
[First attempt to send this using git send-email didn't work because
of SMTP routing problems]
Hilko,
This is my experimental patch to remove update-guestfs-appliance from
Debian. With this patch, libguestfs builds with a supermin [version 5]
appliance in /usr/lib/guestfs/supermin.d:
$ ll -h /usr/lib/guestfs/supermin.d/
total 884K
-rw-r--r-- 1 root root 94K Mar 15 12:18 base.tar.gz
-rw-r--r-- 1 root root 767K Mar 15 12:18 daemon.tar.gz
-rw-r--r-- 1 root root 263 Mar 15 12:18 excludefiles
-rw-r--r-- 1 root root 42 Mar 15 12:18 hostfiles
-rw-r--r-- 1 root root 2.1K Mar 15 12:18 init.tar.gz
-rw-r--r-- 1 root root 462 Mar 15 12:18 packages
-rw-r--r-- 1 root root 543 Mar 15 12:18 udev-rules.tar.gz
libguestfs-test-tool works after installation. I tried a few other
things, but it has not been comprehensively tested.
Note that if you previously had libguestfs installed, and you ran
update-guestfs-appliance, it will have created a cpio file called
'base.img' in /usr/lib/guestfs/supermin.d/. This file breaks supermin
unless it is removed. I attempted to modify postinst to remove it,
but that didn't work for some reason.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
10 years, 8 months