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