static guestfs_h *g;
static int suppress_error = 0;
+/* This will be 's' or 'h' depending on whether the guest kernel
+ * names IDE devices /dev/sd* or /dev/hd*.
+ */
+static char devchar = 's';
+
static void print_error (guestfs_h *g, void *data, const char *msg)
{
if (!suppress_error)
{
/* InitBasicFS for equal (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for equal (0) */
{
+ char path[] = "/file1";
+ char content[] = "contents of a file";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/file1", "contents of a file", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char src[] = "/file1";
+ char dest[] = "/file2";
int r;
suppress_error = 0;
- r = guestfs_cp (g, "/file1", "/file2");
+ r = guestfs_cp (g, src, dest);
if (r == -1)
return -1;
}
{
+ char file1[] = "/file1";
+ char file2[] = "/file2";
int r;
suppress_error = 0;
- r = guestfs_equal (g, "/file1", "/file2");
+ r = guestfs_equal (g, file1, file2);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for equal (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputFalse for equal (1) */
{
+ char path[] = "/file1";
+ char content[] = "contents of a file";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/file1", "contents of a file", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/file2";
+ char content[] = "contents of another file";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/file2", "contents of another file", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char file1[] = "/file1";
+ char file2[] = "/file2";
int r;
suppress_error = 0;
- r = guestfs_equal (g, "/file1", "/file2");
+ r = guestfs_equal (g, file1, file2);
if (r == -1)
return -1;
if (r) {
{
/* InitBasicFS for equal (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for equal (2) */
{
+ char file1[] = "/file1";
+ char file2[] = "/file2";
int r;
suppress_error = 1;
- r = guestfs_equal (g, "/file1", "/file2");
+ r = guestfs_equal (g, file1, file2);
if (r != -1)
return -1;
}
{
/* InitEmpty for ping_daemon (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
{
/* InitEmpty for dmesg (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
{
/* InitEmpty for drop_caches (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
{
/* InitBasicFS for mv (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for mv (0) */
+ char expected[] = "file content";
{
+ char path[] = "/old";
+ char content[] = "file content";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/old", "file content", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char src[] = "/old";
+ char dest[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mv (g, "/old", "/new");
+ r = guestfs_mv (g, src, dest);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "file content") != 0) {
- fprintf (stderr, "test_mv_0: expected \"file content\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_mv_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for mv (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputFalse for mv (1) */
{
+ char path[] = "/old";
+ char content[] = "file content";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/old", "file content", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char src[] = "/old";
+ char dest[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mv (g, "/old", "/new");
+ r = guestfs_mv (g, src, dest);
if (r == -1)
return -1;
}
{
+ char path[] = "/old";
int r;
suppress_error = 0;
- r = guestfs_is_file (g, "/old");
+ r = guestfs_is_file (g, path);
if (r == -1)
return -1;
if (r) {
{
/* InitBasicFS for cp_a (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for cp_a (0) */
+ char expected[] = "file content";
{
+ char path[] = "/olddir";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/olddir");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/newdir";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/newdir");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/olddir/file";
+ char content[] = "file content";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/olddir/file", "file content", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char src[] = "/olddir";
+ char dest[] = "/newdir";
int r;
suppress_error = 0;
- r = guestfs_cp_a (g, "/olddir", "/newdir");
+ r = guestfs_cp_a (g, src, dest);
if (r == -1)
return -1;
}
{
+ char path[] = "/newdir/olddir/file";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/newdir/olddir/file");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "file content") != 0) {
- fprintf (stderr, "test_cp_a_0: expected \"file content\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_cp_a_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for cp (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for cp (0) */
+ char expected[] = "file content";
{
+ char path[] = "/old";
+ char content[] = "file content";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/old", "file content", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char src[] = "/old";
+ char dest[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_cp (g, "/old", "/new");
+ r = guestfs_cp (g, src, dest);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "file content") != 0) {
- fprintf (stderr, "test_cp_0: expected \"file content\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_cp_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for cp (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for cp (1) */
{
+ char path[] = "/old";
+ char content[] = "file content";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/old", "file content", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char src[] = "/old";
+ char dest[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_cp (g, "/old", "/new");
+ r = guestfs_cp (g, src, dest);
if (r == -1)
return -1;
}
{
+ char path[] = "/old";
int r;
suppress_error = 0;
- r = guestfs_is_file (g, "/old");
+ r = guestfs_is_file (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for cp (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for cp (2) */
+ char expected[] = "file content";
{
+ char path[] = "/old";
+ char content[] = "file content";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/old", "file content", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/dir";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/dir");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char src[] = "/old";
+ char dest[] = "/dir/new";
int r;
suppress_error = 0;
- r = guestfs_cp (g, "/old", "/dir/new");
+ r = guestfs_cp (g, src, dest);
if (r == -1)
return -1;
}
{
+ char path[] = "/dir/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/dir/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "file content") != 0) {
- fprintf (stderr, "test_cp_2: expected \"file content\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_cp_2: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for grub_install (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for grub_install (0) */
{
+ char root[] = "/";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_grub_install (g, "/", "/dev/sda1");
+ r = guestfs_grub_install (g, root, device);
if (r == -1)
return -1;
}
{
+ char path[] = "/boot";
int r;
suppress_error = 0;
- r = guestfs_is_dir (g, "/boot");
+ r = guestfs_is_dir (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for zero (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for zero (0) */
+ char expected[] = "data";
{
+ char pathordevice[] = "/dev/sda1";
+ pathordevice[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_umount (g, "/dev/sda1");
+ r = guestfs_umount (g, pathordevice);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_zero (g, "/dev/sda1");
+ r = guestfs_zero (g, device);
if (r == -1)
return -1;
}
{
+ char path[] = "/dev/sda1";
+ path[5] = devchar;
char *r;
suppress_error = 0;
- r = guestfs_file (g, "/dev/sda1");
+ r = guestfs_file (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "data") != 0) {
- fprintf (stderr, "test_zero_0: expected \"data\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_zero_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for fsck (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputInt for fsck (0) */
{
+ char pathordevice[] = "/dev/sda1";
+ pathordevice[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_umount (g, "/dev/sda1");
+ r = guestfs_umount (g, pathordevice);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_fsck (g, "ext2", "/dev/sda1");
+ r = guestfs_fsck (g, fstype, device);
if (r == -1)
return -1;
if (r != 0) {
{
/* InitBasicFS for fsck (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputInt for fsck (1) */
{
+ char pathordevice[] = "/dev/sda1";
+ pathordevice[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_umount (g, "/dev/sda1");
+ r = guestfs_umount (g, pathordevice);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_zero (g, "/dev/sda1");
+ r = guestfs_zero (g, device);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_fsck (g, "ext2", "/dev/sda1");
+ r = guestfs_fsck (g, fstype, device);
if (r == -1)
return -1;
if (r != 8) {
{
/* InitBasicFS for set_e2uuid (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for set_e2uuid (0) */
+ char expected[] = "a3a61220-882b-4f61-89f4-cf24dcc7297d";
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char uuid[] = "a3a61220-882b-4f61-89f4-cf24dcc7297d";
int r;
suppress_error = 0;
- r = guestfs_set_e2uuid (g, "/dev/sda1", "a3a61220-882b-4f61-89f4-cf24dcc7297d");
+ r = guestfs_set_e2uuid (g, device, uuid);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
char *r;
suppress_error = 0;
- r = guestfs_get_e2uuid (g, "/dev/sda1");
+ r = guestfs_get_e2uuid (g, device);
if (r == NULL)
return -1;
- if (strcmp (r, "a3a61220-882b-4f61-89f4-cf24dcc7297d") != 0) {
- fprintf (stderr, "test_set_e2uuid_0: expected \"a3a61220-882b-4f61-89f4-cf24dcc7297d\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_set_e2uuid_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for set_e2uuid (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for set_e2uuid (1) */
+ char expected[] = "";
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char uuid[] = "clear";
int r;
suppress_error = 0;
- r = guestfs_set_e2uuid (g, "/dev/sda1", "clear");
+ r = guestfs_set_e2uuid (g, device, uuid);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
char *r;
suppress_error = 0;
- r = guestfs_get_e2uuid (g, "/dev/sda1");
+ r = guestfs_get_e2uuid (g, device);
if (r == NULL)
return -1;
- if (strcmp (r, "") != 0) {
- fprintf (stderr, "test_set_e2uuid_1: expected \"\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_set_e2uuid_1: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for set_e2uuid (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestRun for set_e2uuid (2) */
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char uuid[] = "random";
int r;
suppress_error = 0;
- r = guestfs_set_e2uuid (g, "/dev/sda1", "random");
+ r = guestfs_set_e2uuid (g, device, uuid);
if (r == -1)
return -1;
}
{
/* InitBasicFS for set_e2uuid (3): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestRun for set_e2uuid (3) */
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char uuid[] = "time";
int r;
suppress_error = 0;
- r = guestfs_set_e2uuid (g, "/dev/sda1", "time");
+ r = guestfs_set_e2uuid (g, device, uuid);
if (r == -1)
return -1;
}
{
/* InitBasicFS for set_e2label (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for set_e2label (0) */
+ char expected[] = "testlabel";
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char label[] = "testlabel";
int r;
suppress_error = 0;
- r = guestfs_set_e2label (g, "/dev/sda1", "testlabel");
+ r = guestfs_set_e2label (g, device, label);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
char *r;
suppress_error = 0;
- r = guestfs_get_e2label (g, "/dev/sda1");
+ r = guestfs_get_e2label (g, device);
if (r == NULL)
return -1;
- if (strcmp (r, "testlabel") != 0) {
- fprintf (stderr, "test_set_e2label_0: expected \"testlabel\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_set_e2label_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitEmpty for pvremove (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for pvremove (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char vgname[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_vgremove (g, "VG");
+ r = guestfs_vgremove (g, vgname);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvremove (g, "/dev/sda");
+ r = guestfs_pvremove (g, device);
if (r == -1)
return -1;
}
{
/* InitEmpty for pvremove (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for pvremove (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char vgname[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_vgremove (g, "VG");
+ r = guestfs_vgremove (g, vgname);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvremove (g, "/dev/sda");
+ r = guestfs_pvremove (g, device);
if (r == -1)
return -1;
}
{
/* InitEmpty for pvremove (2) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for pvremove (2) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char vgname[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_vgremove (g, "VG");
+ r = guestfs_vgremove (g, vgname);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvremove (g, "/dev/sda");
+ r = guestfs_pvremove (g, device);
if (r == -1)
return -1;
}
{
/* InitEmpty for vgremove (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for vgremove (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char vgname[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_vgremove (g, "VG");
+ r = guestfs_vgremove (g, vgname);
if (r == -1)
return -1;
}
{
/* InitEmpty for vgremove (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for vgremove (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char vgname[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_vgremove (g, "VG");
+ r = guestfs_vgremove (g, vgname);
if (r == -1)
return -1;
}
{
/* InitEmpty for lvremove (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for lvremove (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/VG/LV1";
int r;
suppress_error = 0;
- r = guestfs_lvremove (g, "/dev/VG/LV1");
+ r = guestfs_lvremove (g, device);
if (r == -1)
return -1;
}
print_strings (r);
return -1;
}
- 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;
+ {
+ char expected[] = "/dev/VG/LV2";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_lvremove_0: expected \"%s\" but got \"%s\"\n", expected, r[0]);
+ return -1;
+ }
}
if (r[1] != NULL) {
fprintf (stderr, "test_lvremove_0: extra elements returned from command\n");
{
/* InitEmpty for lvremove (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for lvremove (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/VG";
int r;
suppress_error = 0;
- r = guestfs_lvremove (g, "/dev/VG");
+ r = guestfs_lvremove (g, device);
if (r == -1)
return -1;
}
{
/* InitEmpty for lvremove (2) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for lvremove (2) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/VG";
int r;
suppress_error = 0;
- r = guestfs_lvremove (g, "/dev/VG");
+ r = guestfs_lvremove (g, device);
if (r == -1)
return -1;
}
print_strings (r);
return -1;
}
- if (strcmp (r[0], "VG") != 0) {
- fprintf (stderr, "test_lvremove_2: expected \"VG\" but got \"%s\"\n", r[0]);
- return -1;
+ {
+ char expected[] = "VG";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_lvremove_2: expected \"%s\" but got \"%s\"\n", expected, r[0]);
+ return -1;
+ }
}
if (r[1] != NULL) {
fprintf (stderr, "test_lvremove_2: extra elements returned from command\n");
{
/* InitBasicFS for mount_ro (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for mount_ro (0) */
{
+ char pathordevice[] = "/";
int r;
suppress_error = 0;
- r = guestfs_umount (g, "/");
+ r = guestfs_umount (g, pathordevice);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount_ro (g, "/dev/sda1", "/");
+ r = guestfs_mount_ro (g, device, mountpoint);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 1;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r != -1)
return -1;
}
{
/* InitBasicFS for mount_ro (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for mount_ro (1) */
+ char expected[] = "data";
{
+ char path[] = "/new";
+ char content[] = "data";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "data", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char pathordevice[] = "/";
int r;
suppress_error = 0;
- r = guestfs_umount (g, "/");
+ r = guestfs_umount (g, pathordevice);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount_ro (g, "/dev/sda1", "/");
+ r = guestfs_mount_ro (g, device, mountpoint);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "data") != 0) {
- fprintf (stderr, "test_mount_ro_1: expected \"data\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_mount_ro_1: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for tgz_in (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for tgz_in (0) */
+ char expected[] = "hello\n";
{
+ char directory[] = "/";
int r;
suppress_error = 0;
- r = guestfs_tgz_in (g, "images/helloworld.tar.gz", "/");
+ r = guestfs_tgz_in (g, "images/helloworld.tar.gz", directory);
if (r == -1)
return -1;
}
{
+ char path[] = "/hello";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/hello");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "hello\n") != 0) {
- fprintf (stderr, "test_tgz_in_0: expected \"hello\n\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_tgz_in_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for tar_in (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for tar_in (0) */
+ char expected[] = "hello\n";
{
+ char directory[] = "/";
int r;
suppress_error = 0;
- r = guestfs_tar_in (g, "images/helloworld.tar", "/");
+ r = guestfs_tar_in (g, "images/helloworld.tar", directory);
if (r == -1)
return -1;
}
{
+ char path[] = "/hello";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/hello");
+ r = guestfs_cat (g, path);
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);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_tar_in_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for checksum (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for checksum (0) */
+ char expected[] = "935282863";
{
+ char path[] = "/new";
+ char content[] = "test\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "test\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "crc";
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "crc", "/new");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "935282863") != 0) {
- fprintf (stderr, "test_checksum_0: expected \"935282863\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_checksum_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for checksum (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for checksum (1) */
{
+ char csumtype[] = "crc";
+ char path[] = "/new";
char *r;
suppress_error = 1;
- r = guestfs_checksum (g, "crc", "/new");
+ r = guestfs_checksum (g, csumtype, path);
if (r != NULL)
return -1;
free (r);
{
/* InitBasicFS for checksum (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for checksum (2) */
+ char expected[] = "d8e8fca2dc0f896fd7cb4cb0031ba249";
{
+ char path[] = "/new";
+ char content[] = "test\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "test\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "md5";
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "md5", "/new");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "d8e8fca2dc0f896fd7cb4cb0031ba249") != 0) {
- fprintf (stderr, "test_checksum_2: expected \"d8e8fca2dc0f896fd7cb4cb0031ba249\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_checksum_2: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for checksum (3): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for checksum (3) */
+ char expected[] = "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83";
{
+ char path[] = "/new";
+ char content[] = "test\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "test\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "sha1";
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "sha1", "/new");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83") != 0) {
- fprintf (stderr, "test_checksum_3: expected \"4e1243bd22c66e76c2ba9eddc1f91394e57f9f83\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_checksum_3: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for checksum (4): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for checksum (4) */
+ char expected[] = "52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec";
{
+ char path[] = "/new";
+ char content[] = "test\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "test\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "sha224";
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "sha224", "/new");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec") != 0) {
- fprintf (stderr, "test_checksum_4: expected \"52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_checksum_4: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for checksum (5): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for checksum (5) */
+ char expected[] = "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2";
{
+ char path[] = "/new";
+ char content[] = "test\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "test\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "sha256";
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "sha256", "/new");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2") != 0) {
- fprintf (stderr, "test_checksum_5: expected \"f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_checksum_5: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for checksum (6): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for checksum (6) */
+ char expected[] = "109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d";
{
+ char path[] = "/new";
+ char content[] = "test\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "test\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "sha384";
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "sha384", "/new");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d") != 0) {
- fprintf (stderr, "test_checksum_6: expected \"109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_checksum_6: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for checksum (7): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for checksum (7) */
+ char expected[] = "0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123";
{
+ char path[] = "/new";
+ char content[] = "test\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "test\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "sha512";
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "sha512", "/new");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123") != 0) {
- fprintf (stderr, "test_checksum_7: expected \"0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_checksum_7: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for download (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for download (0) */
+ char expected[] = "e3eda01d9815f8d24aae2dbd89b68b06";
{
+ char remotefilename[] = "/COPYING.LIB";
int r;
suppress_error = 0;
- r = guestfs_upload (g, "COPYING.LIB", "/COPYING.LIB");
+ r = guestfs_upload (g, "COPYING.LIB", remotefilename);
if (r == -1)
return -1;
}
{
+ char remotefilename[] = "/COPYING.LIB";
int r;
suppress_error = 0;
- r = guestfs_download (g, "/COPYING.LIB", "testdownload.tmp");
+ r = guestfs_download (g, remotefilename, "testdownload.tmp");
if (r == -1)
return -1;
}
{
+ char remotefilename[] = "/upload";
int r;
suppress_error = 0;
- r = guestfs_upload (g, "testdownload.tmp", "/upload");
+ r = guestfs_upload (g, "testdownload.tmp", remotefilename);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "md5";
+ char path[] = "/upload";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "md5", "/upload");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "e3eda01d9815f8d24aae2dbd89b68b06") != 0) {
- fprintf (stderr, "test_download_0: expected \"e3eda01d9815f8d24aae2dbd89b68b06\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_download_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for upload (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for upload (0) */
+ char expected[] = "e3eda01d9815f8d24aae2dbd89b68b06";
{
+ char remotefilename[] = "/COPYING.LIB";
int r;
suppress_error = 0;
- r = guestfs_upload (g, "COPYING.LIB", "/COPYING.LIB");
+ r = guestfs_upload (g, "COPYING.LIB", remotefilename);
if (r == -1)
return -1;
}
{
+ char csumtype[] = "md5";
+ char path[] = "/COPYING.LIB";
char *r;
suppress_error = 0;
- r = guestfs_checksum (g, "md5", "/COPYING.LIB");
+ r = guestfs_checksum (g, csumtype, path);
if (r == NULL)
return -1;
- if (strcmp (r, "e3eda01d9815f8d24aae2dbd89b68b06") != 0) {
- fprintf (stderr, "test_upload_0: expected \"e3eda01d9815f8d24aae2dbd89b68b06\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_upload_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitEmpty for blockdev_rereadpt (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestRun for blockdev_rereadpt (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_rereadpt (g, "/dev/sda");
+ r = guestfs_blockdev_rereadpt (g, device);
if (r == -1)
return -1;
}
{
/* InitEmpty for blockdev_flushbufs (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestRun for blockdev_flushbufs (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_flushbufs (g, "/dev/sda");
+ r = guestfs_blockdev_flushbufs (g, device);
if (r == -1)
return -1;
}
{
/* InitEmpty for blockdev_getsize64 (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputInt for blockdev_getsize64 (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int64_t r;
suppress_error = 0;
- r = guestfs_blockdev_getsize64 (g, "/dev/sda");
+ r = guestfs_blockdev_getsize64 (g, device);
if (r == -1)
return -1;
if (r != 524288000) {
{
/* InitEmpty for blockdev_getsz (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputInt for blockdev_getsz (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int64_t r;
suppress_error = 0;
- r = guestfs_blockdev_getsz (g, "/dev/sda");
+ r = guestfs_blockdev_getsz (g, device);
if (r == -1)
return -1;
if (r != 1024000) {
{
/* InitEmpty for blockdev_getbsz (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputInt for blockdev_getbsz (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_getbsz (g, "/dev/sda");
+ r = guestfs_blockdev_getbsz (g, device);
if (r == -1)
return -1;
if (r != 4096) {
{
/* InitEmpty for blockdev_getss (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputInt for blockdev_getss (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_getss (g, "/dev/sda");
+ r = guestfs_blockdev_getss (g, device);
if (r == -1)
return -1;
if (r != 512) {
{
/* InitEmpty for blockdev_getro (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputTrue for blockdev_getro (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_setro (g, "/dev/sda");
+ r = guestfs_blockdev_setro (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_getro (g, "/dev/sda");
+ r = guestfs_blockdev_getro (g, device);
if (r == -1)
return -1;
if (!r) {
{
/* InitEmpty for blockdev_setrw (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputFalse for blockdev_setrw (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_setrw (g, "/dev/sda");
+ r = guestfs_blockdev_setrw (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_getro (g, "/dev/sda");
+ r = guestfs_blockdev_getro (g, device);
if (r == -1)
return -1;
if (r) {
{
/* InitEmpty for blockdev_setro (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputTrue for blockdev_setro (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_setro (g, "/dev/sda");
+ r = guestfs_blockdev_setro (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_blockdev_getro (g, "/dev/sda");
+ r = guestfs_blockdev_getro (g, device);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for statvfs (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputStruct for statvfs (0) */
{
+ char path[] = "/";
struct guestfs_statvfs *r;
suppress_error = 0;
- r = guestfs_statvfs (g, "/");
+ r = guestfs_statvfs (g, path);
if (r == NULL)
return -1;
if (r->bfree != 487702) {
{
/* InitBasicFS for lstat (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputStruct for lstat (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
struct guestfs_stat *r;
suppress_error = 0;
- r = guestfs_lstat (g, "/new");
+ r = guestfs_lstat (g, path);
if (r == NULL)
return -1;
if (r->size != 0) {
{
/* InitBasicFS for stat (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputStruct for stat (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
struct guestfs_stat *r;
suppress_error = 0;
- r = guestfs_stat (g, "/new");
+ r = guestfs_stat (g, path);
if (r == NULL)
return -1;
if (r->size != 0) {
{
/* InitBasicFS for file (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for file (0) */
+ char expected[] = "empty";
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_file (g, "/new");
+ r = guestfs_file (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "empty") != 0) {
- fprintf (stderr, "test_file_0: expected \"empty\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_file_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for file (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for file (1) */
+ char expected[] = "ASCII text";
{
+ char path[] = "/new";
+ char content[] = "some content\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "some content\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_file (g, "/new");
+ r = guestfs_file (g, path);
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 (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_file_1: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for file (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for file (2) */
{
+ char path[] = "/nofile";
char *r;
suppress_error = 1;
- r = guestfs_file (g, "/nofile");
+ r = guestfs_file (g, path);
if (r != NULL)
return -1;
free (r);
{
/* InitBasicFS for umount_all (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
{
/* InitEmpty for umount_all (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for umount_all (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",10";
+ char lines_1[] = ",20";
+ char lines_2[] = ",";
char *lines[] = {
- ",10",
- ",20",
- ",",
+ lines_0,
+ lines_1,
+ lines_2,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda2";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda2");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda3";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda3");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
{
+ char path[] = "/mp1";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/mp1");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda2";
+ device[5] = devchar;
+ char mountpoint[] = "/mp1";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda2", "/mp1");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
{
+ char path[] = "/mp1/mp2";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/mp1/mp2");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda3";
+ device[5] = devchar;
+ char mountpoint[] = "/mp1/mp2";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda3", "/mp1/mp2");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
{
+ char path[] = "/mp1/mp2/mp3";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/mp1/mp2/mp3");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
/* InitBasicFS for mounts (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
print_strings (r);
return -1;
}
- if (strcmp (r[0], "/dev/sda1") != 0) {
- fprintf (stderr, "test_mounts_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
- return -1;
+ {
+ char expected[] = "/dev/sda1";
+ expected[5] = devchar;
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_mounts_0: expected \"%s\" but got \"%s\"\n", expected, r[0]);
+ return -1;
+ }
}
if (r[1] != NULL) {
fprintf (stderr, "test_mounts_0: extra elements returned from command\n");
{
/* InitEmpty for umount (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for umount (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
print_strings (r);
return -1;
}
- if (strcmp (r[0], "/dev/sda1") != 0) {
- fprintf (stderr, "test_umount_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
- return -1;
+ {
+ char expected[] = "/dev/sda1";
+ expected[5] = devchar;
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_umount_0: expected \"%s\" but got \"%s\"\n", expected, r[0]);
+ return -1;
+ }
}
if (r[1] != NULL) {
fprintf (stderr, "test_umount_0: extra elements returned from command\n");
{
/* InitEmpty for umount (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for umount (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
{
+ char pathordevice[] = "/";
int r;
suppress_error = 0;
- r = guestfs_umount (g, "/");
+ r = guestfs_umount (g, pathordevice);
if (r == -1)
return -1;
}
{
/* InitBasicFS for write_file (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for write_file (0) */
+ char expected[] = "new file contents";
{
+ char path[] = "/new";
+ char content[] = "new file contents";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "new file contents", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
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, expected) != 0) {
+ fprintf (stderr, "test_write_file_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for write_file (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for write_file (1) */
+ char expected[] = "\nnew file contents\n";
{
+ char path[] = "/new";
+ char content[] = "\nnew file contents\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "\nnew file contents\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "\nnew file contents\n") != 0) {
- fprintf (stderr, "test_write_file_1: expected \"\nnew file contents\n\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_write_file_1: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for write_file (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for write_file (2) */
+ char expected[] = "\n\n";
{
+ char path[] = "/new";
+ char content[] = "\n\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "\n\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "\n\n") != 0) {
- fprintf (stderr, "test_write_file_2: expected \"\n\n\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_write_file_2: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for write_file (3): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for write_file (3) */
+ char expected[] = "";
{
+ char path[] = "/new";
+ char content[] = "";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "") != 0) {
- fprintf (stderr, "test_write_file_3: expected \"\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_write_file_3: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for write_file (4): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for write_file (4) */
+ char expected[] = "\n\n\n";
{
+ char path[] = "/new";
+ char content[] = "\n\n\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "\n\n\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "\n\n\n") != 0) {
- fprintf (stderr, "test_write_file_4: expected \"\n\n\n\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_write_file_4: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for write_file (5): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for write_file (5) */
+ char expected[] = "\n";
{
+ char path[] = "/new";
+ char content[] = "\n";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "\n", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
if (r == NULL)
return -1;
- if (strcmp (r, "\n") != 0) {
- fprintf (stderr, "test_write_file_5: expected \"\n\" but got \"%s\"\n", r);
+ if (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_write_file_5: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitEmpty for mkfs (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
/* TestOutput for mkfs (0) */
+ char expected[] = "new file contents";
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
+ char content[] = "new file contents";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "new file contents", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
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, expected) != 0) {
+ fprintf (stderr, "test_mkfs_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitEmpty for lvcreate (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for lvcreate (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",10";
+ char lines_1[] = ",20";
+ char lines_2[] = ",";
char *lines[] = {
- ",10",
- ",20",
- ",",
+ lines_0,
+ lines_1,
+ lines_2,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda2";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda2");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda3";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda3");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG1";
+ char physvols_0[] = "/dev/sda1";
+ physvols_0[5] = devchar;
+ char physvols_1[] = "/dev/sda2";
+ physvols_1[5] = devchar;
char *physvols[] = {
- "/dev/sda1",
- "/dev/sda2",
+ physvols_0,
+ physvols_1,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG1", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG2";
+ char physvols_0[] = "/dev/sda3";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda3",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG2", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG1";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG1", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG1";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG1", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV3";
+ char volgroup[] = "VG2";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV3", "VG2", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV4";
+ char volgroup[] = "VG2";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV4", "VG2", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV5";
+ char volgroup[] = "VG2";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV5", "VG2", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
print_strings (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;
+ {
+ char expected[] = "/dev/VG1/LV1";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_lvcreate_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/VG1/LV2";
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_lvcreate_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/VG2/LV3";
+ if (strcmp (r[2], expected) != 0) {
+ fprintf (stderr, "test_lvcreate_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/VG2/LV4";
+ if (strcmp (r[3], expected) != 0) {
+ fprintf (stderr, "test_lvcreate_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/VG2/LV5";
+ if (strcmp (r[4], expected) != 0) {
+ fprintf (stderr, "test_lvcreate_0: expected \"%s\" but got \"%s\"\n", expected, r[4]);
+ return -1;
+ }
}
if (r[5] != NULL) {
fprintf (stderr, "test_lvcreate_0: extra elements returned from command\n");
{
/* InitEmpty for vgcreate (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for vgcreate (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",10";
+ char lines_1[] = ",20";
+ char lines_2[] = ",";
char *lines[] = {
- ",10",
- ",20",
- ",",
+ lines_0,
+ lines_1,
+ lines_2,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda2";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda2");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda3";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda3");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG1";
+ char physvols_0[] = "/dev/sda1";
+ physvols_0[5] = devchar;
+ char physvols_1[] = "/dev/sda2";
+ physvols_1[5] = devchar;
char *physvols[] = {
- "/dev/sda1",
- "/dev/sda2",
+ physvols_0,
+ physvols_1,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG1", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG2";
+ char physvols_0[] = "/dev/sda3";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda3",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG2", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "VG1";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_vgcreate_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "VG2";
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_vgcreate_0: expected \"%s\" but got \"%s\"\n", expected, r[1]);
+ return -1;
+ }
}
if (r[2] != NULL) {
fprintf (stderr, "test_vgcreate_0: extra elements returned from command\n");
{
/* InitEmpty for pvcreate (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for pvcreate (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",10";
+ char lines_1[] = ",20";
+ char lines_2[] = ",";
char *lines[] = {
- ",10",
- ",20",
- ",",
+ lines_0,
+ lines_1,
+ lines_2,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda2";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda2");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda3";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda3");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "/dev/sda1";
+ expected[5] = devchar;
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_pvcreate_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/sda2";
+ expected[5] = devchar;
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_pvcreate_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/sda3";
+ expected[5] = devchar;
+ if (strcmp (r[2], expected) != 0) {
+ fprintf (stderr, "test_pvcreate_0: expected \"%s\" but got \"%s\"\n", expected, r[2]);
+ return -1;
+ }
}
if (r[3] != NULL) {
fprintf (stderr, "test_pvcreate_0: extra elements returned from command\n");
{
/* InitBasicFS for is_dir (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputFalse for is_dir (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_is_dir (g, "/new");
+ r = guestfs_is_dir (g, path);
if (r == -1)
return -1;
if (r) {
{
/* InitBasicFS for is_dir (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for is_dir (1) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/new");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_is_dir (g, "/new");
+ r = guestfs_is_dir (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for is_file (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for is_file (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_is_file (g, "/new");
+ r = guestfs_is_file (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for is_file (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputFalse for is_file (1) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/new");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_is_file (g, "/new");
+ r = guestfs_is_file (g, path);
if (r == -1)
return -1;
if (r) {
{
/* InitBasicFS for exists (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for exists (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_exists (g, "/new");
+ r = guestfs_exists (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for exists (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for exists (1) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/new");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_exists (g, "/new");
+ r = guestfs_exists (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for mkdir_p (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for mkdir_p (0) */
{
+ char path[] = "/new/foo/bar";
int r;
suppress_error = 0;
- r = guestfs_mkdir_p (g, "/new/foo/bar");
+ r = guestfs_mkdir_p (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new/foo/bar";
int r;
suppress_error = 0;
- r = guestfs_is_dir (g, "/new/foo/bar");
+ r = guestfs_is_dir (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for mkdir_p (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for mkdir_p (1) */
{
+ char path[] = "/new/foo/bar";
int r;
suppress_error = 0;
- r = guestfs_mkdir_p (g, "/new/foo/bar");
+ r = guestfs_mkdir_p (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new/foo";
int r;
suppress_error = 0;
- r = guestfs_is_dir (g, "/new/foo");
+ r = guestfs_is_dir (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for mkdir_p (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for mkdir_p (2) */
{
+ char path[] = "/new/foo/bar";
int r;
suppress_error = 0;
- r = guestfs_mkdir_p (g, "/new/foo/bar");
+ r = guestfs_mkdir_p (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_is_dir (g, "/new");
+ r = guestfs_is_dir (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for mkdir (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for mkdir (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/new");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_is_dir (g, "/new");
+ r = guestfs_is_dir (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitBasicFS for mkdir (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for mkdir (1) */
{
+ char path[] = "/new/foo/bar";
int r;
suppress_error = 1;
- r = guestfs_mkdir (g, "/new/foo/bar");
+ r = guestfs_mkdir (g, path);
if (r != -1)
return -1;
}
{
/* InitBasicFS for rm_rf (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputFalse for rm_rf (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/new");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new/foo";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/new/foo");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new/foo/bar";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new/foo/bar");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_rm_rf (g, "/new");
+ r = guestfs_rm_rf (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_exists (g, "/new");
+ r = guestfs_exists (g, path);
if (r == -1)
return -1;
if (r) {
{
/* InitBasicFS for rmdir (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestRun for rmdir (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/new");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_rmdir (g, "/new");
+ r = guestfs_rmdir (g, path);
if (r == -1)
return -1;
}
{
/* InitBasicFS for rmdir (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for rmdir (1) */
{
+ char path[] = "/new";
int r;
suppress_error = 1;
- r = guestfs_rmdir (g, "/new");
+ r = guestfs_rmdir (g, path);
if (r != -1)
return -1;
}
{
/* InitBasicFS for rmdir (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for rmdir (2) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 1;
- r = guestfs_rmdir (g, "/new");
+ r = guestfs_rmdir (g, path);
if (r != -1)
return -1;
}
{
/* InitBasicFS for rm (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestRun for rm (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_rm (g, "/new");
+ r = guestfs_rm (g, path);
if (r == -1)
return -1;
}
{
/* InitBasicFS for rm (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for rm (1) */
{
+ char path[] = "/new";
int r;
suppress_error = 1;
- r = guestfs_rm (g, "/new");
+ r = guestfs_rm (g, path);
if (r != -1)
return -1;
}
{
/* InitBasicFS for rm (2): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestLastFail for rm (2) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_mkdir (g, "/new");
+ r = guestfs_mkdir (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 1;
- r = guestfs_rm (g, "/new");
+ r = guestfs_rm (g, path);
if (r != -1)
return -1;
}
{
/* InitBasicFS for read_lines (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputList for read_lines (0) */
{
+ char path[] = "/new";
+ char content[] = "line1\r\nline2\nline3";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "line1\r\nline2\nline3", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char **r;
int i;
suppress_error = 0;
- r = guestfs_read_lines (g, "/new");
+ r = guestfs_read_lines (g, path);
if (r == NULL)
return -1;
if (!r[0]) {
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;
+ {
+ char expected[] = "line1";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_read_lines_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "line2";
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_read_lines_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "line3";
+ if (strcmp (r[2], expected) != 0) {
+ fprintf (stderr, "test_read_lines_0: expected \"%s\" but got \"%s\"\n", expected, r[2]);
+ return -1;
+ }
}
if (r[3] != NULL) {
fprintf (stderr, "test_read_lines_0: extra elements returned from command\n");
{
/* InitBasicFS for read_lines (1): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputList for read_lines (1) */
{
+ char path[] = "/new";
+ char content[] = "";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char **r;
int i;
suppress_error = 0;
- r = guestfs_read_lines (g, "/new");
+ r = guestfs_read_lines (g, path);
if (r == NULL)
return -1;
if (r[0] != NULL) {
{
/* InitBasicFSonLVM for lvs (0): create ext2 on /dev/VG/LV */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda1";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda1",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV", "VG", 8);
+ r = guestfs_lvcreate (g, logvol, volgroup, 8);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/VG/LV";
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/VG/LV";
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/VG/LV", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "/dev/VG/LV";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_lvs_0: expected \"%s\" but got \"%s\"\n", expected, r[0]);
+ return -1;
+ }
}
if (r[1] != NULL) {
fprintf (stderr, "test_lvs_0: extra elements returned from command\n");
{
/* InitEmpty for lvs (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for lvs (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",10";
+ char lines_1[] = ",20";
+ char lines_2[] = ",";
char *lines[] = {
- ",10",
- ",20",
- ",",
+ lines_0,
+ lines_1,
+ lines_2,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda2";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda2");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda3";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda3");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG1";
+ char physvols_0[] = "/dev/sda1";
+ physvols_0[5] = devchar;
+ char physvols_1[] = "/dev/sda2";
+ physvols_1[5] = devchar;
char *physvols[] = {
- "/dev/sda1",
- "/dev/sda2",
+ physvols_0,
+ physvols_1,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG1", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG2";
+ char physvols_0[] = "/dev/sda3";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda3",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG2", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV1";
+ char volgroup[] = "VG1";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV1", "VG1", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV2";
+ char volgroup[] = "VG1";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV2", "VG1", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV3";
+ char volgroup[] = "VG2";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV3", "VG2", 50);
+ r = guestfs_lvcreate (g, logvol, volgroup, 50);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "/dev/VG1/LV1";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_lvs_1: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/VG1/LV2";
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_lvs_1: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/VG2/LV3";
+ if (strcmp (r[2], expected) != 0) {
+ fprintf (stderr, "test_lvs_1: expected \"%s\" but got \"%s\"\n", expected, r[2]);
+ return -1;
+ }
}
if (r[3] != NULL) {
fprintf (stderr, "test_lvs_1: extra elements returned from command\n");
{
/* InitBasicFSonLVM for vgs (0): create ext2 on /dev/VG/LV */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda1";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda1",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV", "VG", 8);
+ r = guestfs_lvcreate (g, logvol, volgroup, 8);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/VG/LV";
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/VG/LV";
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/VG/LV", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "VG";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_vgs_0: expected \"%s\" but got \"%s\"\n", expected, r[0]);
+ return -1;
+ }
}
if (r[1] != NULL) {
fprintf (stderr, "test_vgs_0: extra elements returned from command\n");
{
/* InitEmpty for vgs (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for vgs (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",10";
+ char lines_1[] = ",20";
+ char lines_2[] = ",";
char *lines[] = {
- ",10",
- ",20",
- ",",
+ lines_0,
+ lines_1,
+ lines_2,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda2";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda2");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda3";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda3");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG1";
+ char physvols_0[] = "/dev/sda1";
+ physvols_0[5] = devchar;
+ char physvols_1[] = "/dev/sda2";
+ physvols_1[5] = devchar;
char *physvols[] = {
- "/dev/sda1",
- "/dev/sda2",
+ physvols_0,
+ physvols_1,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG1", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG2";
+ char physvols_0[] = "/dev/sda3";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda3",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG2", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "VG1";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_vgs_1: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "VG2";
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_vgs_1: expected \"%s\" but got \"%s\"\n", expected, r[1]);
+ return -1;
+ }
}
if (r[2] != NULL) {
fprintf (stderr, "test_vgs_1: extra elements returned from command\n");
{
/* InitBasicFSonLVM for pvs (0): create ext2 on /dev/VG/LV */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char volgroup[] = "VG";
+ char physvols_0[] = "/dev/sda1";
+ physvols_0[5] = devchar;
char *physvols[] = {
- "/dev/sda1",
+ physvols_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_vgcreate (g, "VG", physvols);
+ r = guestfs_vgcreate (g, volgroup, physvols);
if (r == -1)
return -1;
}
{
+ char logvol[] = "LV";
+ char volgroup[] = "VG";
int r;
suppress_error = 0;
- r = guestfs_lvcreate (g, "LV", "VG", 8);
+ r = guestfs_lvcreate (g, logvol, volgroup, 8);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/VG/LV";
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/VG/LV";
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/VG/LV", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "/dev/sda1";
+ expected[5] = devchar;
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_pvs_0: expected \"%s\" but got \"%s\"\n", expected, r[0]);
+ return -1;
+ }
}
if (r[1] != NULL) {
fprintf (stderr, "test_pvs_0: extra elements returned from command\n");
{
/* InitEmpty for pvs (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for pvs (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",10";
+ char lines_1[] = ",20";
+ char lines_2[] = ",";
char *lines[] = {
- ",10",
- ",20",
- ",",
+ lines_0,
+ lines_1,
+ lines_2,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda1");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda2";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda2");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda3";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_pvcreate (g, "/dev/sda3");
+ r = guestfs_pvcreate (g, device);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "/dev/sda1";
+ expected[5] = devchar;
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_pvs_1: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/sda2";
+ expected[5] = devchar;
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_pvs_1: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/sda3";
+ expected[5] = devchar;
+ if (strcmp (r[2], expected) != 0) {
+ fprintf (stderr, "test_pvs_1: expected \"%s\" but got \"%s\"\n", expected, r[2]);
+ return -1;
+ }
}
if (r[3] != NULL) {
fprintf (stderr, "test_pvs_1: extra elements returned from command\n");
{
/* InitBasicFS for list_partitions (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "/dev/sda1";
+ expected[5] = devchar;
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_list_partitions_0: expected \"%s\" but got \"%s\"\n", expected, r[0]);
+ return -1;
+ }
}
if (r[1] != NULL) {
fprintf (stderr, "test_list_partitions_0: extra elements returned from command\n");
{
/* InitEmpty for list_partitions (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
}
/* TestOutputList for list_partitions (1) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",10";
+ char lines_1[] = ",20";
+ char lines_2[] = ",";
char *lines[] = {
- ",10",
- ",20",
- ",",
+ lines_0,
+ lines_1,
+ lines_2,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
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;
+ {
+ char expected[] = "/dev/sda1";
+ expected[5] = devchar;
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_list_partitions_1: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/sda2";
+ expected[5] = devchar;
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_list_partitions_1: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/sda3";
+ expected[5] = devchar;
+ if (strcmp (r[2], expected) != 0) {
+ fprintf (stderr, "test_list_partitions_1: expected \"%s\" but got \"%s\"\n", expected, r[2]);
+ return -1;
+ }
}
if (r[3] != NULL) {
fprintf (stderr, "test_list_partitions_1: extra elements returned from command\n");
{
/* InitEmpty for list_devices (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
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;
+ {
+ char expected[] = "/dev/sda";
+ expected[5] = devchar;
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_list_devices_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/sdb";
+ expected[5] = devchar;
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_list_devices_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "/dev/sdc";
+ expected[5] = devchar;
+ if (strcmp (r[2], expected) != 0) {
+ fprintf (stderr, "test_list_devices_0: expected \"%s\" but got \"%s\"\n", expected, r[2]);
+ return -1;
+ }
}
if (r[3] != NULL) {
fprintf (stderr, "test_list_devices_0: extra elements returned from command\n");
{
/* InitBasicFS for ls (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputList for ls (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/newer";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/newer");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/newest";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/newest");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char directory[] = "/";
char **r;
int i;
suppress_error = 0;
- r = guestfs_ls (g, "/");
+ r = guestfs_ls (g, directory);
if (r == NULL)
return -1;
if (!r[0]) {
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;
+ {
+ char expected[] = "lost+found";
+ if (strcmp (r[0], expected) != 0) {
+ fprintf (stderr, "test_ls_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "new";
+ if (strcmp (r[1], expected) != 0) {
+ fprintf (stderr, "test_ls_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "newer";
+ if (strcmp (r[2], expected) != 0) {
+ fprintf (stderr, "test_ls_0: expected \"%s\" but got \"%s\"\n", expected, 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;
+ {
+ char expected[] = "newest";
+ if (strcmp (r[3], expected) != 0) {
+ fprintf (stderr, "test_ls_0: expected \"%s\" but got \"%s\"\n", expected, r[3]);
+ return -1;
+ }
}
if (r[4] != NULL) {
fprintf (stderr, "test_ls_0: extra elements returned from command\n");
{
/* InitBasicFS for cat (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutput for cat (0) */
+ char expected[] = "new file contents";
{
+ char path[] = "/new";
+ char content[] = "new file contents";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "new file contents", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
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 (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_cat_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
{
/* InitBasicFS for touch (0): create ext2 on /dev/sda1 */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
/* TestOutputTrue for touch (0) */
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_touch (g, "/new");
+ r = guestfs_touch (g, path);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
int r;
suppress_error = 0;
- r = guestfs_exists (g, "/new");
+ r = guestfs_exists (g, path);
if (r == -1)
return -1;
if (!r) {
{
/* InitEmpty for sync (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
{
/* InitEmpty for mount (0) */
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
int r;
suppress_error = 0;
r = guestfs_umount_all (g);
return -1;
}
/* TestOutput for mount (0) */
+ char expected[] = "new file contents";
{
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
char *lines[] = {
- ",",
+ lines_0,
NULL
};
int r;
suppress_error = 0;
- r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
if (r == -1)
return -1;
}
{
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
int r;
suppress_error = 0;
- r = guestfs_mkfs (g, "ext2", "/dev/sda1");
+ r = guestfs_mkfs (g, fstype, device);
if (r == -1)
return -1;
}
{
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ char mountpoint[] = "/";
int r;
suppress_error = 0;
- r = guestfs_mount (g, "/dev/sda1", "/");
+ r = guestfs_mount (g, device, mountpoint);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
+ char content[] = "new file contents";
int r;
suppress_error = 0;
- r = guestfs_write_file (g, "/new", "new file contents", 0);
+ r = guestfs_write_file (g, path, content, 0);
if (r == -1)
return -1;
}
{
+ char path[] = "/new";
char *r;
suppress_error = 0;
- r = guestfs_cat (g, "/new");
+ r = guestfs_cat (g, path);
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 (strcmp (r, expected) != 0) {
+ fprintf (stderr, "test_mount_0: expected \"%s\" but got \"%s\"\n", expected, r);
return -1;
}
free (r);
int failed = 0;
const char *srcdir;
const char *filename;
- int fd;
+ int fd, i;
int nr_tests, test_num = 0;
+ char **devs;
no_test_warnings ();
exit (1);
}
+ /* Detect if the appliance uses /dev/sd* or /dev/hd* in device
+ * names. This changed between RHEL 5 and RHEL 6 so we have to
+ * support both.
+ */
+ devs = guestfs_list_devices (g);
+ if (devs == NULL || devs[0] == NULL) {
+ printf ("guestfs_list_devices FAILED\n");
+ exit (1);
+ }
+ if (strncmp (devs[0], "/dev/sd", 7) == 0)
+ devchar = 's';
+ else if (strncmp (devs[0], "/dev/hd", 7) == 0)
+ devchar = 'h';
+ else {
+ printf ("guestfs_list_devices returned unexpected string '%s'\n",
+ devs[0]);
+ exit (1);
+ }
+ for (i = 0; devs[i] != NULL; ++i)
+ free (devs[i]);
+ free (devs);
+
nr_tests = 107;
test_num++;