This adds the virt-sparsify --debug-gc option which causes
virt-sparsify to call Gc.compact before exiting, allowing
GC and memory problems to be tested.
Add an extratest which runs virt-sparsify under valgrind.
test-tools-internal \
test-tools-real \
test-resize \
test-tools-internal \
test-tools-real \
test-resize \
test-capitests \
test-ocaml
test-capitests \
test-ocaml
test-resize:
$(MAKE) -C ../resize VG="$(VG)" check
test-resize:
$(MAKE) -C ../resize VG="$(VG)" check
+# Run virt-sparsify tests under valgrind.
+test-sparsify:
+ $(MAKE) -C ../sparsify VG="$(VG)" check
+
# XXX Not tested:
# ../clone/virt-sysprep
# ../edit/virt-edit
# ../edit/virt-edit -e
# ../fuse/guestmount
# XXX Not tested:
# ../clone/virt-sysprep
# ../edit/virt-edit
# ../edit/virt-edit -e
# ../fuse/guestmount
-# ../sparsify/virt-sparsify (OCaml)
# ../tools/virt-win-reg (Perl)
# ../tools/virt-make-fs (Perl)
# ../tools/virt-win-reg (Perl)
# ../tools/virt-make-fs (Perl)
(* Command line argument parsing. *)
let prog = Filename.basename Sys.executable_name
(* Command line argument parsing. *)
let prog = Filename.basename Sys.executable_name
-let indisk, outdisk, compress, convert, format, ignores, machine_readable,
+let indisk, outdisk, compress, convert, debug_gc,
+ format, ignores, machine_readable,
option, quiet, verbose, trace =
let display_version () =
let g = new G.guestfs () in
option, quiet, verbose, trace =
let display_version () =
let g = new G.guestfs () in
let compress = ref false in
let convert = ref "" in
let compress = ref false in
let convert = ref "" in
+ let debug_gc = ref false in
let format = ref "" in
let ignores = ref [] in
let machine_readable = ref false in
let format = ref "" in
let ignores = ref [] in
let machine_readable = ref false in
let argspec = Arg.align [
"--compress", Arg.Set compress, " Compressed output format";
"--convert", Arg.Set_string convert, "format Format of output disk (default: same as input)";
let argspec = Arg.align [
"--compress", Arg.Set compress, " Compressed output format";
"--convert", Arg.Set_string convert, "format Format of output disk (default: same as input)";
+ "--debug-gc", Arg.Set debug_gc, " Debug GC and memory allocations";
"--format", Arg.Set_string format, "format Format of input disk";
"--ignore", Arg.String (add ignores), "fs Ignore filesystem";
"--machine-readable", Arg.Set machine_readable, " Make output machine readable";
"--format", Arg.Set_string format, "format Format of input disk";
"--ignore", Arg.String (add ignores), "fs Ignore filesystem";
"--machine-readable", Arg.Set machine_readable, " Make output machine readable";
(* Dereference the rest of the args. *)
let compress = !compress in
let convert = match !convert with "" -> None | str -> Some str in
(* Dereference the rest of the args. *)
let compress = !compress in
let convert = match !convert with "" -> None | str -> Some str in
+ let debug_gc = !debug_gc in
let format = match !format with "" -> None | str -> Some str in
let ignores = List.rev !ignores in
let machine_readable = !machine_readable in
let format = match !format with "" -> None | str -> Some str in
let ignores = List.rev !ignores in
let machine_readable = !machine_readable in
if contains_comma then
error "input filename '%s' contains a comma; qemu-img command line syntax prevents us from using such an image" indisk;
if contains_comma then
error "input filename '%s' contains a comma; qemu-img command line syntax prevents us from using such an image" indisk;
- indisk, outdisk, compress, convert, format, ignores, machine_readable,
- option, quiet, verbose, trace
+ indisk, outdisk, compress, convert,
+ debug_gc, format, ignores, machine_readable,
+ option, quiet, verbose, trace
let () =
if not quiet then
let () =
if not quiet then
wrap "Sparsify operation completed with no errors. Before deleting the old disk, carefully check that the target disk boots and works correctly.\n";
);
wrap "Sparsify operation completed with no errors. Before deleting the old disk, carefully check that the target disk boots and works correctly.\n";
);
+ if debug_gc then
+ Gc.compact ();
+
-./virt-sparsify --format raw test1.img --convert qcow2 test2.img
+$VG ./virt-sparsify --debug-gc --format raw test1.img --convert qcow2 test2.img
size_before=$(du -s test1.img | awk '{print $1}')
size_after=$(du -s test2.img | awk '{print $1}')
size_before=$(du -s test1.img | awk '{print $1}')
size_after=$(du -s test2.img | awk '{print $1}')
For fine-tuning the output format, see: I<--compress>, I<-o>.
For fine-tuning the output format, see: I<--compress>, I<-o>.
+=item B<--debug-gc>
+
+Debug garbage collection and memory allocation. This is only useful
+when debugging memory problems in virt-sparsify or the OCaml libguestfs
+bindings.
+
=item B<--format> raw
=item B<--format> qcow2
=item B<--format> raw
=item B<--format> qcow2