[Libguestfs] [PATCH nbdkit] tests: Add a root only test of the file plugin with

Richard W.M. Jones rjones at redhat.com
Mon Aug 20 12:49:29 UTC 2018


In libguestfs we have a few tests that require root privileges and
they are skipped by default (normally you should not build or test as
root), but you can do this to run them:

  sudo make check-root

In nbdkit I wanted to check that the file plugin works with block
devices (this is not tested), and the only way I can sensibly think to
do this is using a loopback device and root.  This commit therefore
adds a similar mechanism for running root tests and a test of the file
plugin using loop.

It's somewhat hard to say whether this is testing the full fallocate,
trim and zero range paths that might be exercised by Nir's forthcoming
patch.

With the current codebase of nbdkit we can see that fallocate seems to
do the right thing:

  commandrvf: stdout=e stderr=y flags=0x10000
  commandrvf: /bin/sh -c "fallocate -nzl 64k /dev/sda"
  nbdkit: file.8: debug: zero count=65536 offset=0 may_trim=0 fua=0
  nbdkit: file.7: debug: flush

but fstrim possibly does not:

  commandrvf: fstrim -v /sysroot/
  nbdkit: file.2: debug: pread count=1024 offset=336896
  nbdkit: file.6: debug: pread count=1024 offset=343040
  /sysroot/: 91.2 MiB (95629312 bytes) trimmed

Another question is whether the Linux loop device supports all these
ioctls (and indeed whether the Linux -> qemu -> loop path that
libguestfs uses does too).  I admit I did not yet look at the kernel
and qemu code to find out.  An easier way is probably to add debug
messages to Nir's patch.

(An alternative might have been to use scsi_debug, but that is a
rather specialized device.)

Rich.






More information about the Libguestfs mailing list