Pino Toscano
2013-Dec-23 15:45 UTC
[Libguestfs] [PATCH] tests/mountable: skip if btrfs is not available
This test uses btrfs, so skip it if the "btrfs" feature is not available. --- tests/mountable/test-internal-parse-mountable.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/mountable/test-internal-parse-mountable.c b/tests/mountable/test-internal-parse-mountable.c index ed3264e..bf03743 100644 --- a/tests/mountable/test-internal-parse-mountable.c +++ b/tests/mountable/test-internal-parse-mountable.c @@ -33,6 +33,7 @@ main (int argc, char *argv[]) guestfs_h *g; struct guestfs_internal_mountable *mountable; const char *devices[] = { "/dev/VG/LV", NULL }; + const char *feature[] = { "btrfs", NULL }; g = guestfs_create (); if (g == NULL) { @@ -48,6 +49,12 @@ main (int argc, char *argv[]) if (guestfs_launch (g) == -1) goto error; + if (!guestfs_feature_available (g, (char **) feature)) { + printf ("skipping test because btrfs is not available\n"); + guestfs_close (g); + exit (77); + } + if (guestfs_part_disk (g, "/dev/sda", "mbr") == -1) goto error; if (guestfs_pvcreate (g, "/dev/sda1") == -1) goto error; -- 1.8.3.1
Richard W.M. Jones
2013-Dec-23 15:52 UTC
Re: [Libguestfs] [PATCH] tests/mountable: skip if btrfs is not available
On Mon, Dec 23, 2013 at 04:45:43PM +0100, Pino Toscano wrote:> This test uses btrfs, so skip it if the "btrfs" feature is not > available. > --- > tests/mountable/test-internal-parse-mountable.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/tests/mountable/test-internal-parse-mountable.c b/tests/mountable/test-internal-parse-mountable.c > index ed3264e..bf03743 100644 > --- a/tests/mountable/test-internal-parse-mountable.c > +++ b/tests/mountable/test-internal-parse-mountable.c > @@ -33,6 +33,7 @@ main (int argc, char *argv[]) > guestfs_h *g; > struct guestfs_internal_mountable *mountable; > const char *devices[] = { "/dev/VG/LV", NULL }; > + const char *feature[] = { "btrfs", NULL }; > > g = guestfs_create (); > if (g == NULL) { > @@ -48,6 +49,12 @@ main (int argc, char *argv[]) > > if (guestfs_launch (g) == -1) goto error; > > + if (!guestfs_feature_available (g, (char **) feature)) { > + printf ("skipping test because btrfs is not available\n"); > + guestfs_close (g); > + exit (77); > + } > + > if (guestfs_part_disk (g, "/dev/sda", "mbr") == -1) goto error; > > if (guestfs_pvcreate (g, "/dev/sda1") == -1) goto error; > -- > 1.8.3.1ACK. You might want to test for btrfs *filesystem*_available too ... The two are different things (userspace tools vs kernel module). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Pino Toscano
2013-Dec-23 16:06 UTC
[Libguestfs] [PATCH] tests/mountable: skip if btrfs is not available
This test uses btrfs, so skip it if either the "btrfs" feature or the btrfs filesystem is not available. --- tests/mountable/test-internal-parse-mountable.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/mountable/test-internal-parse-mountable.c b/tests/mountable/test-internal-parse-mountable.c index ed3264e..0638fc0 100644 --- a/tests/mountable/test-internal-parse-mountable.c +++ b/tests/mountable/test-internal-parse-mountable.c @@ -33,6 +33,7 @@ main (int argc, char *argv[]) guestfs_h *g; struct guestfs_internal_mountable *mountable; const char *devices[] = { "/dev/VG/LV", NULL }; + const char *feature[] = { "btrfs", NULL }; g = guestfs_create (); if (g == NULL) { @@ -48,6 +49,18 @@ main (int argc, char *argv[]) if (guestfs_launch (g) == -1) goto error; + if (!guestfs_feature_available (g, (char **) feature)) { + printf ("skipping test because btrfs is not available\n"); + guestfs_close (g); + exit (77); + } + + if (!guestfs_filesystem_available (g, "btrfs")) { + printf ("skipping test because btrfs filesystem is not available\n"); + guestfs_close (g); + exit (77); + } + if (guestfs_part_disk (g, "/dev/sda", "mbr") == -1) goto error; if (guestfs_pvcreate (g, "/dev/sda1") == -1) goto error; -- 1.8.3.1
Possibly Parallel Threads
- [PATCH] tests/mountable: skip if btrfs is not available
- [PATCH] tests/mountable: skip if btrfs is not available
- [PATCH 2/3] api: add mountable_device and mountable_subvolume
- [PATCH v2 2/3] api: add mountable_device and mountable_subvolume
- [PATCH v3 2/3] api: add mountable_device and mountable_subvolume