+ 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_mount_ro_0 (void)
+{
+ /* InitBasicFS for mount_ro (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;
+ }
+ /* TestLastFail for mount_ro (0) */
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_umount (g, "/");
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_mount_ro (g, "/dev/sda1", "/");
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 1;
+ r = guestfs_touch (g, "/new");
+ if (r != -1)
+ return -1;
+ }
+ return 0;
+}
+
+static int test_mount_ro_1 (void)
+{
+ /* InitBasicFS for mount_ro (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;
+ }
+ /* TestOutput for mount_ro (1) */
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_write_file (g, "/new", "data", 0);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_umount (g, "/");
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_mount_ro (g, "/dev/sda1", "/");
+ if (r == -1)
+ return -1;
+ }
+ {
+ char *r;
+ suppress_error = 0;
+ r = guestfs_cat (g, "/new");
+ if (r == NULL)
+ return -1;
+ if (strcmp (r, "data") != 0) {
+ fprintf (stderr, "test_mount_ro_1: expected \"data\" but got \"%s\"\n", r);
+ return -1;
+ }
+ free (r);
+ }
+ return 0;