Pino Toscano
2014-Mar-17 11:43 UTC
[Libguestfs] [PATCH] sparsify: skip test-virt-sparsify-in-place.sh if discard is not supported
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
Richard W.M. Jones
2014-Mar-17 12:32 UTC
Re: [Libguestfs] [PATCH] sparsify: skip test-virt-sparsify-in-place.sh if discard is not supported
I don't like spinning up an appliance in order to test a feature. Although it's quick on baremetal, inside Koji it takes 10+ seconds, so it adds to the already lengthy test times. So, see the patch series I have just posted. There are actually loads of places in the library code where we return an 'unsupported' indication or error message, but we don't set the errno to ENOTSUP. Many of the following locations (and likely others too) could be fixed to set errno to ENOTSUP: $ git grep -iE '\b(supp|unsupp)' -- src | wc -l 131 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
Pino Toscano
2014-Mar-17 13:19 UTC
Re: [Libguestfs] [PATCH] sparsify: skip test-virt-sparsify-in-place.sh if discard is not supported
On Monday 17 March 2014 12:32:20 Richard W.M. Jones wrote:> I don't like spinning up an appliance in order to test a feature. > Although it's quick on baremetal, inside Koji it takes 10+ seconds, so > it adds to the already lengthy test times.It's a pity, as spinning an appliance seems a clean way to detect that feature availability (hooking it into a "feature").> So, see the patch series I have just posted.Works for me (the test is properly SKIPped). Thanks, -- Pino Toscano
Seemingly Similar Threads
- [PATCH v2] sparsify: Fix test-virt-sparsify-in-place-fstrim-unsupported.sh
- [PATCH] sparsify: Fix test-virt-sparsify-in-place-fstrim-unsupported.sh
- [PATCH] sparsify: in-place: Refuse to run on overlay files (RHBZ#1277705).
- Re: Fwd: [Bug 1277705] virt-sparsify --in-place should not sparsify a snapshot
- Re: Fwd: [Bug 1277705] virt-sparsify --in-place should not sparsify a snapshot