Generated code for lvremove, vgremove, pvremove.
[libguestfs.git] / tests.c
diff --git a/tests.c b/tests.c
index 1c6676b..378f3af 100644 (file)
--- a/tests.c
+++ b/tests.c
@@ -45,9 +45,74 @@ static void print_strings (char * const * const argv)
     printf ("\t%s\n", argv[argc]);
 }
 
-static int test_mount_0 (void)
+/*
+static void print_table (char * const * const argv)
 {
-  /* InitEmpty for mount (0) */
+  int i;
+
+  for (i = 0; argv[i] != NULL; i += 2)
+    printf ("%s: %s\n", argv[i], argv[i+1]);
+}
+*/
+
+static void no_test_warnings (void)
+{
+  fprintf (stderr, "warning: \"guestfs_launch\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_wait_ready\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_kill_subprocess\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_add_drive\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_add_cdrom\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_config\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_set_qemu\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_get_qemu\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_set_path\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_get_path\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_set_autosync\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_get_autosync\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_set_verbose\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_get_verbose\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_is_ready\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_is_config\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_is_launching\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_is_busy\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_get_state\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_set_busy\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_set_ready\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_ll\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_pvs_full\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_vgs_full\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_lvs_full\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_init\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_close\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_defvar\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_defnode\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_get\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_set\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_insert\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_rm\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_mv\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_match\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_save\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_load\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_aug_ls\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_chmod\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_chown\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_sfdisk\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_lvm_remove_all\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_command\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_command_lines\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_tune2fs_l\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_blockdev_setbsz\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_tar_out\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_tgz_out\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_mount_options\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_mount_vfs\" has no tests\n");
+  fprintf (stderr, "warning: \"guestfs_debug\" has no tests\n");
+}
+
+static int test_pvremove_0 (void)
+{
+  /* InitEmpty for pvremove (0) */
   {
     int r;
     suppress_error = 0;
@@ -62,57 +127,75 @@ static int test_mount_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutput for mount (0) */
+  /* TestOutputList for pvremove (0) */
   {
-    char *lines[] = {
-      ",",
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda",
       NULL
     };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_vgcreate (g, "VG", physvols);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_lvcreate (g, "LV1", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_lvcreate (g, "LV2", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_write_file (g, "/new", "new file contents", 0);
+    r = guestfs_vgremove (g, "VG");
     if (r == -1)
       return -1;
   }
   {
-    char *r;
+    int r;
     suppress_error = 0;
-    r = guestfs_cat (g, "/new");
+    r = guestfs_pvremove (g, "/dev/sda");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_lvs (g);
     if (r == NULL)
       return -1;
-    if (strcmp (r, "new file contents") != 0) {
-      fprintf (stderr, "test_mount_0: expected \"new file contents\" but got \"%s\"\n", r);
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_pvremove_0: extra elements returned from command\n");
+      print_strings (r);
       return -1;
     }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_sync_0 (void)
+static int test_pvremove_1 (void)
 {
-  /* InitEmpty for sync (0) */
+  /* InitEmpty for pvremove (1) */
   {
     int r;
     suppress_error = 0;
@@ -127,84 +210,75 @@ static int test_sync_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestRun for sync (0) */
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_sync (g);
-    if (r == -1)
-      return -1;
-  }
-  return 0;
-}
-
-static int test_touch_0 (void)
-{
-  /* InitBasicFS for touch (0): create ext2 on /dev/sda1 */
+  /* TestOutputList for pvremove (1) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_umount_all (g);
+    r = guestfs_pvcreate (g, "/dev/sda");
     if (r == -1)
       return -1;
   }
   {
+    char *physvols[] = {
+      "/dev/sda",
+      NULL
+    };
     int r;
     suppress_error = 0;
-    r = guestfs_lvm_remove_all (g);
+    r = guestfs_vgcreate (g, "VG", physvols);
     if (r == -1)
       return -1;
   }
   {
-    char *lines[] = {
-      ",",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_lvcreate (g, "LV1", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_lvcreate (g, "LV2", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_vgremove (g, "VG");
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for touch (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/new");
+    r = guestfs_pvremove (g, "/dev/sda");
     if (r == -1)
       return -1;
   }
   {
-    int r;
+    char **r;
+    int i;
     suppress_error = 0;
-    r = guestfs_exists (g, "/new");
-    if (r == -1)
+    r = guestfs_vgs (g);
+    if (r == NULL)
       return -1;
-    if (!r) {
-      fprintf (stderr, "test_touch_0: expected true, got false\n");
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_pvremove_1: extra elements returned from command\n");
+      print_strings (r);
       return -1;
     }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
   }
   return 0;
 }
 
-static int test_cat_0 (void)
+static int test_pvremove_2 (void)
 {
-  /* InitBasicFS for cat (0): create ext2 on /dev/sda1 */
+  /* InitEmpty for pvremove (2) */
   {
     int r;
     suppress_error = 0;
@@ -219,57 +293,75 @@ static int test_cat_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutputList for pvremove (2) */
   {
-    char *lines[] = {
-      ",",
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda",
       NULL
     };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_vgcreate (g, "VG", physvols);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_lvcreate (g, "LV1", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_lvcreate (g, "LV2", "VG", 50);
     if (r == -1)
       return -1;
   }
-  /* TestOutput for cat (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_write_file (g, "/new", "new file contents", 0);
+    r = guestfs_vgremove (g, "VG");
     if (r == -1)
       return -1;
   }
   {
-    char *r;
+    int r;
     suppress_error = 0;
-    r = guestfs_cat (g, "/new");
+    r = guestfs_pvremove (g, "/dev/sda");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_pvs (g);
     if (r == NULL)
       return -1;
-    if (strcmp (r, "new file contents") != 0) {
-      fprintf (stderr, "test_cat_0: expected \"new file contents\" but got \"%s\"\n", r);
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_pvremove_2: extra elements returned from command\n");
+      print_strings (r);
       return -1;
     }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_ls_0 (void)
+static int test_vgremove_0 (void)
 {
-  /* InitBasicFS for ls (0): create ext2 on /dev/sda1 */
+  /* InitEmpty for vgremove (0) */
   {
     int r;
     suppress_error = 0;
@@ -284,50 +376,43 @@ static int test_ls_0 (void)
     if (r == -1)
       return -1;
   }
-  {
-    char *lines[] = {
-      ",",
-      NULL
-    };
-    int r;
-    suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
-    if (r == -1)
-      return -1;
-  }
+  /* TestOutputList for vgremove (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_pvcreate (g, "/dev/sda");
     if (r == -1)
       return -1;
   }
   {
+    char *physvols[] = {
+      "/dev/sda",
+      NULL
+    };
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_vgcreate (g, "VG", physvols);
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for ls (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/new");
+    r = guestfs_lvcreate (g, "LV1", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/newer");
+    r = guestfs_lvcreate (g, "LV2", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/newest");
+    r = guestfs_vgremove (g, "VG");
     if (r == -1)
       return -1;
   }
@@ -335,47 +420,11 @@ static int test_ls_0 (void)
     char **r;
     int i;
     suppress_error = 0;
-    r = guestfs_ls (g, "/");
+    r = guestfs_lvs (g);
     if (r == NULL)
       return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_ls_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "lost+found") != 0) {
-      fprintf (stderr, "test_ls_0: expected \"lost+found\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_ls_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[1], "new") != 0) {
-      fprintf (stderr, "test_ls_0: expected \"new\" but got \"%s\"\n", r[1]);
-      return -1;
-    }
-    if (!r[2]) {
-      fprintf (stderr, "test_ls_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[2], "newer") != 0) {
-      fprintf (stderr, "test_ls_0: expected \"newer\" but got \"%s\"\n", r[2]);
-      return -1;
-    }
-    if (!r[3]) {
-      fprintf (stderr, "test_ls_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[3], "newest") != 0) {
-      fprintf (stderr, "test_ls_0: expected \"newest\" but got \"%s\"\n", r[3]);
-      return -1;
-    }
-    if (r[4] != NULL) {
-      fprintf (stderr, "test_ls_0: extra elements returned from command\n");
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_vgremove_0: extra elements returned from command\n");
       print_strings (r);
       return -1;
     }
@@ -386,9 +435,9 @@ static int test_ls_0 (void)
   return 0;
 }
 
-static int test_list_devices_0 (void)
+static int test_vgremove_1 (void)
 {
-  /* InitEmpty for list_devices (0) */
+  /* InitEmpty for vgremove (1) */
   {
     int r;
     suppress_error = 0;
@@ -403,43 +452,55 @@ static int test_list_devices_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for list_devices (0) */
+  /* TestOutputList for vgremove (1) */
   {
-    char **r;
-    int i;
+    int r;
     suppress_error = 0;
-    r = guestfs_list_devices (g);
-    if (r == NULL)
-      return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_list_devices_0: short list returned from command\n");
-      print_strings (r);
+    r = guestfs_pvcreate (g, "/dev/sda");
+    if (r == -1)
       return -1;
-    }
-    if (strcmp (r[0], "/dev/sda") != 0) {
-      fprintf (stderr, "test_list_devices_0: expected \"/dev/sda\" but got \"%s\"\n", r[0]);
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG", physvols);
+    if (r == -1)
       return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_list_devices_0: short list returned from command\n");
-      print_strings (r);
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvcreate (g, "LV1", "VG", 50);
+    if (r == -1)
       return -1;
-    }
-    if (strcmp (r[1], "/dev/sdb") != 0) {
-      fprintf (stderr, "test_list_devices_0: expected \"/dev/sdb\" but got \"%s\"\n", r[1]);
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvcreate (g, "LV2", "VG", 50);
+    if (r == -1)
       return -1;
-    }
-    if (!r[2]) {
-      fprintf (stderr, "test_list_devices_0: short list returned from command\n");
-      print_strings (r);
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgremove (g, "VG");
+    if (r == -1)
       return -1;
-    }
-    if (strcmp (r[2], "/dev/sdc") != 0) {
-      fprintf (stderr, "test_list_devices_0: expected \"/dev/sdc\" but got \"%s\"\n", r[2]);
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_vgs (g);
+    if (r == NULL)
       return -1;
-    }
-    if (r[3] != NULL) {
-      fprintf (stderr, "test_list_devices_0: extra elements returned from command\n");
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_vgremove_1: extra elements returned from command\n");
       print_strings (r);
       return -1;
     }
@@ -450,9 +511,9 @@ static int test_list_devices_0 (void)
   return 0;
 }
 
-static int test_list_partitions_0 (void)
+static int test_lvremove_0 (void)
 {
-  /* InitBasicFS for list_partitions (0): create ext2 on /dev/sda1 */
+  /* InitEmpty for lvremove (0) */
   {
     int r;
     suppress_error = 0;
@@ -467,88 +528,43 @@ static int test_list_partitions_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutputList for lvremove (0) */
   {
-    char *lines[] = {
-      ",",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
-    if (r == -1)
-      return -1;
-  }
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_pvcreate (g, "/dev/sda");
     if (r == -1)
       return -1;
   }
   {
+    char *physvols[] = {
+      "/dev/sda",
+      NULL
+    };
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_vgcreate (g, "VG", physvols);
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for list_partitions (0) */
-  {
-    char **r;
-    int i;
-    suppress_error = 0;
-    r = guestfs_list_partitions (g);
-    if (r == NULL)
-      return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_list_partitions_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "/dev/sda1") != 0) {
-      fprintf (stderr, "test_list_partitions_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (r[1] != NULL) {
-      fprintf (stderr, "test_list_partitions_0: extra elements returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
-    free (r);
-  }
-  return 0;
-}
-
-static int test_list_partitions_1 (void)
-{
-  /* InitEmpty for list_partitions (1) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_umount_all (g);
+    r = guestfs_lvcreate (g, "LV1", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvm_remove_all (g);
+    r = guestfs_lvcreate (g, "LV2", "VG", 50);
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for list_partitions (1) */
   {
-    char *lines[] = {
-      ",10",
-      ",20",
-      ",",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_lvremove (g, "/dev/VG/LV1");
     if (r == -1)
       return -1;
   }
@@ -556,38 +572,20 @@ static int test_list_partitions_1 (void)
     char **r;
     int i;
     suppress_error = 0;
-    r = guestfs_list_partitions (g);
+    r = guestfs_lvs (g);
     if (r == NULL)
       return -1;
     if (!r[0]) {
-      fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "/dev/sda1") != 0) {
-      fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[1], "/dev/sda2") != 0) {
-      fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
-      return -1;
-    }
-    if (!r[2]) {
-      fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
+      fprintf (stderr, "test_lvremove_0: short list returned from command\n");
       print_strings (r);
       return -1;
     }
-    if (strcmp (r[2], "/dev/sda3") != 0) {
-      fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
+    if (strcmp (r[0], "/dev/VG/LV2") != 0) {
+      fprintf (stderr, "test_lvremove_0: expected \"/dev/VG/LV2\" but got \"%s\"\n", r[0]);
       return -1;
     }
-    if (r[3] != NULL) {
-      fprintf (stderr, "test_list_partitions_1: extra elements returned from command\n");
+    if (r[1] != NULL) {
+      fprintf (stderr, "test_lvremove_0: extra elements returned from command\n");
       print_strings (r);
       return -1;
     }
@@ -598,9 +596,9 @@ static int test_list_partitions_1 (void)
   return 0;
 }
 
-static int test_pvs_0 (void)
+static int test_lvremove_1 (void)
 {
-  /* InitBasicFSonLVM for pvs (0): create ext2 on /dev/VG/LV */
+  /* InitEmpty for lvremove (1) */
   {
     int r;
     suppress_error = 0;
@@ -615,27 +613,17 @@ static int test_pvs_0 (void)
     if (r == -1)
       return -1;
   }
-  {
-    char *lines[] = {
-      ",",
-      NULL
-    };
-    int r;
-    suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
-    if (r == -1)
-      return -1;
-  }
+  /* TestOutputList for lvremove (1) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
+    r = guestfs_pvcreate (g, "/dev/sda");
     if (r == -1)
       return -1;
   }
   {
     char *physvols[] = {
-      "/dev/sda1",
+      "/dev/sda",
       NULL
     };
     int r;
@@ -647,43 +635,33 @@ static int test_pvs_0 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV", "VG", 8);
+    r = guestfs_lvcreate (g, "LV1", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+    r = guestfs_lvcreate (g, "LV2", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/VG/LV", "/");
+    r = guestfs_lvremove (g, "/dev/VG");
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for pvs (0) */
   {
     char **r;
     int i;
     suppress_error = 0;
-    r = guestfs_pvs (g);
+    r = guestfs_lvs (g);
     if (r == NULL)
       return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_pvs_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "/dev/sda1") != 0) {
-      fprintf (stderr, "test_pvs_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (r[1] != NULL) {
-      fprintf (stderr, "test_pvs_0: extra elements returned from command\n");
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_lvremove_1: extra elements returned from command\n");
       print_strings (r);
       return -1;
     }
@@ -694,9 +672,9 @@ static int test_pvs_0 (void)
   return 0;
 }
 
-static int test_pvs_1 (void)
+static int test_lvremove_2 (void)
 {
-  /* InitEmpty for pvs (1) */
+  /* InitEmpty for lvremove (2) */
   {
     int r;
     suppress_error = 0;
@@ -711,38 +689,43 @@ static int test_pvs_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for pvs (1) */
+  /* TestOutputList for lvremove (2) */
   {
-    char *lines[] = {
-      ",10",
-      ",20",
-      ",",
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda",
       NULL
     };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_vgcreate (g, "VG", physvols);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
+    r = guestfs_lvcreate (g, "LV1", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda2");
+    r = guestfs_lvcreate (g, "LV2", "VG", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda3");
+    r = guestfs_lvremove (g, "/dev/VG");
     if (r == -1)
       return -1;
   }
@@ -750,38 +733,20 @@ static int test_pvs_1 (void)
     char **r;
     int i;
     suppress_error = 0;
-    r = guestfs_pvs (g);
+    r = guestfs_vgs (g);
     if (r == NULL)
       return -1;
     if (!r[0]) {
-      fprintf (stderr, "test_pvs_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "/dev/sda1") != 0) {
-      fprintf (stderr, "test_pvs_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_pvs_1: short list returned from command\n");
+      fprintf (stderr, "test_lvremove_2: short list returned from command\n");
       print_strings (r);
       return -1;
     }
-    if (strcmp (r[1], "/dev/sda2") != 0) {
-      fprintf (stderr, "test_pvs_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
-      return -1;
-    }
-    if (!r[2]) {
-      fprintf (stderr, "test_pvs_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[2], "/dev/sda3") != 0) {
-      fprintf (stderr, "test_pvs_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
+    if (strcmp (r[0], "VG") != 0) {
+      fprintf (stderr, "test_lvremove_2: expected \"VG\" but got \"%s\"\n", r[0]);
       return -1;
     }
-    if (r[3] != NULL) {
-      fprintf (stderr, "test_pvs_1: extra elements returned from command\n");
+    if (r[1] != NULL) {
+      fprintf (stderr, "test_lvremove_2: extra elements returned from command\n");
       print_strings (r);
       return -1;
     }
@@ -792,9 +757,9 @@ static int test_pvs_1 (void)
   return 0;
 }
 
-static int test_vgs_0 (void)
+static int test_mount_ro_0 (void)
 {
-  /* InitBasicFSonLVM for vgs (0): create ext2 on /dev/VG/LV */
+  /* InitBasicFS for mount_ro (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -823,74 +788,45 @@ static int test_vgs_0 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
-    char *physvols[] = {
-      "/dev/sda1",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG", physvols);
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
+  /* TestLastFail for mount_ro (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV", "VG", 8);
+    r = guestfs_umount (g, "/");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+    r = guestfs_mount_ro (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
   {
     int r;
-    suppress_error = 0;
-    r = guestfs_mount (g, "/dev/VG/LV", "/");
-    if (r == -1)
-      return -1;
-  }
-  /* TestOutputList for vgs (0) */
-  {
-    char **r;
-    int i;
-    suppress_error = 0;
-    r = guestfs_vgs (g);
-    if (r == NULL)
-      return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_vgs_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "VG") != 0) {
-      fprintf (stderr, "test_vgs_0: expected \"VG\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (r[1] != NULL) {
-      fprintf (stderr, "test_vgs_0: extra elements returned from command\n");
-      print_strings (r);
+    suppress_error = 1;
+    r = guestfs_touch (g, "/new");
+    if (r != -1)
       return -1;
-    }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
-    free (r);
   }
   return 0;
 }
 
-static int test_vgs_1 (void)
+static int test_mount_ro_1 (void)
 {
-  /* InitEmpty for vgs (1) */
+  /* InitBasicFS for mount_ro (1): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -905,11 +841,8 @@ static int test_vgs_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for vgs (1) */
   {
     char *lines[] = {
-      ",10",
-      ",20",
       ",",
       NULL
     };
@@ -922,87 +855,57 @@ static int test_vgs_1 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda2");
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
+  /* TestOutput for mount_ro (1) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda3");
+    r = guestfs_write_file (g, "/new", "data", 0);
     if (r == -1)
       return -1;
   }
   {
-    char *physvols[] = {
-      "/dev/sda1",
-      "/dev/sda2",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG1", physvols);
+    r = guestfs_umount (g, "/");
     if (r == -1)
       return -1;
   }
   {
-    char *physvols[] = {
-      "/dev/sda3",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG2", physvols);
+    r = guestfs_mount_ro (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
   {
-    char **r;
-    int i;
+    char *r;
     suppress_error = 0;
-    r = guestfs_vgs (g);
+    r = guestfs_cat (g, "/new");
     if (r == NULL)
       return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_vgs_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "VG1") != 0) {
-      fprintf (stderr, "test_vgs_1: expected \"VG1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_vgs_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[1], "VG2") != 0) {
-      fprintf (stderr, "test_vgs_1: expected \"VG2\" but got \"%s\"\n", r[1]);
-      return -1;
-    }
-    if (r[2] != NULL) {
-      fprintf (stderr, "test_vgs_1: extra elements returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "data") != 0) {
+      fprintf (stderr, "test_mount_ro_1: expected \"data\" but got \"%s\"\n", r);
       return -1;
     }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_lvs_0 (void)
+static int test_tgz_in_0 (void)
 {
-  /* InitBasicFSonLVM for lvs (0): create ext2 on /dev/VG/LV */
+  /* InitBasicFS for tgz_in (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1031,74 +934,43 @@ static int test_lvs_0 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
-    if (r == -1)
-      return -1;
-  }
-  {
-    char *physvols[] = {
-      "/dev/sda1",
-      NULL
-    };
-    int r;
-    suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG", physvols);
-    if (r == -1)
-      return -1;
-  }
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV", "VG", 8);
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
+  /* TestOutput for tgz_in (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/VG/LV", "/");
+    r = guestfs_tgz_in (g, "images/helloworld.tar.gz", "/");
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for lvs (0) */
   {
-    char **r;
-    int i;
+    char *r;
     suppress_error = 0;
-    r = guestfs_lvs (g);
+    r = guestfs_cat (g, "/hello");
     if (r == NULL)
       return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_lvs_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "/dev/VG/LV") != 0) {
-      fprintf (stderr, "test_lvs_0: expected \"/dev/VG/LV\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (r[1] != NULL) {
-      fprintf (stderr, "test_lvs_0: extra elements returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "hello\n") != 0) {
+      fprintf (stderr, "test_tgz_in_0: expected \"hello\n\" but got \"%s\"\n", r);
       return -1;
     }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_lvs_1 (void)
+static int test_tar_in_0 (void)
 {
-  /* InitEmpty for lvs (1) */
+  /* InitBasicFS for tar_in (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1113,11 +985,8 @@ static int test_lvs_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for lvs (1) */
   {
     char *lines[] = {
-      ",10",
-      ",20",
       ",",
       NULL
     };
@@ -1130,117 +999,108 @@ static int test_lvs_1 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda2");
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
+  /* TestOutput for tar_in (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda3");
+    r = guestfs_tar_in (g, "images/helloworld.tar", "/");
     if (r == -1)
       return -1;
   }
   {
-    char *physvols[] = {
-      "/dev/sda1",
-      "/dev/sda2",
-      NULL
-    };
+    char *r;
+    suppress_error = 0;
+    r = guestfs_cat (g, "/hello");
+    if (r == NULL)
+      return -1;
+    if (strcmp (r, "hello\n") != 0) {
+      fprintf (stderr, "test_tar_in_0: expected \"hello\n\" but got \"%s\"\n", r);
+      return -1;
+    }
+    free (r);
+  }
+  return 0;
+}
+
+static int test_checksum_0 (void)
+{
+  /* InitBasicFS for checksum (0): create ext2 on /dev/sda1 */
+  {
     int r;
     suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG1", physvols);
+    r = guestfs_umount_all (g);
     if (r == -1)
       return -1;
   }
   {
-    char *physvols[] = {
-      "/dev/sda3",
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
       NULL
     };
     int r;
     suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG2", physvols);
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV1", "VG1", 50);
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV2", "VG1", 50);
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
+  /* TestOutput for checksum (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV3", "VG2", 50);
+    r = guestfs_write_file (g, "/new", "test\n", 0);
     if (r == -1)
       return -1;
   }
   {
-    char **r;
-    int i;
+    char *r;
     suppress_error = 0;
-    r = guestfs_lvs (g);
+    r = guestfs_checksum (g, "crc", "/new");
     if (r == NULL)
       return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_lvs_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
-      fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_lvs_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
-      fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
-      return -1;
-    }
-    if (!r[2]) {
-      fprintf (stderr, "test_lvs_1: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
-      fprintf (stderr, "test_lvs_1: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
-      return -1;
-    }
-    if (r[3] != NULL) {
-      fprintf (stderr, "test_lvs_1: extra elements returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "935282863") != 0) {
+      fprintf (stderr, "test_checksum_0: expected \"935282863\" but got \"%s\"\n", r);
       return -1;
     }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_read_lines_0 (void)
+static int test_checksum_1 (void)
 {
-  /* InitBasicFS for read_lines (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for checksum (1): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1280,63 +1140,21 @@ static int test_read_lines_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for read_lines (0) */
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_write_file (g, "/new", "line1\r\nline2\nline3", 0);
-    if (r == -1)
-      return -1;
-  }
+  /* TestLastFail for checksum (1) */
   {
-    char **r;
-    int i;
-    suppress_error = 0;
-    r = guestfs_read_lines (g, "/new");
-    if (r == NULL)
-      return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_read_lines_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "line1") != 0) {
-      fprintf (stderr, "test_read_lines_0: expected \"line1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_read_lines_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[1], "line2") != 0) {
-      fprintf (stderr, "test_read_lines_0: expected \"line2\" but got \"%s\"\n", r[1]);
-      return -1;
-    }
-    if (!r[2]) {
-      fprintf (stderr, "test_read_lines_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[2], "line3") != 0) {
-      fprintf (stderr, "test_read_lines_0: expected \"line3\" but got \"%s\"\n", r[2]);
-      return -1;
-    }
-    if (r[3] != NULL) {
-      fprintf (stderr, "test_read_lines_0: extra elements returned from command\n");
-      print_strings (r);
+    char *r;
+    suppress_error = 1;
+    r = guestfs_checksum (g, "crc", "/new");
+    if (r != NULL)
       return -1;
-    }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_read_lines_1 (void)
+static int test_checksum_2 (void)
 {
-  /* InitBasicFS for read_lines (1): create ext2 on /dev/sda1 */
+  /* InitBasicFS for checksum (2): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1376,36 +1194,32 @@ static int test_read_lines_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for read_lines (1) */
+  /* TestOutput for checksum (2) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_write_file (g, "/new", "", 0);
+    r = guestfs_write_file (g, "/new", "test\n", 0);
     if (r == -1)
       return -1;
   }
   {
-    char **r;
-    int i;
+    char *r;
     suppress_error = 0;
-    r = guestfs_read_lines (g, "/new");
+    r = guestfs_checksum (g, "md5", "/new");
     if (r == NULL)
       return -1;
-    if (r[0] != NULL) {
-      fprintf (stderr, "test_read_lines_1: extra elements returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "d8e8fca2dc0f896fd7cb4cb0031ba249") != 0) {
+      fprintf (stderr, "test_checksum_2: expected \"d8e8fca2dc0f896fd7cb4cb0031ba249\" but got \"%s\"\n", r);
       return -1;
     }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_rm_0 (void)
+static int test_checksum_3 (void)
 {
-  /* InitBasicFS for rm (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for checksum (3): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1445,27 +1259,32 @@ static int test_rm_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestRun for rm (0) */
+  /* TestOutput for checksum (3) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/new");
+    r = guestfs_write_file (g, "/new", "test\n", 0);
     if (r == -1)
       return -1;
   }
   {
-    int r;
+    char *r;
     suppress_error = 0;
-    r = guestfs_rm (g, "/new");
-    if (r == -1)
+    r = guestfs_checksum (g, "sha1", "/new");
+    if (r == NULL)
       return -1;
+    if (strcmp (r, "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83") != 0) {
+      fprintf (stderr, "test_checksum_3: expected \"4e1243bd22c66e76c2ba9eddc1f91394e57f9f83\" but got \"%s\"\n", r);
+      return -1;
+    }
+    free (r);
   }
   return 0;
 }
 
-static int test_rm_1 (void)
+static int test_checksum_4 (void)
 {
-  /* InitBasicFS for rm (1): create ext2 on /dev/sda1 */
+  /* InitBasicFS for checksum (4): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1505,20 +1324,32 @@ static int test_rm_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestLastFail for rm (1) */
+  /* TestOutput for checksum (4) */
   {
     int r;
-    suppress_error = 1;
-    r = guestfs_rm (g, "/new");
-    if (r != -1)
+    suppress_error = 0;
+    r = guestfs_write_file (g, "/new", "test\n", 0);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *r;
+    suppress_error = 0;
+    r = guestfs_checksum (g, "sha224", "/new");
+    if (r == NULL)
+      return -1;
+    if (strcmp (r, "52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec") != 0) {
+      fprintf (stderr, "test_checksum_4: expected \"52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec\" but got \"%s\"\n", r);
       return -1;
+    }
+    free (r);
   }
   return 0;
 }
 
-static int test_rm_2 (void)
+static int test_checksum_5 (void)
 {
-  /* InitBasicFS for rm (2): create ext2 on /dev/sda1 */
+  /* InitBasicFS for checksum (5): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1558,27 +1389,32 @@ static int test_rm_2 (void)
     if (r == -1)
       return -1;
   }
-  /* TestLastFail for rm (2) */
+  /* TestOutput for checksum (5) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir (g, "/new");
+    r = guestfs_write_file (g, "/new", "test\n", 0);
     if (r == -1)
       return -1;
   }
   {
-    int r;
-    suppress_error = 1;
-    r = guestfs_rm (g, "/new");
-    if (r != -1)
+    char *r;
+    suppress_error = 0;
+    r = guestfs_checksum (g, "sha256", "/new");
+    if (r == NULL)
+      return -1;
+    if (strcmp (r, "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2") != 0) {
+      fprintf (stderr, "test_checksum_5: expected \"f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2\" but got \"%s\"\n", r);
       return -1;
+    }
+    free (r);
   }
   return 0;
 }
 
-static int test_rmdir_0 (void)
+static int test_checksum_6 (void)
 {
-  /* InitBasicFS for rmdir (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for checksum (6): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1618,27 +1454,32 @@ static int test_rmdir_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestRun for rmdir (0) */
+  /* TestOutput for checksum (6) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir (g, "/new");
+    r = guestfs_write_file (g, "/new", "test\n", 0);
     if (r == -1)
       return -1;
   }
   {
-    int r;
+    char *r;
     suppress_error = 0;
-    r = guestfs_rmdir (g, "/new");
-    if (r == -1)
+    r = guestfs_checksum (g, "sha384", "/new");
+    if (r == NULL)
+      return -1;
+    if (strcmp (r, "109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d") != 0) {
+      fprintf (stderr, "test_checksum_6: expected \"109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d\" but got \"%s\"\n", r);
       return -1;
+    }
+    free (r);
   }
   return 0;
 }
 
-static int test_rmdir_1 (void)
+static int test_checksum_7 (void)
 {
-  /* InitBasicFS for rmdir (1): create ext2 on /dev/sda1 */
+  /* InitBasicFS for checksum (7): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1678,20 +1519,32 @@ static int test_rmdir_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestLastFail for rmdir (1) */
+  /* TestOutput for checksum (7) */
   {
     int r;
-    suppress_error = 1;
-    r = guestfs_rmdir (g, "/new");
-    if (r != -1)
+    suppress_error = 0;
+    r = guestfs_write_file (g, "/new", "test\n", 0);
+    if (r == -1)
       return -1;
   }
-  return 0;
-}
+  {
+    char *r;
+    suppress_error = 0;
+    r = guestfs_checksum (g, "sha512", "/new");
+    if (r == NULL)
+      return -1;
+    if (strcmp (r, "0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123") != 0) {
+      fprintf (stderr, "test_checksum_7: expected \"0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123\" but got \"%s\"\n", r);
+      return -1;
+    }
+    free (r);
+  }
+  return 0;
+}
 
-static int test_rmdir_2 (void)
+static int test_download_0 (void)
 {
-  /* InitBasicFS for rmdir (2): create ext2 on /dev/sda1 */
+  /* InitBasicFS for download (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1731,27 +1584,46 @@ static int test_rmdir_2 (void)
     if (r == -1)
       return -1;
   }
-  /* TestLastFail for rmdir (2) */
+  /* TestOutput for download (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/new");
+    r = guestfs_upload (g, "COPYING.LIB", "/COPYING.LIB");
     if (r == -1)
       return -1;
   }
   {
     int r;
-    suppress_error = 1;
-    r = guestfs_rmdir (g, "/new");
-    if (r != -1)
+    suppress_error = 0;
+    r = guestfs_download (g, "/COPYING.LIB", "testdownload.tmp");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_upload (g, "testdownload.tmp", "/upload");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *r;
+    suppress_error = 0;
+    r = guestfs_checksum (g, "md5", "/upload");
+    if (r == NULL)
       return -1;
+    if (strcmp (r, "e3eda01d9815f8d24aae2dbd89b68b06") != 0) {
+      fprintf (stderr, "test_download_0: expected \"e3eda01d9815f8d24aae2dbd89b68b06\" but got \"%s\"\n", r);
+      return -1;
+    }
+    free (r);
   }
   return 0;
 }
 
-static int test_rm_rf_0 (void)
+static int test_upload_0 (void)
 {
-  /* InitBasicFS for rm_rf (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for upload (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -1791,52 +1663,60 @@ static int test_rm_rf_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputFalse for rm_rf (0) */
+  /* TestOutput for upload (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir (g, "/new");
+    r = guestfs_upload (g, "COPYING.LIB", "/COPYING.LIB");
     if (r == -1)
       return -1;
   }
   {
-    int r;
+    char *r;
     suppress_error = 0;
-    r = guestfs_mkdir (g, "/new/foo");
-    if (r == -1)
+    r = guestfs_checksum (g, "md5", "/COPYING.LIB");
+    if (r == NULL)
       return -1;
+    if (strcmp (r, "e3eda01d9815f8d24aae2dbd89b68b06") != 0) {
+      fprintf (stderr, "test_upload_0: expected \"e3eda01d9815f8d24aae2dbd89b68b06\" but got \"%s\"\n", r);
+      return -1;
+    }
+    free (r);
   }
+  return 0;
+}
+
+static int test_blockdev_rereadpt_0 (void)
+{
+  /* InitEmpty for blockdev_rereadpt (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/new/foo/bar");
+    r = guestfs_umount_all (g);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_rm_rf (g, "/new");
+    r = guestfs_lvm_remove_all (g);
     if (r == -1)
       return -1;
   }
+  /* TestRun for blockdev_rereadpt (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_exists (g, "/new");
+    r = guestfs_blockdev_rereadpt (g, "/dev/sda");
     if (r == -1)
       return -1;
-    if (r) {
-      fprintf (stderr, "test_rm_rf_0: expected false, got true\n");
-      return -1;
-    }
   }
   return 0;
 }
 
-static int test_mkdir_0 (void)
+static int test_blockdev_flushbufs_0 (void)
 {
-  /* InitBasicFS for mkdir (0): create ext2 on /dev/sda1 */
+  /* InitEmpty for blockdev_flushbufs (0) */
   {
     int r;
     suppress_error = 0;
@@ -1851,56 +1731,52 @@ static int test_mkdir_0 (void)
     if (r == -1)
       return -1;
   }
-  {
-    char *lines[] = {
-      ",",
-      NULL
-    };
-    int r;
-    suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
-    if (r == -1)
-      return -1;
-  }
+  /* TestRun for blockdev_flushbufs (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_blockdev_flushbufs (g, "/dev/sda");
     if (r == -1)
       return -1;
   }
+  return 0;
+}
+
+static int test_blockdev_getsize64_0 (void)
+{
+  /* InitEmpty for blockdev_getsize64 (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_umount_all (g);
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for mkdir (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir (g, "/new");
+    r = guestfs_lvm_remove_all (g);
     if (r == -1)
       return -1;
   }
+  /* TestOutputInt for blockdev_getsize64 (0) */
   {
-    int r;
+    int64_t r;
     suppress_error = 0;
-    r = guestfs_is_dir (g, "/new");
+    r = guestfs_blockdev_getsize64 (g, "/dev/sda");
     if (r == -1)
       return -1;
-    if (!r) {
-      fprintf (stderr, "test_mkdir_0: expected true, got false\n");
+    if (r != 524288000) {
+      fprintf (stderr, "test_blockdev_getsize64_0: expected 524288000 but got %d\n",               (int) r);
       return -1;
     }
   }
   return 0;
 }
 
-static int test_mkdir_1 (void)
+static int test_blockdev_getsz_0 (void)
 {
-  /* InitBasicFS for mkdir (1): create ext2 on /dev/sda1 */
+  /* InitEmpty for blockdev_getsz (0) */
   {
     int r;
     suppress_error = 0;
@@ -1915,45 +1791,56 @@ static int test_mkdir_1 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutputInt for blockdev_getsz (0) */
   {
-    char *lines[] = {
-      ",",
-      NULL
-    };
-    int r;
+    int64_t r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_blockdev_getsz (g, "/dev/sda");
     if (r == -1)
       return -1;
+    if (r != 1024000) {
+      fprintf (stderr, "test_blockdev_getsz_0: expected 1024000 but got %d\n",               (int) r);
+      return -1;
+    }
   }
+  return 0;
+}
+
+static int test_blockdev_getbsz_0 (void)
+{
+  /* InitEmpty for blockdev_getbsz (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_umount_all (g);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_lvm_remove_all (g);
     if (r == -1)
       return -1;
   }
-  /* TestLastFail for mkdir (1) */
+  /* TestOutputInt for blockdev_getbsz (0) */
   {
     int r;
-    suppress_error = 1;
-    r = guestfs_mkdir (g, "/new/foo/bar");
-    if (r != -1)
+    suppress_error = 0;
+    r = guestfs_blockdev_getbsz (g, "/dev/sda");
+    if (r == -1)
+      return -1;
+    if (r != 4096) {
+      fprintf (stderr, "test_blockdev_getbsz_0: expected 4096 but got %d\n",               (int) r);
       return -1;
+    }
   }
   return 0;
 }
 
-static int test_mkdir_p_0 (void)
+static int test_blockdev_getss_0 (void)
 {
-  /* InitBasicFS for mkdir_p (0): create ext2 on /dev/sda1 */
+  /* InitEmpty for blockdev_getss (0) */
   {
     int r;
     suppress_error = 0;
@@ -1968,56 +1855,63 @@ static int test_mkdir_p_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutputInt for blockdev_getss (0) */
   {
-    char *lines[] = {
-      ",",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_blockdev_getss (g, "/dev/sda");
     if (r == -1)
       return -1;
+    if (r != 512) {
+      fprintf (stderr, "test_blockdev_getss_0: expected 512 but got %d\n",               (int) r);
+      return -1;
+    }
   }
+  return 0;
+}
+
+static int test_blockdev_getro_0 (void)
+{
+  /* InitEmpty for blockdev_getro (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_umount_all (g);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_lvm_remove_all (g);
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for mkdir_p (0) */
+  /* TestOutputTrue for blockdev_getro (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir_p (g, "/new/foo/bar");
+    r = guestfs_blockdev_setro (g, "/dev/sda");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_is_dir (g, "/new/foo/bar");
+    r = guestfs_blockdev_getro (g, "/dev/sda");
     if (r == -1)
       return -1;
     if (!r) {
-      fprintf (stderr, "test_mkdir_p_0: expected true, got false\n");
+      fprintf (stderr, "test_blockdev_getro_0: expected true, got false\n");
       return -1;
     }
   }
   return 0;
 }
 
-static int test_mkdir_p_1 (void)
+static int test_blockdev_setrw_0 (void)
 {
-  /* InitBasicFS for mkdir_p (1): create ext2 on /dev/sda1 */
+  /* InitEmpty for blockdev_setrw (0) */
   {
     int r;
     suppress_error = 0;
@@ -2032,56 +1926,70 @@ static int test_mkdir_p_1 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutputFalse for blockdev_setrw (0) */
   {
-    char *lines[] = {
-      ",",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_blockdev_setrw (g, "/dev/sda");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_blockdev_getro (g, "/dev/sda");
     if (r == -1)
       return -1;
+    if (r) {
+      fprintf (stderr, "test_blockdev_setrw_0: expected false, got true\n");
+      return -1;
+    }
   }
+  return 0;
+}
+
+static int test_blockdev_setro_0 (void)
+{
+  /* InitEmpty for blockdev_setro (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_umount_all (g);
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for mkdir_p (1) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir_p (g, "/new/foo/bar");
+    r = guestfs_lvm_remove_all (g);
     if (r == -1)
       return -1;
   }
+  /* TestOutputTrue for blockdev_setro (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_is_dir (g, "/new/foo");
+    r = guestfs_blockdev_setro (g, "/dev/sda");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_blockdev_getro (g, "/dev/sda");
     if (r == -1)
       return -1;
     if (!r) {
-      fprintf (stderr, "test_mkdir_p_1: expected true, got false\n");
+      fprintf (stderr, "test_blockdev_setro_0: expected true, got false\n");
       return -1;
     }
   }
   return 0;
 }
 
-static int test_mkdir_p_2 (void)
+static int test_statvfs_0 (void)
 {
-  /* InitBasicFS for mkdir_p (2): create ext2 on /dev/sda1 */
+  /* InitBasicFS for statvfs (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2121,31 +2029,36 @@ static int test_mkdir_p_2 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for mkdir_p (2) */
+  /* TestOutputStruct for statvfs (0) */
   {
-    int r;
+    struct guestfs_statvfs *r;
     suppress_error = 0;
-    r = guestfs_mkdir_p (g, "/new/foo/bar");
-    if (r == -1)
+    r = guestfs_statvfs (g, "/");
+    if (r == NULL)
       return -1;
-  }
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_is_dir (g, "/new");
-    if (r == -1)
+    if (r->bfree != 487702) {
+      fprintf (stderr, "test_statvfs_0: bfree was %d, expected 487702\n",
+               (int) r->bfree);
       return -1;
-    if (!r) {
-      fprintf (stderr, "test_mkdir_p_2: expected true, got false\n");
+    }
+    if (r->blocks != 490020) {
+      fprintf (stderr, "test_statvfs_0: blocks was %d, expected 490020\n",
+               (int) r->blocks);
+      return -1;
+    }
+    if (r->bsize != 1024) {
+      fprintf (stderr, "test_statvfs_0: bsize was %d, expected 1024\n",
+               (int) r->bsize);
       return -1;
     }
+    free (r);
   }
   return 0;
 }
 
-static int test_exists_0 (void)
+static int test_lstat_0 (void)
 {
-  /* InitBasicFS for exists (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for lstat (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2185,7 +2098,7 @@ static int test_exists_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for exists (0) */
+  /* TestOutputStruct for lstat (0) */
   {
     int r;
     suppress_error = 0;
@@ -2194,22 +2107,24 @@ static int test_exists_0 (void)
       return -1;
   }
   {
-    int r;
+    struct guestfs_stat *r;
     suppress_error = 0;
-    r = guestfs_exists (g, "/new");
-    if (r == -1)
+    r = guestfs_lstat (g, "/new");
+    if (r == NULL)
       return -1;
-    if (!r) {
-      fprintf (stderr, "test_exists_0: expected true, got false\n");
+    if (r->size != 0) {
+      fprintf (stderr, "test_lstat_0: size was %d, expected 0\n",
+               (int) r->size);
       return -1;
     }
+    free (r);
   }
   return 0;
 }
 
-static int test_exists_1 (void)
+static int test_stat_0 (void)
 {
-  /* InitBasicFS for exists (1): create ext2 on /dev/sda1 */
+  /* InitBasicFS for stat (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2249,31 +2164,33 @@ static int test_exists_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for exists (1) */
+  /* TestOutputStruct for stat (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir (g, "/new");
+    r = guestfs_touch (g, "/new");
     if (r == -1)
       return -1;
   }
   {
-    int r;
+    struct guestfs_stat *r;
     suppress_error = 0;
-    r = guestfs_exists (g, "/new");
-    if (r == -1)
+    r = guestfs_stat (g, "/new");
+    if (r == NULL)
       return -1;
-    if (!r) {
-      fprintf (stderr, "test_exists_1: expected true, got false\n");
+    if (r->size != 0) {
+      fprintf (stderr, "test_stat_0: size was %d, expected 0\n",
+               (int) r->size);
       return -1;
     }
+    free (r);
   }
   return 0;
 }
 
-static int test_is_file_0 (void)
+static int test_file_0 (void)
 {
-  /* InitBasicFS for is_file (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for file (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2313,7 +2230,7 @@ static int test_is_file_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for is_file (0) */
+  /* TestOutput for file (0) */
   {
     int r;
     suppress_error = 0;
@@ -2322,22 +2239,23 @@ static int test_is_file_0 (void)
       return -1;
   }
   {
-    int r;
+    char *r;
     suppress_error = 0;
-    r = guestfs_is_file (g, "/new");
-    if (r == -1)
+    r = guestfs_file (g, "/new");
+    if (r == NULL)
       return -1;
-    if (!r) {
-      fprintf (stderr, "test_is_file_0: expected true, got false\n");
+    if (strcmp (r, "empty") != 0) {
+      fprintf (stderr, "test_file_0: expected \"empty\" but got \"%s\"\n", r);
       return -1;
     }
+    free (r);
   }
   return 0;
 }
 
-static int test_is_file_1 (void)
+static int test_file_1 (void)
 {
-  /* InitBasicFS for is_file (1): create ext2 on /dev/sda1 */
+  /* InitBasicFS for file (1): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2377,31 +2295,32 @@ static int test_is_file_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputFalse for is_file (1) */
+  /* TestOutput for file (1) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir (g, "/new");
+    r = guestfs_write_file (g, "/new", "some content\n", 0);
     if (r == -1)
       return -1;
   }
   {
-    int r;
+    char *r;
     suppress_error = 0;
-    r = guestfs_is_file (g, "/new");
-    if (r == -1)
+    r = guestfs_file (g, "/new");
+    if (r == NULL)
       return -1;
-    if (r) {
-      fprintf (stderr, "test_is_file_1: expected false, got true\n");
+    if (strcmp (r, "ASCII text") != 0) {
+      fprintf (stderr, "test_file_1: expected \"ASCII text\" but got \"%s\"\n", r);
       return -1;
     }
+    free (r);
   }
   return 0;
 }
 
-static int test_is_dir_0 (void)
+static int test_file_2 (void)
 {
-  /* InitBasicFS for is_dir (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for file (2): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2441,31 +2360,21 @@ static int test_is_dir_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputFalse for is_dir (0) */
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_touch (g, "/new");
-    if (r == -1)
-      return -1;
-  }
+  /* TestLastFail for file (2) */
   {
-    int r;
-    suppress_error = 0;
-    r = guestfs_is_dir (g, "/new");
-    if (r == -1)
-      return -1;
-    if (r) {
-      fprintf (stderr, "test_is_dir_0: expected false, got true\n");
+    char *r;
+    suppress_error = 1;
+    r = guestfs_file (g, "/nofile");
+    if (r != NULL)
       return -1;
-    }
+    free (r);
   }
   return 0;
 }
 
-static int test_is_dir_1 (void)
+static int test_umount_all_0 (void)
 {
-  /* InitBasicFS for is_dir (1): create ext2 on /dev/sda1 */
+  /* InitBasicFS for umount_all (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2505,31 +2414,36 @@ static int test_is_dir_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputTrue for is_dir (1) */
+  /* TestOutputList for umount_all (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkdir (g, "/new");
+    r = guestfs_umount_all (g);
     if (r == -1)
       return -1;
   }
   {
-    int r;
+    char **r;
+    int i;
     suppress_error = 0;
-    r = guestfs_is_dir (g, "/new");
-    if (r == -1)
+    r = guestfs_mounts (g);
+    if (r == NULL)
       return -1;
-    if (!r) {
-      fprintf (stderr, "test_is_dir_1: expected true, got false\n");
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_umount_all_0: extra elements returned from command\n");
+      print_strings (r);
       return -1;
     }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
   }
   return 0;
 }
 
-static int test_pvcreate_0 (void)
+static int test_mounts_0 (void)
 {
-  /* InitEmpty for pvcreate (0) */
+  /* InitBasicFS for mounts (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2544,11 +2458,8 @@ static int test_pvcreate_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for pvcreate (0) */
   {
     char *lines[] = {
-      ",10",
-      ",20",
       ",",
       NULL
     };
@@ -2561,60 +2472,36 @@ static int test_pvcreate_0 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
-    if (r == -1)
-      return -1;
-  }
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda2");
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda3");
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
+  /* TestOutputList for mounts (0) */
   {
     char **r;
     int i;
     suppress_error = 0;
-    r = guestfs_pvs (g);
+    r = guestfs_mounts (g);
     if (r == NULL)
       return -1;
     if (!r[0]) {
-      fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
+      fprintf (stderr, "test_mounts_0: short list returned from command\n");
       print_strings (r);
       return -1;
     }
     if (strcmp (r[0], "/dev/sda1") != 0) {
-      fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[1], "/dev/sda2") != 0) {
-      fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
-      return -1;
-    }
-    if (!r[2]) {
-      fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[2], "/dev/sda3") != 0) {
-      fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
+      fprintf (stderr, "test_mounts_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
       return -1;
     }
-    if (r[3] != NULL) {
-      fprintf (stderr, "test_pvcreate_0: extra elements returned from command\n");
+    if (r[1] != NULL) {
+      fprintf (stderr, "test_mounts_0: extra elements returned from command\n");
       print_strings (r);
       return -1;
     }
@@ -2625,9 +2512,9 @@ static int test_pvcreate_0 (void)
   return 0;
 }
 
-static int test_vgcreate_0 (void)
+static int test_umount_0 (void)
 {
-  /* InitEmpty for vgcreate (0) */
+  /* InitEmpty for umount (0) */
   {
     int r;
     suppress_error = 0;
@@ -2642,11 +2529,9 @@ static int test_vgcreate_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for vgcreate (0) */
+  /* TestOutputList for umount (0) */
   {
     char *lines[] = {
-      ",10",
-      ",20",
       ",",
       NULL
     };
@@ -2659,44 +2544,14 @@ static int test_vgcreate_0 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
-    if (r == -1)
-      return -1;
-  }
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda2");
-    if (r == -1)
-      return -1;
-  }
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda3");
-    if (r == -1)
-      return -1;
-  }
-  {
-    char *physvols[] = {
-      "/dev/sda1",
-      "/dev/sda2",
-      NULL
-    };
-    int r;
-    suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG1", physvols);
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
-    char *physvols[] = {
-      "/dev/sda3",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG2", physvols);
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
@@ -2704,29 +2559,20 @@ static int test_vgcreate_0 (void)
     char **r;
     int i;
     suppress_error = 0;
-    r = guestfs_vgs (g);
+    r = guestfs_mounts (g);
     if (r == NULL)
       return -1;
     if (!r[0]) {
-      fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[0], "VG1") != 0) {
-      fprintf (stderr, "test_vgcreate_0: expected \"VG1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
+      fprintf (stderr, "test_umount_0: short list returned from command\n");
       print_strings (r);
       return -1;
     }
-    if (strcmp (r[1], "VG2") != 0) {
-      fprintf (stderr, "test_vgcreate_0: expected \"VG2\" but got \"%s\"\n", r[1]);
+    if (strcmp (r[0], "/dev/sda1") != 0) {
+      fprintf (stderr, "test_umount_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
       return -1;
     }
-    if (r[2] != NULL) {
-      fprintf (stderr, "test_vgcreate_0: extra elements returned from command\n");
+    if (r[1] != NULL) {
+      fprintf (stderr, "test_umount_0: extra elements returned from command\n");
       print_strings (r);
       return -1;
     }
@@ -2737,9 +2583,9 @@ static int test_vgcreate_0 (void)
   return 0;
 }
 
-static int test_lvcreate_0 (void)
+static int test_umount_1 (void)
 {
-  /* InitEmpty for lvcreate (0) */
+  /* InitEmpty for umount (1) */
   {
     int r;
     suppress_error = 0;
@@ -2754,11 +2600,9 @@ static int test_lvcreate_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for lvcreate (0) */
+  /* TestOutputList for umount (1) */
   {
     char *lines[] = {
-      ",10",
-      ",20",
       ",",
       NULL
     };
@@ -2771,154 +2615,116 @@ static int test_lvcreate_0 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda1");
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda2");
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_pvcreate (g, "/dev/sda3");
+    r = guestfs_umount (g, "/");
     if (r == -1)
       return -1;
   }
   {
-    char *physvols[] = {
-      "/dev/sda1",
-      "/dev/sda2",
-      NULL
-    };
-    int r;
+    char **r;
+    int i;
     suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG1", physvols);
-    if (r == -1)
+    r = guestfs_mounts (g);
+    if (r == NULL)
+      return -1;
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_umount_1: extra elements returned from command\n");
+      print_strings (r);
       return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
   }
+  return 0;
+}
+
+static int test_write_file_0 (void)
+{
+  /* InitBasicFS for write_file (0): create ext2 on /dev/sda1 */
   {
-    char *physvols[] = {
-      "/dev/sda3",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_vgcreate (g, "VG2", physvols);
+    r = guestfs_umount_all (g);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV1", "VG1", 50);
+    r = guestfs_lvm_remove_all (g);
     if (r == -1)
       return -1;
   }
   {
+    char *lines[] = {
+      ",",
+      NULL
+    };
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV2", "VG1", 50);
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV3", "VG2", 50);
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV4", "VG2", 50);
+    r = guestfs_mount (g, "/dev/sda1", "/");
     if (r == -1)
       return -1;
   }
+  /* TestOutput for write_file (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvcreate (g, "LV5", "VG2", 50);
+    r = guestfs_write_file (g, "/new", "new file contents", 0);
     if (r == -1)
       return -1;
   }
   {
-    char **r;
-    int i;
+    char *r;
     suppress_error = 0;
-    r = guestfs_lvs (g);
+    r = guestfs_cat (g, "/new");
     if (r == NULL)
       return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "new file contents") != 0) {
+      fprintf (stderr, "test_write_file_0: expected \"new file contents\" but got \"%s\"\n", r);
       return -1;
     }
-    if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
-      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
-      return -1;
-    }
-    if (!r[1]) {
-      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
-      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
-      return -1;
-    }
-    if (!r[2]) {
-      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
-      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
-      return -1;
-    }
-    if (!r[3]) {
-      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[3], "/dev/VG2/LV4") != 0) {
-      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV4\" but got \"%s\"\n", r[3]);
-      return -1;
-    }
-    if (!r[4]) {
-      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    if (strcmp (r[4], "/dev/VG2/LV5") != 0) {
-      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV5\" but got \"%s\"\n", r[4]);
-      return -1;
-    }
-    if (r[5] != NULL) {
-      fprintf (stderr, "test_lvcreate_0: extra elements returned from command\n");
-      print_strings (r);
-      return -1;
-    }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
-    free (r);
-  }
-  return 0;
-}
-
-static int test_mkfs_0 (void)
-{
-  /* InitEmpty for mkfs (0) */
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_umount_all (g);
-    if (r == -1)
+    free (r);
+  }
+  return 0;
+}
+
+static int test_write_file_1 (void)
+{
+  /* InitBasicFS for write_file (1): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
       return -1;
   }
   {
@@ -2928,7 +2734,6 @@ static int test_mkfs_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutput for mkfs (0) */
   {
     char *lines[] = {
       ",",
@@ -2954,10 +2759,11 @@ static int test_mkfs_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutput for write_file (1) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_write_file (g, "/new", "new file contents", 0);
+    r = guestfs_write_file (g, "/new", "\nnew file contents\n", 0);
     if (r == -1)
       return -1;
   }
@@ -2967,8 +2773,8 @@ static int test_mkfs_0 (void)
     r = guestfs_cat (g, "/new");
     if (r == NULL)
       return -1;
-    if (strcmp (r, "new file contents") != 0) {
-      fprintf (stderr, "test_mkfs_0: expected \"new file contents\" but got \"%s\"\n", r);
+    if (strcmp (r, "\nnew file contents\n") != 0) {
+      fprintf (stderr, "test_write_file_1: expected \"\nnew file contents\n\" but got \"%s\"\n", r);
       return -1;
     }
     free (r);
@@ -2976,9 +2782,9 @@ static int test_mkfs_0 (void)
   return 0;
 }
 
-static int test_write_file_0 (void)
+static int test_write_file_2 (void)
 {
-  /* InitEmpty for write_file (0) */
+  /* InitBasicFS for write_file (2): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -2993,7 +2799,6 @@ static int test_write_file_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutput for write_file (0) */
   {
     char *lines[] = {
       ",",
@@ -3019,10 +2824,11 @@ static int test_write_file_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutput for write_file (2) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_write_file (g, "/new", "new file contents", 0);
+    r = guestfs_write_file (g, "/new", "\n\n", 0);
     if (r == -1)
       return -1;
   }
@@ -3032,8 +2838,8 @@ static int test_write_file_0 (void)
     r = guestfs_cat (g, "/new");
     if (r == NULL)
       return -1;
-    if (strcmp (r, "new file contents") != 0) {
-      fprintf (stderr, "test_write_file_0: expected \"new file contents\" but got \"%s\"\n", r);
+    if (strcmp (r, "\n\n") != 0) {
+      fprintf (stderr, "test_write_file_2: expected \"\n\n\" but got \"%s\"\n", r);
       return -1;
     }
     free (r);
@@ -3041,9 +2847,9 @@ static int test_write_file_0 (void)
   return 0;
 }
 
-static int test_umount_0 (void)
+static int test_write_file_3 (void)
 {
-  /* InitEmpty for umount (0) */
+  /* InitBasicFS for write_file (3): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -3058,7 +2864,6 @@ static int test_umount_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for umount (0) */
   {
     char *lines[] = {
       ",",
@@ -3084,37 +2889,32 @@ static int test_umount_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutput for write_file (3) */
   {
-    char **r;
-    int i;
+    int r;
     suppress_error = 0;
-    r = guestfs_mounts (g);
-    if (r == NULL)
-      return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_umount_0: short list returned from command\n");
-      print_strings (r);
+    r = guestfs_write_file (g, "/new", "", 0);
+    if (r == -1)
       return -1;
-    }
-    if (strcmp (r[0], "/dev/sda1") != 0) {
-      fprintf (stderr, "test_umount_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
+  }
+  {
+    char *r;
+    suppress_error = 0;
+    r = guestfs_cat (g, "/new");
+    if (r == NULL)
       return -1;
-    }
-    if (r[1] != NULL) {
-      fprintf (stderr, "test_umount_0: extra elements returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "") != 0) {
+      fprintf (stderr, "test_write_file_3: expected \"\" but got \"%s\"\n", r);
       return -1;
     }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_umount_1 (void)
+static int test_write_file_4 (void)
 {
-  /* InitEmpty for umount (1) */
+  /* InitBasicFS for write_file (4): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -3129,7 +2929,6 @@ static int test_umount_1 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for umount (1) */
   {
     char *lines[] = {
       ",",
@@ -3155,35 +2954,32 @@ static int test_umount_1 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutput for write_file (4) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_umount (g, "/");
+    r = guestfs_write_file (g, "/new", "\n\n\n", 0);
     if (r == -1)
       return -1;
   }
   {
-    char **r;
-    int i;
+    char *r;
     suppress_error = 0;
-    r = guestfs_mounts (g);
+    r = guestfs_cat (g, "/new");
     if (r == NULL)
       return -1;
-    if (r[0] != NULL) {
-      fprintf (stderr, "test_umount_1: extra elements returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "\n\n\n") != 0) {
+      fprintf (stderr, "test_write_file_4: expected \"\n\n\n\" but got \"%s\"\n", r);
       return -1;
     }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_mounts_0 (void)
+static int test_write_file_5 (void)
 {
-  /* InitBasicFS for mounts (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for write_file (5): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -3223,38 +3019,32 @@ static int test_mounts_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for mounts (0) */
+  /* TestOutput for write_file (5) */
   {
-    char **r;
-    int i;
+    int r;
     suppress_error = 0;
-    r = guestfs_mounts (g);
-    if (r == NULL)
-      return -1;
-    if (!r[0]) {
-      fprintf (stderr, "test_mounts_0: short list returned from command\n");
-      print_strings (r);
+    r = guestfs_write_file (g, "/new", "\n", 0);
+    if (r == -1)
       return -1;
-    }
-    if (strcmp (r[0], "/dev/sda1") != 0) {
-      fprintf (stderr, "test_mounts_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
+  }
+  {
+    char *r;
+    suppress_error = 0;
+    r = guestfs_cat (g, "/new");
+    if (r == NULL)
       return -1;
-    }
-    if (r[1] != NULL) {
-      fprintf (stderr, "test_mounts_0: extra elements returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "\n") != 0) {
+      fprintf (stderr, "test_write_file_5: expected \"\n\" but got \"%s\"\n", r);
       return -1;
     }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_umount_all_0 (void)
+static int test_mkfs_0 (void)
 {
-  /* InitBasicFS for umount_all (0): create ext2 on /dev/sda1 */
+  /* InitEmpty for mkfs (0) */
   {
     int r;
     suppress_error = 0;
@@ -3269,6 +3059,7 @@ static int test_umount_all_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutput for mkfs (0) */
   {
     char *lines[] = {
       ",",
@@ -3294,36 +3085,31 @@ static int test_umount_all_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputList for umount_all (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_umount_all (g);
+    r = guestfs_write_file (g, "/new", "new file contents", 0);
     if (r == -1)
       return -1;
   }
   {
-    char **r;
-    int i;
+    char *r;
     suppress_error = 0;
-    r = guestfs_mounts (g);
+    r = guestfs_cat (g, "/new");
     if (r == NULL)
       return -1;
-    if (r[0] != NULL) {
-      fprintf (stderr, "test_umount_all_0: extra elements returned from command\n");
-      print_strings (r);
+    if (strcmp (r, "new file contents") != 0) {
+      fprintf (stderr, "test_mkfs_0: expected \"new file contents\" but got \"%s\"\n", r);
       return -1;
     }
-    for (i = 0; r[i] != NULL; ++i)
-      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_file_0 (void)
+static int test_lvcreate_0 (void)
 {
-  /* InitBasicFS for file (0): create ext2 on /dev/sda1 */
+  /* InitEmpty for lvcreate (0) */
   {
     int r;
     suppress_error = 0;
@@ -3338,8 +3124,11 @@ static int test_file_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutputList for lvcreate (0) */
   {
     char *lines[] = {
+      ",10",
+      ",20",
       ",",
       NULL
     };
@@ -3352,128 +3141,172 @@ static int test_file_0 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_pvcreate (g, "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_pvcreate (g, "/dev/sda2");
     if (r == -1)
       return -1;
   }
-  /* TestOutput for file (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/new");
+    r = guestfs_pvcreate (g, "/dev/sda3");
     if (r == -1)
       return -1;
   }
   {
-    char *r;
+    char *physvols[] = {
+      "/dev/sda1",
+      "/dev/sda2",
+      NULL
+    };
+    int r;
     suppress_error = 0;
-    r = guestfs_file (g, "/new");
-    if (r == NULL)
-      return -1;
-    if (strcmp (r, "empty") != 0) {
-      fprintf (stderr, "test_file_0: expected \"empty\" but got \"%s\"\n", r);
+    r = guestfs_vgcreate (g, "VG1", physvols);
+    if (r == -1)
       return -1;
-    }
-    free (r);
   }
-  return 0;
-}
-
-static int test_file_1 (void)
-{
-  /* InitBasicFS for file (1): create ext2 on /dev/sda1 */
   {
+    char *physvols[] = {
+      "/dev/sda3",
+      NULL
+    };
     int r;
     suppress_error = 0;
-    r = guestfs_umount_all (g);
+    r = guestfs_vgcreate (g, "VG2", physvols);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_lvm_remove_all (g);
+    r = guestfs_lvcreate (g, "LV1", "VG1", 50);
     if (r == -1)
       return -1;
   }
   {
-    char *lines[] = {
-      ",",
-      NULL
-    };
     int r;
     suppress_error = 0;
-    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    r = guestfs_lvcreate (g, "LV2", "VG1", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_lvcreate (g, "LV3", "VG2", 50);
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_lvcreate (g, "LV4", "VG2", 50);
     if (r == -1)
       return -1;
   }
-  /* TestOutput for file (1) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_write_file (g, "/new", "some content\n", 0);
+    r = guestfs_lvcreate (g, "LV5", "VG2", 50);
     if (r == -1)
       return -1;
   }
   {
-    char *r;
+    char **r;
+    int i;
     suppress_error = 0;
-    r = guestfs_file (g, "/new");
+    r = guestfs_lvs (g);
     if (r == NULL)
       return -1;
-    if (strcmp (r, "ASCII text") != 0) {
-      fprintf (stderr, "test_file_1: expected \"ASCII text\" but got \"%s\"\n", r);
+    if (!r[0]) {
+      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
+      print_strings (r);
       return -1;
     }
-    free (r);
-  }
-  return 0;
-}
-
-static int test_file_2 (void)
-{
-  /* InitBasicFS for file (2): create ext2 on /dev/sda1 */
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_umount_all (g);
-    if (r == -1)
+    if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
+      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
       return -1;
-  }
-  {
-    int r;
-    suppress_error = 0;
-    r = guestfs_lvm_remove_all (g);
-    if (r == -1)
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
+      print_strings (r);
       return -1;
-  }
-  {
-    char *lines[] = {
-      ",",
-      NULL
-    };
-    int r;
+    }
+    if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
+      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (!r[2]) {
+      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
+      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
+      return -1;
+    }
+    if (!r[3]) {
+      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[3], "/dev/VG2/LV4") != 0) {
+      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV4\" but got \"%s\"\n", r[3]);
+      return -1;
+    }
+    if (!r[4]) {
+      fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[4], "/dev/VG2/LV5") != 0) {
+      fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV5\" but got \"%s\"\n", r[4]);
+      return -1;
+    }
+    if (r[5] != NULL) {
+      fprintf (stderr, "test_lvcreate_0: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_vgcreate_0 (void)
+{
+  /* InitEmpty for vgcreate (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for vgcreate (0) */
+  {
+    char *lines[] = {
+      ",10",
+      ",20",
+      ",",
+      NULL
+    };
+    int r;
     suppress_error = 0;
     r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
     if (r == -1)
@@ -3482,32 +3315,87 @@ static int test_file_2 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_pvcreate (g, "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_pvcreate (g, "/dev/sda2");
     if (r == -1)
       return -1;
   }
-  /* TestLastFail for file (2) */
   {
-    char *r;
-    suppress_error = 1;
-    r = guestfs_file (g, "/nofile");
-    if (r != NULL)
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda3");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda1",
+      "/dev/sda2",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG1", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda3",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG2", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_vgs (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "VG1") != 0) {
+      fprintf (stderr, "test_vgcreate_0: expected \"VG1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "VG2") != 0) {
+      fprintf (stderr, "test_vgcreate_0: expected \"VG2\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (r[2] != NULL) {
+      fprintf (stderr, "test_vgcreate_0: extra elements returned from command\n");
+      print_strings (r);
       return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_stat_0 (void)
+static int test_pvcreate_0 (void)
 {
-  /* InitBasicFS for stat (0): create ext2 on /dev/sda1 */
+  /* InitEmpty for pvcreate (0) */
   {
     int r;
     suppress_error = 0;
@@ -3522,8 +3410,11 @@ static int test_stat_0 (void)
     if (r == -1)
       return -1;
   }
+  /* TestOutputList for pvcreate (0) */
   {
     char *lines[] = {
+      ",10",
+      ",20",
       ",",
       NULL
     };
@@ -3536,44 +3427,73 @@ static int test_stat_0 (void)
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    r = guestfs_pvcreate (g, "/dev/sda1");
     if (r == -1)
       return -1;
   }
   {
     int r;
     suppress_error = 0;
-    r = guestfs_mount (g, "/dev/sda1", "/");
+    r = guestfs_pvcreate (g, "/dev/sda2");
     if (r == -1)
       return -1;
   }
-  /* TestOutputStruct for stat (0) */
   {
     int r;
     suppress_error = 0;
-    r = guestfs_touch (g, "/new");
+    r = guestfs_pvcreate (g, "/dev/sda3");
     if (r == -1)
       return -1;
   }
   {
-    struct guestfs_stat *r;
+    char **r;
+    int i;
     suppress_error = 0;
-    r = guestfs_stat (g, "/new");
+    r = guestfs_pvs (g);
     if (r == NULL)
       return -1;
-    if (r->size != 0) {
-      fprintf (stderr, "test_stat_0: size was %d, expected 0\n",
-               (int) r->size);
+    if (!r[0]) {
+      fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "/dev/sda1") != 0) {
+      fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "/dev/sda2") != 0) {
+      fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (!r[2]) {
+      fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[2], "/dev/sda3") != 0) {
+      fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
+      return -1;
+    }
+    if (r[3] != NULL) {
+      fprintf (stderr, "test_pvcreate_0: extra elements returned from command\n");
+      print_strings (r);
       return -1;
     }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
     free (r);
   }
   return 0;
 }
 
-static int test_lstat_0 (void)
+static int test_is_dir_0 (void)
 {
-  /* InitBasicFS for lstat (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for is_dir (0): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -3613,7 +3533,7 @@ static int test_lstat_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputStruct for lstat (0) */
+  /* TestOutputFalse for is_dir (0) */
   {
     int r;
     suppress_error = 0;
@@ -3622,24 +3542,22 @@ static int test_lstat_0 (void)
       return -1;
   }
   {
-    struct guestfs_stat *r;
+    int r;
     suppress_error = 0;
-    r = guestfs_lstat (g, "/new");
-    if (r == NULL)
+    r = guestfs_is_dir (g, "/new");
+    if (r == -1)
       return -1;
-    if (r->size != 0) {
-      fprintf (stderr, "test_lstat_0: size was %d, expected 0\n",
-               (int) r->size);
+    if (r) {
+      fprintf (stderr, "test_is_dir_0: expected false, got true\n");
       return -1;
     }
-    free (r);
   }
   return 0;
 }
 
-static int test_statvfs_0 (void)
+static int test_is_dir_1 (void)
 {
-  /* InitBasicFS for statvfs (0): create ext2 on /dev/sda1 */
+  /* InitBasicFS for is_dir (1): create ext2 on /dev/sda1 */
   {
     int r;
     suppress_error = 0;
@@ -3679,401 +3597,3016 @@ static int test_statvfs_0 (void)
     if (r == -1)
       return -1;
   }
-  /* TestOutputStruct for statvfs (0) */
+  /* TestOutputTrue for is_dir (1) */
   {
-    struct guestfs_statvfs *r;
+    int r;
     suppress_error = 0;
-    r = guestfs_statvfs (g, "/");
-    if (r == NULL)
-      return -1;
-    if (r->bfree != 487702) {
-      fprintf (stderr, "test_statvfs_0: bfree was %d, expected 487702\n",
-               (int) r->bfree);
+    r = guestfs_mkdir (g, "/new");
+    if (r == -1)
       return -1;
-    }
-    if (r->blocks != 490020) {
-      fprintf (stderr, "test_statvfs_0: blocks was %d, expected 490020\n",
-               (int) r->blocks);
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_is_dir (g, "/new");
+    if (r == -1)
       return -1;
-    }
-    if (r->bsize != 1024) {
-      fprintf (stderr, "test_statvfs_0: bsize was %d, expected 1024\n",
-               (int) r->bsize);
+    if (!r) {
+      fprintf (stderr, "test_is_dir_1: expected true, got false\n");
       return -1;
     }
-    free (r);
   }
   return 0;
 }
 
-int main (int argc, char *argv[])
+static int test_is_file_0 (void)
 {
-  char c = 0;
-  int failed = 0;
-  const char *srcdir;
-  int fd;
-  char buf[256];
-  int nr_tests;
-
-  g = guestfs_create ();
-  if (g == NULL) {
-    printf ("guestfs_create FAILED\n");
-    exit (1);
-  }
+  /* InitBasicFS for is_file (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputTrue for is_file (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_is_file (g, "/new");
+    if (r == -1)
+      return -1;
+    if (!r) {
+      fprintf (stderr, "test_is_file_0: expected true, got false\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_is_file_1 (void)
+{
+  /* InitBasicFS for is_file (1): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputFalse for is_file (1) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_is_file (g, "/new");
+    if (r == -1)
+      return -1;
+    if (r) {
+      fprintf (stderr, "test_is_file_1: expected false, got true\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_exists_0 (void)
+{
+  /* InitBasicFS for exists (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputTrue for exists (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_exists (g, "/new");
+    if (r == -1)
+      return -1;
+    if (!r) {
+      fprintf (stderr, "test_exists_0: expected true, got false\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_exists_1 (void)
+{
+  /* InitBasicFS for exists (1): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputTrue for exists (1) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_exists (g, "/new");
+    if (r == -1)
+      return -1;
+    if (!r) {
+      fprintf (stderr, "test_exists_1: expected true, got false\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_mkdir_p_0 (void)
+{
+  /* InitBasicFS for mkdir_p (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputTrue for mkdir_p (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir_p (g, "/new/foo/bar");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_is_dir (g, "/new/foo/bar");
+    if (r == -1)
+      return -1;
+    if (!r) {
+      fprintf (stderr, "test_mkdir_p_0: expected true, got false\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_mkdir_p_1 (void)
+{
+  /* InitBasicFS for mkdir_p (1): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputTrue for mkdir_p (1) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir_p (g, "/new/foo/bar");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_is_dir (g, "/new/foo");
+    if (r == -1)
+      return -1;
+    if (!r) {
+      fprintf (stderr, "test_mkdir_p_1: expected true, got false\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_mkdir_p_2 (void)
+{
+  /* InitBasicFS for mkdir_p (2): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputTrue for mkdir_p (2) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir_p (g, "/new/foo/bar");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_is_dir (g, "/new");
+    if (r == -1)
+      return -1;
+    if (!r) {
+      fprintf (stderr, "test_mkdir_p_2: expected true, got false\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_mkdir_0 (void)
+{
+  /* InitBasicFS for mkdir (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputTrue for mkdir (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_is_dir (g, "/new");
+    if (r == -1)
+      return -1;
+    if (!r) {
+      fprintf (stderr, "test_mkdir_0: expected true, got false\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_mkdir_1 (void)
+{
+  /* InitBasicFS for mkdir (1): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestLastFail for mkdir (1) */
+  {
+    int r;
+    suppress_error = 1;
+    r = guestfs_mkdir (g, "/new/foo/bar");
+    if (r != -1)
+      return -1;
+  }
+  return 0;
+}
+
+static int test_rm_rf_0 (void)
+{
+  /* InitBasicFS for rm_rf (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputFalse for rm_rf (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir (g, "/new/foo");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/new/foo/bar");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_rm_rf (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_exists (g, "/new");
+    if (r == -1)
+      return -1;
+    if (r) {
+      fprintf (stderr, "test_rm_rf_0: expected false, got true\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_rmdir_0 (void)
+{
+  /* InitBasicFS for rmdir (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestRun for rmdir (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_rmdir (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  return 0;
+}
+
+static int test_rmdir_1 (void)
+{
+  /* InitBasicFS for rmdir (1): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestLastFail for rmdir (1) */
+  {
+    int r;
+    suppress_error = 1;
+    r = guestfs_rmdir (g, "/new");
+    if (r != -1)
+      return -1;
+  }
+  return 0;
+}
+
+static int test_rmdir_2 (void)
+{
+  /* InitBasicFS for rmdir (2): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestLastFail for rmdir (2) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 1;
+    r = guestfs_rmdir (g, "/new");
+    if (r != -1)
+      return -1;
+  }
+  return 0;
+}
+
+static int test_rm_0 (void)
+{
+  /* InitBasicFS for rm (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestRun for rm (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_rm (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  return 0;
+}
+
+static int test_rm_1 (void)
+{
+  /* InitBasicFS for rm (1): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestLastFail for rm (1) */
+  {
+    int r;
+    suppress_error = 1;
+    r = guestfs_rm (g, "/new");
+    if (r != -1)
+      return -1;
+  }
+  return 0;
+}
+
+static int test_rm_2 (void)
+{
+  /* InitBasicFS for rm (2): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestLastFail for rm (2) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkdir (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 1;
+    r = guestfs_rm (g, "/new");
+    if (r != -1)
+      return -1;
+  }
+  return 0;
+}
+
+static int test_read_lines_0 (void)
+{
+  /* InitBasicFS for read_lines (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for read_lines (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_write_file (g, "/new", "line1\r\nline2\nline3", 0);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_read_lines (g, "/new");
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_read_lines_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "line1") != 0) {
+      fprintf (stderr, "test_read_lines_0: expected \"line1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_read_lines_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "line2") != 0) {
+      fprintf (stderr, "test_read_lines_0: expected \"line2\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (!r[2]) {
+      fprintf (stderr, "test_read_lines_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[2], "line3") != 0) {
+      fprintf (stderr, "test_read_lines_0: expected \"line3\" but got \"%s\"\n", r[2]);
+      return -1;
+    }
+    if (r[3] != NULL) {
+      fprintf (stderr, "test_read_lines_0: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_read_lines_1 (void)
+{
+  /* InitBasicFS for read_lines (1): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for read_lines (1) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_write_file (g, "/new", "", 0);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_read_lines (g, "/new");
+    if (r == NULL)
+      return -1;
+    if (r[0] != NULL) {
+      fprintf (stderr, "test_read_lines_1: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_lvs_0 (void)
+{
+  /* InitBasicFSonLVM for lvs (0): create ext2 on /dev/VG/LV */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda1",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvcreate (g, "LV", "VG", 8);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/VG/LV", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for lvs (0) */
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_lvs (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_lvs_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "/dev/VG/LV") != 0) {
+      fprintf (stderr, "test_lvs_0: expected \"/dev/VG/LV\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (r[1] != NULL) {
+      fprintf (stderr, "test_lvs_0: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_lvs_1 (void)
+{
+  /* InitEmpty for lvs (1) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for lvs (1) */
+  {
+    char *lines[] = {
+      ",10",
+      ",20",
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda2");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda3");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda1",
+      "/dev/sda2",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG1", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda3",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG2", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvcreate (g, "LV1", "VG1", 50);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvcreate (g, "LV2", "VG1", 50);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvcreate (g, "LV3", "VG2", 50);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_lvs (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_lvs_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
+      fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_lvs_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
+      fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (!r[2]) {
+      fprintf (stderr, "test_lvs_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
+      fprintf (stderr, "test_lvs_1: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
+      return -1;
+    }
+    if (r[3] != NULL) {
+      fprintf (stderr, "test_lvs_1: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_vgs_0 (void)
+{
+  /* InitBasicFSonLVM for vgs (0): create ext2 on /dev/VG/LV */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda1",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvcreate (g, "LV", "VG", 8);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/VG/LV", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for vgs (0) */
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_vgs (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_vgs_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "VG") != 0) {
+      fprintf (stderr, "test_vgs_0: expected \"VG\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (r[1] != NULL) {
+      fprintf (stderr, "test_vgs_0: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_vgs_1 (void)
+{
+  /* InitEmpty for vgs (1) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for vgs (1) */
+  {
+    char *lines[] = {
+      ",10",
+      ",20",
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda2");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda3");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda1",
+      "/dev/sda2",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG1", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda3",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG2", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_vgs (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_vgs_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "VG1") != 0) {
+      fprintf (stderr, "test_vgs_1: expected \"VG1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_vgs_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "VG2") != 0) {
+      fprintf (stderr, "test_vgs_1: expected \"VG2\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (r[2] != NULL) {
+      fprintf (stderr, "test_vgs_1: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_pvs_0 (void)
+{
+  /* InitBasicFSonLVM for pvs (0): create ext2 on /dev/VG/LV */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *physvols[] = {
+      "/dev/sda1",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_vgcreate (g, "VG", physvols);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvcreate (g, "LV", "VG", 8);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/VG/LV", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for pvs (0) */
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_pvs (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_pvs_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "/dev/sda1") != 0) {
+      fprintf (stderr, "test_pvs_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (r[1] != NULL) {
+      fprintf (stderr, "test_pvs_0: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_pvs_1 (void)
+{
+  /* InitEmpty for pvs (1) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for pvs (1) */
+  {
+    char *lines[] = {
+      ",10",
+      ",20",
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda2");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_pvcreate (g, "/dev/sda3");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_pvs (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_pvs_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "/dev/sda1") != 0) {
+      fprintf (stderr, "test_pvs_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_pvs_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "/dev/sda2") != 0) {
+      fprintf (stderr, "test_pvs_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (!r[2]) {
+      fprintf (stderr, "test_pvs_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[2], "/dev/sda3") != 0) {
+      fprintf (stderr, "test_pvs_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
+      return -1;
+    }
+    if (r[3] != NULL) {
+      fprintf (stderr, "test_pvs_1: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_list_partitions_0 (void)
+{
+  /* InitBasicFS for list_partitions (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for list_partitions (0) */
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_list_partitions (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_list_partitions_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "/dev/sda1") != 0) {
+      fprintf (stderr, "test_list_partitions_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (r[1] != NULL) {
+      fprintf (stderr, "test_list_partitions_0: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_list_partitions_1 (void)
+{
+  /* InitEmpty for list_partitions (1) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for list_partitions (1) */
+  {
+    char *lines[] = {
+      ",10",
+      ",20",
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_list_partitions (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "/dev/sda1") != 0) {
+      fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "/dev/sda2") != 0) {
+      fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (!r[2]) {
+      fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[2], "/dev/sda3") != 0) {
+      fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
+      return -1;
+    }
+    if (r[3] != NULL) {
+      fprintf (stderr, "test_list_partitions_1: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_list_devices_0 (void)
+{
+  /* InitEmpty for list_devices (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for list_devices (0) */
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_list_devices (g);
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_list_devices_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "/dev/sda") != 0) {
+      fprintf (stderr, "test_list_devices_0: expected \"/dev/sda\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_list_devices_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "/dev/sdb") != 0) {
+      fprintf (stderr, "test_list_devices_0: expected \"/dev/sdb\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (!r[2]) {
+      fprintf (stderr, "test_list_devices_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[2], "/dev/sdc") != 0) {
+      fprintf (stderr, "test_list_devices_0: expected \"/dev/sdc\" but got \"%s\"\n", r[2]);
+      return -1;
+    }
+    if (r[3] != NULL) {
+      fprintf (stderr, "test_list_devices_0: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_ls_0 (void)
+{
+  /* InitBasicFS for ls (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputList for ls (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/newer");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/newest");
+    if (r == -1)
+      return -1;
+  }
+  {
+    char **r;
+    int i;
+    suppress_error = 0;
+    r = guestfs_ls (g, "/");
+    if (r == NULL)
+      return -1;
+    if (!r[0]) {
+      fprintf (stderr, "test_ls_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[0], "lost+found") != 0) {
+      fprintf (stderr, "test_ls_0: expected \"lost+found\" but got \"%s\"\n", r[0]);
+      return -1;
+    }
+    if (!r[1]) {
+      fprintf (stderr, "test_ls_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[1], "new") != 0) {
+      fprintf (stderr, "test_ls_0: expected \"new\" but got \"%s\"\n", r[1]);
+      return -1;
+    }
+    if (!r[2]) {
+      fprintf (stderr, "test_ls_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[2], "newer") != 0) {
+      fprintf (stderr, "test_ls_0: expected \"newer\" but got \"%s\"\n", r[2]);
+      return -1;
+    }
+    if (!r[3]) {
+      fprintf (stderr, "test_ls_0: short list returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    if (strcmp (r[3], "newest") != 0) {
+      fprintf (stderr, "test_ls_0: expected \"newest\" but got \"%s\"\n", r[3]);
+      return -1;
+    }
+    if (r[4] != NULL) {
+      fprintf (stderr, "test_ls_0: extra elements returned from command\n");
+      print_strings (r);
+      return -1;
+    }
+    for (i = 0; r[i] != NULL; ++i)
+      free (r[i]);
+    free (r);
+  }
+  return 0;
+}
+
+static int test_cat_0 (void)
+{
+  /* InitBasicFS for cat (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutput for cat (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_write_file (g, "/new", "new file contents", 0);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *r;
+    suppress_error = 0;
+    r = guestfs_cat (g, "/new");
+    if (r == NULL)
+      return -1;
+    if (strcmp (r, "new file contents") != 0) {
+      fprintf (stderr, "test_cat_0: expected \"new file contents\" but got \"%s\"\n", r);
+      return -1;
+    }
+    free (r);
+  }
+  return 0;
+}
+
+static int test_touch_0 (void)
+{
+  /* InitBasicFS for touch (0): create ext2 on /dev/sda1 */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutputTrue for touch (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_touch (g, "/new");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_exists (g, "/new");
+    if (r == -1)
+      return -1;
+    if (!r) {
+      fprintf (stderr, "test_touch_0: expected true, got false\n");
+      return -1;
+    }
+  }
+  return 0;
+}
+
+static int test_sync_0 (void)
+{
+  /* InitEmpty for sync (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  /* TestRun for sync (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_sync (g);
+    if (r == -1)
+      return -1;
+  }
+  return 0;
+}
+
+static int test_mount_0 (void)
+{
+  /* InitEmpty for mount (0) */
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_umount_all (g);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_lvm_remove_all (g);
+    if (r == -1)
+      return -1;
+  }
+  /* TestOutput for mount (0) */
+  {
+    char *lines[] = {
+      ",",
+      NULL
+    };
+    int r;
+    suppress_error = 0;
+    r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_mount (g, "/dev/sda1", "/");
+    if (r == -1)
+      return -1;
+  }
+  {
+    int r;
+    suppress_error = 0;
+    r = guestfs_write_file (g, "/new", "new file contents", 0);
+    if (r == -1)
+      return -1;
+  }
+  {
+    char *r;
+    suppress_error = 0;
+    r = guestfs_cat (g, "/new");
+    if (r == NULL)
+      return -1;
+    if (strcmp (r, "new file contents") != 0) {
+      fprintf (stderr, "test_mount_0: expected \"new file contents\" but got \"%s\"\n", r);
+      return -1;
+    }
+    free (r);
+  }
+  return 0;
+}
+
+int main (int argc, char *argv[])
+{
+  char c = 0;
+  int failed = 0;
+  const char *srcdir;
+  const char *filename;
+  int fd;
+  int nr_tests, test_num = 0;
+
+  no_test_warnings ();
+
+  g = guestfs_create ();
+  if (g == NULL) {
+    printf ("guestfs_create FAILED\n");
+    exit (1);
+  }
 
   guestfs_set_error_handler (g, print_error, NULL);
 
   srcdir = getenv ("srcdir");
   if (!srcdir) srcdir = ".";
-  guestfs_set_path (g, srcdir);
+  chdir (srcdir);
+  guestfs_set_path (g, ".");
+
+  filename = "test1.img";
+  fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
+  if (fd == -1) {
+    perror (filename);
+    exit (1);
+  }
+  if (lseek (fd, 524288000, SEEK_SET) == -1) {
+    perror ("lseek");
+    close (fd);
+    unlink (filename);
+    exit (1);
+  }
+  if (write (fd, &c, 1) == -1) {
+    perror ("write");
+    close (fd);
+    unlink (filename);
+    exit (1);
+  }
+  if (close (fd) == -1) {
+    perror (filename);
+    unlink (filename);
+    exit (1);
+  }
+  if (guestfs_add_drive (g, filename) == -1) {
+    printf ("guestfs_add_drive %s FAILED\n", filename);
+    exit (1);
+  }
+
+  filename = "test2.img";
+  fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
+  if (fd == -1) {
+    perror (filename);
+    exit (1);
+  }
+  if (lseek (fd, 52428800, SEEK_SET) == -1) {
+    perror ("lseek");
+    close (fd);
+    unlink (filename);
+    exit (1);
+  }
+  if (write (fd, &c, 1) == -1) {
+    perror ("write");
+    close (fd);
+    unlink (filename);
+    exit (1);
+  }
+  if (close (fd) == -1) {
+    perror (filename);
+    unlink (filename);
+    exit (1);
+  }
+  if (guestfs_add_drive (g, filename) == -1) {
+    printf ("guestfs_add_drive %s FAILED\n", filename);
+    exit (1);
+  }
 
-  snprintf (buf, sizeof buf, "%s/test1.img", srcdir);
-  fd = open (buf, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
+  filename = "test3.img";
+  fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
   if (fd == -1) {
-    perror (buf);
+    perror (filename);
+    exit (1);
+  }
+  if (lseek (fd, 10485760, SEEK_SET) == -1) {
+    perror ("lseek");
+    close (fd);
+    unlink (filename);
+    exit (1);
+  }
+  if (write (fd, &c, 1) == -1) {
+    perror ("write");
+    close (fd);
+    unlink (filename);
+    exit (1);
+  }
+  if (close (fd) == -1) {
+    perror (filename);
+    unlink (filename);
+    exit (1);
+  }
+  if (guestfs_add_drive (g, filename) == -1) {
+    printf ("guestfs_add_drive %s FAILED\n", filename);
+    exit (1);
+  }
+
+  if (guestfs_launch (g) == -1) {
+    printf ("guestfs_launch FAILED\n");
+    exit (1);
+  }
+  if (guestfs_wait_ready (g) == -1) {
+    printf ("guestfs_wait_ready FAILED\n");
     exit (1);
   }
-  if (lseek (fd, 524288000, SEEK_SET) == -1) {
-    perror ("lseek");
-    close (fd);
-    unlink (buf);
-    exit (1);
+
+  nr_tests = 85;
+
+  test_num++;
+  printf ("%3d/%3d test_pvremove_0\n", test_num, nr_tests);
+  if (test_pvremove_0 () == -1) {
+    printf ("test_pvremove_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_pvremove_1\n", test_num, nr_tests);
+  if (test_pvremove_1 () == -1) {
+    printf ("test_pvremove_1 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_pvremove_2\n", test_num, nr_tests);
+  if (test_pvremove_2 () == -1) {
+    printf ("test_pvremove_2 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_vgremove_0\n", test_num, nr_tests);
+  if (test_vgremove_0 () == -1) {
+    printf ("test_vgremove_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_vgremove_1\n", test_num, nr_tests);
+  if (test_vgremove_1 () == -1) {
+    printf ("test_vgremove_1 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_lvremove_0\n", test_num, nr_tests);
+  if (test_lvremove_0 () == -1) {
+    printf ("test_lvremove_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_lvremove_1\n", test_num, nr_tests);
+  if (test_lvremove_1 () == -1) {
+    printf ("test_lvremove_1 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_lvremove_2\n", test_num, nr_tests);
+  if (test_lvremove_2 () == -1) {
+    printf ("test_lvremove_2 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_mount_ro_0\n", test_num, nr_tests);
+  if (test_mount_ro_0 () == -1) {
+    printf ("test_mount_ro_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_mount_ro_1\n", test_num, nr_tests);
+  if (test_mount_ro_1 () == -1) {
+    printf ("test_mount_ro_1 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_tgz_in_0\n", test_num, nr_tests);
+  if (test_tgz_in_0 () == -1) {
+    printf ("test_tgz_in_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_tar_in_0\n", test_num, nr_tests);
+  if (test_tar_in_0 () == -1) {
+    printf ("test_tar_in_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_checksum_0\n", test_num, nr_tests);
+  if (test_checksum_0 () == -1) {
+    printf ("test_checksum_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_checksum_1\n", test_num, nr_tests);
+  if (test_checksum_1 () == -1) {
+    printf ("test_checksum_1 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_checksum_2\n", test_num, nr_tests);
+  if (test_checksum_2 () == -1) {
+    printf ("test_checksum_2 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_checksum_3\n", test_num, nr_tests);
+  if (test_checksum_3 () == -1) {
+    printf ("test_checksum_3 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_checksum_4\n", test_num, nr_tests);
+  if (test_checksum_4 () == -1) {
+    printf ("test_checksum_4 FAILED\n");
+    failed++;
   }
-  if (write (fd, &c, 1) == -1) {
-    perror ("write");
-    close (fd);
-    unlink (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_checksum_5\n", test_num, nr_tests);
+  if (test_checksum_5 () == -1) {
+    printf ("test_checksum_5 FAILED\n");
+    failed++;
   }
-  if (close (fd) == -1) {
-    perror (buf);
-    unlink (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_checksum_6\n", test_num, nr_tests);
+  if (test_checksum_6 () == -1) {
+    printf ("test_checksum_6 FAILED\n");
+    failed++;
   }
-  if (guestfs_add_drive (g, buf) == -1) {
-    printf ("guestfs_add_drive %s FAILED\n", buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_checksum_7\n", test_num, nr_tests);
+  if (test_checksum_7 () == -1) {
+    printf ("test_checksum_7 FAILED\n");
+    failed++;
   }
-
-  snprintf (buf, sizeof buf, "%s/test2.img", srcdir);
-  fd = open (buf, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
-  if (fd == -1) {
-    perror (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_download_0\n", test_num, nr_tests);
+  if (test_download_0 () == -1) {
+    printf ("test_download_0 FAILED\n");
+    failed++;
   }
-  if (lseek (fd, 52428800, SEEK_SET) == -1) {
-    perror ("lseek");
-    close (fd);
-    unlink (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_upload_0\n", test_num, nr_tests);
+  if (test_upload_0 () == -1) {
+    printf ("test_upload_0 FAILED\n");
+    failed++;
   }
-  if (write (fd, &c, 1) == -1) {
-    perror ("write");
-    close (fd);
-    unlink (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_rereadpt_0\n", test_num, nr_tests);
+  if (test_blockdev_rereadpt_0 () == -1) {
+    printf ("test_blockdev_rereadpt_0 FAILED\n");
+    failed++;
   }
-  if (close (fd) == -1) {
-    perror (buf);
-    unlink (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_flushbufs_0\n", test_num, nr_tests);
+  if (test_blockdev_flushbufs_0 () == -1) {
+    printf ("test_blockdev_flushbufs_0 FAILED\n");
+    failed++;
   }
-  if (guestfs_add_drive (g, buf) == -1) {
-    printf ("guestfs_add_drive %s FAILED\n", buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_getsize64_0\n", test_num, nr_tests);
+  if (test_blockdev_getsize64_0 () == -1) {
+    printf ("test_blockdev_getsize64_0 FAILED\n");
+    failed++;
   }
-
-  snprintf (buf, sizeof buf, "%s/test3.img", srcdir);
-  fd = open (buf, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
-  if (fd == -1) {
-    perror (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_getsz_0\n", test_num, nr_tests);
+  if (test_blockdev_getsz_0 () == -1) {
+    printf ("test_blockdev_getsz_0 FAILED\n");
+    failed++;
   }
-  if (lseek (fd, 10485760, SEEK_SET) == -1) {
-    perror ("lseek");
-    close (fd);
-    unlink (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_getbsz_0\n", test_num, nr_tests);
+  if (test_blockdev_getbsz_0 () == -1) {
+    printf ("test_blockdev_getbsz_0 FAILED\n");
+    failed++;
   }
-  if (write (fd, &c, 1) == -1) {
-    perror ("write");
-    close (fd);
-    unlink (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_getss_0\n", test_num, nr_tests);
+  if (test_blockdev_getss_0 () == -1) {
+    printf ("test_blockdev_getss_0 FAILED\n");
+    failed++;
   }
-  if (close (fd) == -1) {
-    perror (buf);
-    unlink (buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_getro_0\n", test_num, nr_tests);
+  if (test_blockdev_getro_0 () == -1) {
+    printf ("test_blockdev_getro_0 FAILED\n");
+    failed++;
   }
-  if (guestfs_add_drive (g, buf) == -1) {
-    printf ("guestfs_add_drive %s FAILED\n", buf);
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_setrw_0\n", test_num, nr_tests);
+  if (test_blockdev_setrw_0 () == -1) {
+    printf ("test_blockdev_setrw_0 FAILED\n");
+    failed++;
   }
-
-  if (guestfs_launch (g) == -1) {
-    printf ("guestfs_launch FAILED\n");
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_blockdev_setro_0\n", test_num, nr_tests);
+  if (test_blockdev_setro_0 () == -1) {
+    printf ("test_blockdev_setro_0 FAILED\n");
+    failed++;
   }
-  if (guestfs_wait_ready (g) == -1) {
-    printf ("guestfs_wait_ready FAILED\n");
-    exit (1);
+  test_num++;
+  printf ("%3d/%3d test_statvfs_0\n", test_num, nr_tests);
+  if (test_statvfs_0 () == -1) {
+    printf ("test_statvfs_0 FAILED\n");
+    failed++;
   }
-
-  nr_tests = 49;
-  printf ("  1/%3d test_mount_0\n", nr_tests);
-  if (test_mount_0 () == -1) {
-    printf ("test_mount_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_lstat_0\n", test_num, nr_tests);
+  if (test_lstat_0 () == -1) {
+    printf ("test_lstat_0 FAILED\n");
     failed++;
   }
-  printf ("  2/%3d test_sync_0\n", nr_tests);
-  if (test_sync_0 () == -1) {
-    printf ("test_sync_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_stat_0\n", test_num, nr_tests);
+  if (test_stat_0 () == -1) {
+    printf ("test_stat_0 FAILED\n");
     failed++;
   }
-  printf ("  3/%3d test_touch_0\n", nr_tests);
-  if (test_touch_0 () == -1) {
-    printf ("test_touch_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_file_0\n", test_num, nr_tests);
+  if (test_file_0 () == -1) {
+    printf ("test_file_0 FAILED\n");
     failed++;
   }
-  printf ("  4/%3d test_cat_0\n", nr_tests);
-  if (test_cat_0 () == -1) {
-    printf ("test_cat_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_file_1\n", test_num, nr_tests);
+  if (test_file_1 () == -1) {
+    printf ("test_file_1 FAILED\n");
     failed++;
   }
-  printf ("  5/%3d test_ls_0\n", nr_tests);
-  if (test_ls_0 () == -1) {
-    printf ("test_ls_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_file_2\n", test_num, nr_tests);
+  if (test_file_2 () == -1) {
+    printf ("test_file_2 FAILED\n");
     failed++;
   }
-  printf ("  6/%3d test_list_devices_0\n", nr_tests);
-  if (test_list_devices_0 () == -1) {
-    printf ("test_list_devices_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_umount_all_0\n", test_num, nr_tests);
+  if (test_umount_all_0 () == -1) {
+    printf ("test_umount_all_0 FAILED\n");
     failed++;
   }
-  printf ("  7/%3d test_list_partitions_0\n", nr_tests);
-  if (test_list_partitions_0 () == -1) {
-    printf ("test_list_partitions_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_mounts_0\n", test_num, nr_tests);
+  if (test_mounts_0 () == -1) {
+    printf ("test_mounts_0 FAILED\n");
     failed++;
   }
-  printf ("  8/%3d test_list_partitions_1\n", nr_tests);
-  if (test_list_partitions_1 () == -1) {
-    printf ("test_list_partitions_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_umount_0\n", test_num, nr_tests);
+  if (test_umount_0 () == -1) {
+    printf ("test_umount_0 FAILED\n");
     failed++;
   }
-  printf ("  9/%3d test_pvs_0\n", nr_tests);
-  if (test_pvs_0 () == -1) {
-    printf ("test_pvs_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_umount_1\n", test_num, nr_tests);
+  if (test_umount_1 () == -1) {
+    printf ("test_umount_1 FAILED\n");
     failed++;
   }
-  printf (" 10/%3d test_pvs_1\n", nr_tests);
-  if (test_pvs_1 () == -1) {
-    printf ("test_pvs_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_write_file_0\n", test_num, nr_tests);
+  if (test_write_file_0 () == -1) {
+    printf ("test_write_file_0 FAILED\n");
     failed++;
   }
-  printf (" 11/%3d test_vgs_0\n", nr_tests);
-  if (test_vgs_0 () == -1) {
-    printf ("test_vgs_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_write_file_1\n", test_num, nr_tests);
+  if (test_write_file_1 () == -1) {
+    printf ("test_write_file_1 FAILED\n");
     failed++;
   }
-  printf (" 12/%3d test_vgs_1\n", nr_tests);
-  if (test_vgs_1 () == -1) {
-    printf ("test_vgs_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_write_file_2\n", test_num, nr_tests);
+  if (test_write_file_2 () == -1) {
+    printf ("test_write_file_2 FAILED\n");
     failed++;
   }
-  printf (" 13/%3d test_lvs_0\n", nr_tests);
-  if (test_lvs_0 () == -1) {
-    printf ("test_lvs_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_write_file_3\n", test_num, nr_tests);
+  if (test_write_file_3 () == -1) {
+    printf ("test_write_file_3 FAILED\n");
     failed++;
   }
-  printf (" 14/%3d test_lvs_1\n", nr_tests);
-  if (test_lvs_1 () == -1) {
-    printf ("test_lvs_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_write_file_4\n", test_num, nr_tests);
+  if (test_write_file_4 () == -1) {
+    printf ("test_write_file_4 FAILED\n");
     failed++;
   }
-  printf (" 15/%3d test_read_lines_0\n", nr_tests);
-  if (test_read_lines_0 () == -1) {
-    printf ("test_read_lines_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_write_file_5\n", test_num, nr_tests);
+  if (test_write_file_5 () == -1) {
+    printf ("test_write_file_5 FAILED\n");
     failed++;
   }
-  printf (" 16/%3d test_read_lines_1\n", nr_tests);
-  if (test_read_lines_1 () == -1) {
-    printf ("test_read_lines_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_mkfs_0\n", test_num, nr_tests);
+  if (test_mkfs_0 () == -1) {
+    printf ("test_mkfs_0 FAILED\n");
     failed++;
   }
-  printf (" 17/%3d test_rm_0\n", nr_tests);
-  if (test_rm_0 () == -1) {
-    printf ("test_rm_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_lvcreate_0\n", test_num, nr_tests);
+  if (test_lvcreate_0 () == -1) {
+    printf ("test_lvcreate_0 FAILED\n");
     failed++;
   }
-  printf (" 18/%3d test_rm_1\n", nr_tests);
-  if (test_rm_1 () == -1) {
-    printf ("test_rm_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_vgcreate_0\n", test_num, nr_tests);
+  if (test_vgcreate_0 () == -1) {
+    printf ("test_vgcreate_0 FAILED\n");
     failed++;
   }
-  printf (" 19/%3d test_rm_2\n", nr_tests);
-  if (test_rm_2 () == -1) {
-    printf ("test_rm_2 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_pvcreate_0\n", test_num, nr_tests);
+  if (test_pvcreate_0 () == -1) {
+    printf ("test_pvcreate_0 FAILED\n");
     failed++;
   }
-  printf (" 20/%3d test_rmdir_0\n", nr_tests);
-  if (test_rmdir_0 () == -1) {
-    printf ("test_rmdir_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_is_dir_0\n", test_num, nr_tests);
+  if (test_is_dir_0 () == -1) {
+    printf ("test_is_dir_0 FAILED\n");
     failed++;
   }
-  printf (" 21/%3d test_rmdir_1\n", nr_tests);
-  if (test_rmdir_1 () == -1) {
-    printf ("test_rmdir_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_is_dir_1\n", test_num, nr_tests);
+  if (test_is_dir_1 () == -1) {
+    printf ("test_is_dir_1 FAILED\n");
     failed++;
   }
-  printf (" 22/%3d test_rmdir_2\n", nr_tests);
-  if (test_rmdir_2 () == -1) {
-    printf ("test_rmdir_2 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_is_file_0\n", test_num, nr_tests);
+  if (test_is_file_0 () == -1) {
+    printf ("test_is_file_0 FAILED\n");
     failed++;
   }
-  printf (" 23/%3d test_rm_rf_0\n", nr_tests);
-  if (test_rm_rf_0 () == -1) {
-    printf ("test_rm_rf_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_is_file_1\n", test_num, nr_tests);
+  if (test_is_file_1 () == -1) {
+    printf ("test_is_file_1 FAILED\n");
     failed++;
   }
-  printf (" 24/%3d test_mkdir_0\n", nr_tests);
-  if (test_mkdir_0 () == -1) {
-    printf ("test_mkdir_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_exists_0\n", test_num, nr_tests);
+  if (test_exists_0 () == -1) {
+    printf ("test_exists_0 FAILED\n");
     failed++;
   }
-  printf (" 25/%3d test_mkdir_1\n", nr_tests);
-  if (test_mkdir_1 () == -1) {
-    printf ("test_mkdir_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_exists_1\n", test_num, nr_tests);
+  if (test_exists_1 () == -1) {
+    printf ("test_exists_1 FAILED\n");
     failed++;
   }
-  printf (" 26/%3d test_mkdir_p_0\n", nr_tests);
+  test_num++;
+  printf ("%3d/%3d test_mkdir_p_0\n", test_num, nr_tests);
   if (test_mkdir_p_0 () == -1) {
     printf ("test_mkdir_p_0 FAILED\n");
     failed++;
   }
-  printf (" 27/%3d test_mkdir_p_1\n", nr_tests);
+  test_num++;
+  printf ("%3d/%3d test_mkdir_p_1\n", test_num, nr_tests);
   if (test_mkdir_p_1 () == -1) {
     printf ("test_mkdir_p_1 FAILED\n");
     failed++;
   }
-  printf (" 28/%3d test_mkdir_p_2\n", nr_tests);
+  test_num++;
+  printf ("%3d/%3d test_mkdir_p_2\n", test_num, nr_tests);
   if (test_mkdir_p_2 () == -1) {
     printf ("test_mkdir_p_2 FAILED\n");
     failed++;
   }
-  printf (" 29/%3d test_exists_0\n", nr_tests);
-  if (test_exists_0 () == -1) {
-    printf ("test_exists_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_mkdir_0\n", test_num, nr_tests);
+  if (test_mkdir_0 () == -1) {
+    printf ("test_mkdir_0 FAILED\n");
     failed++;
   }
-  printf (" 30/%3d test_exists_1\n", nr_tests);
-  if (test_exists_1 () == -1) {
-    printf ("test_exists_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_mkdir_1\n", test_num, nr_tests);
+  if (test_mkdir_1 () == -1) {
+    printf ("test_mkdir_1 FAILED\n");
     failed++;
   }
-  printf (" 31/%3d test_is_file_0\n", nr_tests);
-  if (test_is_file_0 () == -1) {
-    printf ("test_is_file_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_rm_rf_0\n", test_num, nr_tests);
+  if (test_rm_rf_0 () == -1) {
+    printf ("test_rm_rf_0 FAILED\n");
     failed++;
   }
-  printf (" 32/%3d test_is_file_1\n", nr_tests);
-  if (test_is_file_1 () == -1) {
-    printf ("test_is_file_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_rmdir_0\n", test_num, nr_tests);
+  if (test_rmdir_0 () == -1) {
+    printf ("test_rmdir_0 FAILED\n");
     failed++;
   }
-  printf (" 33/%3d test_is_dir_0\n", nr_tests);
-  if (test_is_dir_0 () == -1) {
-    printf ("test_is_dir_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_rmdir_1\n", test_num, nr_tests);
+  if (test_rmdir_1 () == -1) {
+    printf ("test_rmdir_1 FAILED\n");
     failed++;
   }
-  printf (" 34/%3d test_is_dir_1\n", nr_tests);
-  if (test_is_dir_1 () == -1) {
-    printf ("test_is_dir_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_rmdir_2\n", test_num, nr_tests);
+  if (test_rmdir_2 () == -1) {
+    printf ("test_rmdir_2 FAILED\n");
     failed++;
   }
-  printf (" 35/%3d test_pvcreate_0\n", nr_tests);
-  if (test_pvcreate_0 () == -1) {
-    printf ("test_pvcreate_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_rm_0\n", test_num, nr_tests);
+  if (test_rm_0 () == -1) {
+    printf ("test_rm_0 FAILED\n");
     failed++;
   }
-  printf (" 36/%3d test_vgcreate_0\n", nr_tests);
-  if (test_vgcreate_0 () == -1) {
-    printf ("test_vgcreate_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_rm_1\n", test_num, nr_tests);
+  if (test_rm_1 () == -1) {
+    printf ("test_rm_1 FAILED\n");
     failed++;
   }
-  printf (" 37/%3d test_lvcreate_0\n", nr_tests);
-  if (test_lvcreate_0 () == -1) {
-    printf ("test_lvcreate_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_rm_2\n", test_num, nr_tests);
+  if (test_rm_2 () == -1) {
+    printf ("test_rm_2 FAILED\n");
     failed++;
   }
-  printf (" 38/%3d test_mkfs_0\n", nr_tests);
-  if (test_mkfs_0 () == -1) {
-    printf ("test_mkfs_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_read_lines_0\n", test_num, nr_tests);
+  if (test_read_lines_0 () == -1) {
+    printf ("test_read_lines_0 FAILED\n");
     failed++;
   }
-  printf (" 39/%3d test_write_file_0\n", nr_tests);
-  if (test_write_file_0 () == -1) {
-    printf ("test_write_file_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_read_lines_1\n", test_num, nr_tests);
+  if (test_read_lines_1 () == -1) {
+    printf ("test_read_lines_1 FAILED\n");
     failed++;
   }
-  printf (" 40/%3d test_umount_0\n", nr_tests);
-  if (test_umount_0 () == -1) {
-    printf ("test_umount_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_lvs_0\n", test_num, nr_tests);
+  if (test_lvs_0 () == -1) {
+    printf ("test_lvs_0 FAILED\n");
     failed++;
   }
-  printf (" 41/%3d test_umount_1\n", nr_tests);
-  if (test_umount_1 () == -1) {
-    printf ("test_umount_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_lvs_1\n", test_num, nr_tests);
+  if (test_lvs_1 () == -1) {
+    printf ("test_lvs_1 FAILED\n");
     failed++;
   }
-  printf (" 42/%3d test_mounts_0\n", nr_tests);
-  if (test_mounts_0 () == -1) {
-    printf ("test_mounts_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_vgs_0\n", test_num, nr_tests);
+  if (test_vgs_0 () == -1) {
+    printf ("test_vgs_0 FAILED\n");
     failed++;
   }
-  printf (" 43/%3d test_umount_all_0\n", nr_tests);
-  if (test_umount_all_0 () == -1) {
-    printf ("test_umount_all_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_vgs_1\n", test_num, nr_tests);
+  if (test_vgs_1 () == -1) {
+    printf ("test_vgs_1 FAILED\n");
     failed++;
   }
-  printf (" 44/%3d test_file_0\n", nr_tests);
-  if (test_file_0 () == -1) {
-    printf ("test_file_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_pvs_0\n", test_num, nr_tests);
+  if (test_pvs_0 () == -1) {
+    printf ("test_pvs_0 FAILED\n");
     failed++;
   }
-  printf (" 45/%3d test_file_1\n", nr_tests);
-  if (test_file_1 () == -1) {
-    printf ("test_file_1 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_pvs_1\n", test_num, nr_tests);
+  if (test_pvs_1 () == -1) {
+    printf ("test_pvs_1 FAILED\n");
     failed++;
   }
-  printf (" 46/%3d test_file_2\n", nr_tests);
-  if (test_file_2 () == -1) {
-    printf ("test_file_2 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_list_partitions_0\n", test_num, nr_tests);
+  if (test_list_partitions_0 () == -1) {
+    printf ("test_list_partitions_0 FAILED\n");
     failed++;
   }
-  printf (" 47/%3d test_stat_0\n", nr_tests);
-  if (test_stat_0 () == -1) {
-    printf ("test_stat_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_list_partitions_1\n", test_num, nr_tests);
+  if (test_list_partitions_1 () == -1) {
+    printf ("test_list_partitions_1 FAILED\n");
     failed++;
   }
-  printf (" 48/%3d test_lstat_0\n", nr_tests);
-  if (test_lstat_0 () == -1) {
-    printf ("test_lstat_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_list_devices_0\n", test_num, nr_tests);
+  if (test_list_devices_0 () == -1) {
+    printf ("test_list_devices_0 FAILED\n");
     failed++;
   }
-  printf (" 49/%3d test_statvfs_0\n", nr_tests);
-  if (test_statvfs_0 () == -1) {
-    printf ("test_statvfs_0 FAILED\n");
+  test_num++;
+  printf ("%3d/%3d test_ls_0\n", test_num, nr_tests);
+  if (test_ls_0 () == -1) {
+    printf ("test_ls_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_cat_0\n", test_num, nr_tests);
+  if (test_cat_0 () == -1) {
+    printf ("test_cat_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_touch_0\n", test_num, nr_tests);
+  if (test_touch_0 () == -1) {
+    printf ("test_touch_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_sync_0\n", test_num, nr_tests);
+  if (test_sync_0 () == -1) {
+    printf ("test_sync_0 FAILED\n");
+    failed++;
+  }
+  test_num++;
+  printf ("%3d/%3d test_mount_0\n", test_num, nr_tests);
+  if (test_mount_0 () == -1) {
+    printf ("test_mount_0 FAILED\n");
     failed++;
   }
 
   guestfs_close (g);
-  snprintf (buf, sizeof buf, "%s/test1.img", srcdir);
-  unlink (buf);
-  snprintf (buf, sizeof buf, "%s/test2.img", srcdir);
-  unlink (buf);
-  snprintf (buf, sizeof buf, "%s/test3.img", srcdir);
-  unlink (buf);
+  unlink ("test1.img");
+  unlink ("test2.img");
+  unlink ("test3.img");
 
   if (failed > 0) {
     printf ("***** %d / %d tests FAILED *****\n", failed, nr_tests);