[Libguestfs] [PATCH 35/67] tests/mountable: Better error messages.

Richard W.M. Jones rjones at redhat.com
Sat Aug 24 11:04:35 UTC 2013


From: "Richard W.M. Jones" <rjones at redhat.com>

Better error messages (for diagnosis) when this test fails.  Also this
fixes the line endings which were broken before.

(cherry picked from commit d9694362059e869da67c1333d62adb66f7d0aa1e)
---
 tests/mountable/test-internal-parse-mountable.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/mountable/test-internal-parse-mountable.c b/tests/mountable/test-internal-parse-mountable.c
index e33db76..b12869b 100644
--- a/tests/mountable/test-internal-parse-mountable.c
+++ b/tests/mountable/test-internal-parse-mountable.c
@@ -92,9 +92,10 @@ main (int argc, char *argv[])
   if (mountable == NULL) goto error;
 
   if (mountable->im_type != MOUNTABLE_DEVICE ||
-      !STREQ ("/dev/VG/LV", mountable->im_device))
+      STRNEQ ("/dev/VG/LV", mountable->im_device))
   {
-    fprintf (stderr, "incorrectly parsed /dev/VG/LV");
+    fprintf (stderr, "incorrectly parsed /dev/VG/LV: im_device=%s\n",
+             mountable->im_device);
     goto error;
   }
 
@@ -104,10 +105,11 @@ main (int argc, char *argv[])
   if (mountable == NULL) goto error;
 
   if (mountable->im_type != MOUNTABLE_BTRFSVOL ||
-      !STREQ ("/dev/VG/LV", mountable->im_device) ||
-      !STREQ ("sv", mountable->im_volume))
+      STRNEQ ("/dev/VG/LV", mountable->im_device) ||
+      STRNEQ ("sv", mountable->im_volume))
   {
-    fprintf (stderr, "incorrectly parsed /dev/VG/LV/sv");
+    fprintf (stderr, "incorrectly parsed /dev/VG/LV/sv: im_device=%s, im_volume=%s\n",
+             mountable->im_device, mountable->im_volume);
     goto error;
   }
   guestfs_free_internal_mountable (mountable);
-- 
1.8.3.1




More information about the Libguestfs mailing list