1 /* libguestfs generated file
2 * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3 * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
5 * Copyright (C) 2009 Red Hat Inc.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <sys/types.h>
32 static int suppress_error = 0;
34 static void print_error (guestfs_h *g, void *data, const char *msg)
37 fprintf (stderr, "%s\n", msg);
40 static void print_strings (char * const * const argv)
44 for (argc = 0; argv[argc] != NULL; ++argc)
45 printf ("\t%s\n", argv[argc]);
49 static void print_table (char * const * const argv)
53 for (i = 0; argv[i] != NULL; i += 2)
54 printf ("%s: %s\n", argv[i], argv[i+1]);
58 static void no_test_warnings (void)
60 fprintf (stderr, "warning: \"guestfs_launch\" has no tests\n");
61 fprintf (stderr, "warning: \"guestfs_wait_ready\" has no tests\n");
62 fprintf (stderr, "warning: \"guestfs_kill_subprocess\" has no tests\n");
63 fprintf (stderr, "warning: \"guestfs_add_drive\" has no tests\n");
64 fprintf (stderr, "warning: \"guestfs_add_cdrom\" has no tests\n");
65 fprintf (stderr, "warning: \"guestfs_config\" has no tests\n");
66 fprintf (stderr, "warning: \"guestfs_set_qemu\" has no tests\n");
67 fprintf (stderr, "warning: \"guestfs_get_qemu\" has no tests\n");
68 fprintf (stderr, "warning: \"guestfs_set_path\" has no tests\n");
69 fprintf (stderr, "warning: \"guestfs_get_path\" has no tests\n");
70 fprintf (stderr, "warning: \"guestfs_set_autosync\" has no tests\n");
71 fprintf (stderr, "warning: \"guestfs_get_autosync\" has no tests\n");
72 fprintf (stderr, "warning: \"guestfs_set_verbose\" has no tests\n");
73 fprintf (stderr, "warning: \"guestfs_get_verbose\" has no tests\n");
74 fprintf (stderr, "warning: \"guestfs_is_ready\" has no tests\n");
75 fprintf (stderr, "warning: \"guestfs_is_config\" has no tests\n");
76 fprintf (stderr, "warning: \"guestfs_is_launching\" has no tests\n");
77 fprintf (stderr, "warning: \"guestfs_is_busy\" has no tests\n");
78 fprintf (stderr, "warning: \"guestfs_get_state\" has no tests\n");
79 fprintf (stderr, "warning: \"guestfs_set_busy\" has no tests\n");
80 fprintf (stderr, "warning: \"guestfs_set_ready\" has no tests\n");
81 fprintf (stderr, "warning: \"guestfs_ll\" has no tests\n");
82 fprintf (stderr, "warning: \"guestfs_pvs_full\" has no tests\n");
83 fprintf (stderr, "warning: \"guestfs_vgs_full\" has no tests\n");
84 fprintf (stderr, "warning: \"guestfs_lvs_full\" has no tests\n");
85 fprintf (stderr, "warning: \"guestfs_aug_init\" has no tests\n");
86 fprintf (stderr, "warning: \"guestfs_aug_close\" has no tests\n");
87 fprintf (stderr, "warning: \"guestfs_aug_defvar\" has no tests\n");
88 fprintf (stderr, "warning: \"guestfs_aug_defnode\" has no tests\n");
89 fprintf (stderr, "warning: \"guestfs_aug_get\" has no tests\n");
90 fprintf (stderr, "warning: \"guestfs_aug_set\" has no tests\n");
91 fprintf (stderr, "warning: \"guestfs_aug_insert\" has no tests\n");
92 fprintf (stderr, "warning: \"guestfs_aug_rm\" has no tests\n");
93 fprintf (stderr, "warning: \"guestfs_aug_mv\" has no tests\n");
94 fprintf (stderr, "warning: \"guestfs_aug_match\" has no tests\n");
95 fprintf (stderr, "warning: \"guestfs_aug_save\" has no tests\n");
96 fprintf (stderr, "warning: \"guestfs_aug_load\" has no tests\n");
97 fprintf (stderr, "warning: \"guestfs_aug_ls\" has no tests\n");
98 fprintf (stderr, "warning: \"guestfs_chmod\" has no tests\n");
99 fprintf (stderr, "warning: \"guestfs_chown\" has no tests\n");
100 fprintf (stderr, "warning: \"guestfs_sfdisk\" has no tests\n");
101 fprintf (stderr, "warning: \"guestfs_lvm_remove_all\" has no tests\n");
102 fprintf (stderr, "warning: \"guestfs_command\" has no tests\n");
103 fprintf (stderr, "warning: \"guestfs_command_lines\" has no tests\n");
104 fprintf (stderr, "warning: \"guestfs_tune2fs_l\" has no tests\n");
105 fprintf (stderr, "warning: \"guestfs_blockdev_setbsz\" has no tests\n");
106 fprintf (stderr, "warning: \"guestfs_tar_out\" has no tests\n");
107 fprintf (stderr, "warning: \"guestfs_tgz_out\" has no tests\n");
108 fprintf (stderr, "warning: \"guestfs_mount_options\" has no tests\n");
109 fprintf (stderr, "warning: \"guestfs_mount_vfs\" has no tests\n");
110 fprintf (stderr, "warning: \"guestfs_debug\" has no tests\n");
111 fprintf (stderr, "warning: \"guestfs_get_e2label\" has no tests\n");
112 fprintf (stderr, "warning: \"guestfs_get_e2uuid\" has no tests\n");
115 static int test_fsck_0 (void)
117 /* InitBasicFS for fsck (0): create ext2 on /dev/sda1 */
121 r = guestfs_umount_all (g);
128 r = guestfs_lvm_remove_all (g);
139 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
146 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
153 r = guestfs_mount (g, "/dev/sda1", "/");
157 /* TestRun for fsck (0) */
161 r = guestfs_fsck (g, "ext2", "/dev/sda1");
168 static int test_set_e2uuid_0 (void)
170 /* InitBasicFS for set_e2uuid (0): create ext2 on /dev/sda1 */
174 r = guestfs_umount_all (g);
181 r = guestfs_lvm_remove_all (g);
192 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
199 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
206 r = guestfs_mount (g, "/dev/sda1", "/");
210 /* TestOutput for set_e2uuid (0) */
214 r = guestfs_set_e2uuid (g, "/dev/sda1", "a3a61220-882b-4f61-89f4-cf24dcc7297d");
221 r = guestfs_get_e2uuid (g, "/dev/sda1");
224 if (strcmp (r, "a3a61220-882b-4f61-89f4-cf24dcc7297d") != 0) {
225 fprintf (stderr, "test_set_e2uuid_0: expected \"a3a61220-882b-4f61-89f4-cf24dcc7297d\" but got \"%s\"\n", r);
233 static int test_set_e2uuid_1 (void)
235 /* InitBasicFS for set_e2uuid (1): create ext2 on /dev/sda1 */
239 r = guestfs_umount_all (g);
246 r = guestfs_lvm_remove_all (g);
257 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
264 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
271 r = guestfs_mount (g, "/dev/sda1", "/");
275 /* TestOutput for set_e2uuid (1) */
279 r = guestfs_set_e2uuid (g, "/dev/sda1", "clear");
286 r = guestfs_get_e2uuid (g, "/dev/sda1");
289 if (strcmp (r, "") != 0) {
290 fprintf (stderr, "test_set_e2uuid_1: expected \"\" but got \"%s\"\n", r);
298 static int test_set_e2uuid_2 (void)
300 /* InitBasicFS for set_e2uuid (2): create ext2 on /dev/sda1 */
304 r = guestfs_umount_all (g);
311 r = guestfs_lvm_remove_all (g);
322 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
329 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
336 r = guestfs_mount (g, "/dev/sda1", "/");
340 /* TestRun for set_e2uuid (2) */
344 r = guestfs_set_e2uuid (g, "/dev/sda1", "random");
351 static int test_set_e2uuid_3 (void)
353 /* InitBasicFS for set_e2uuid (3): create ext2 on /dev/sda1 */
357 r = guestfs_umount_all (g);
364 r = guestfs_lvm_remove_all (g);
375 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
382 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
389 r = guestfs_mount (g, "/dev/sda1", "/");
393 /* TestRun for set_e2uuid (3) */
397 r = guestfs_set_e2uuid (g, "/dev/sda1", "time");
404 static int test_set_e2label_0 (void)
406 /* InitBasicFS for set_e2label (0): create ext2 on /dev/sda1 */
410 r = guestfs_umount_all (g);
417 r = guestfs_lvm_remove_all (g);
428 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
435 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
442 r = guestfs_mount (g, "/dev/sda1", "/");
446 /* TestOutput for set_e2label (0) */
450 r = guestfs_set_e2label (g, "/dev/sda1", "testlabel");
457 r = guestfs_get_e2label (g, "/dev/sda1");
460 if (strcmp (r, "testlabel") != 0) {
461 fprintf (stderr, "test_set_e2label_0: expected \"testlabel\" but got \"%s\"\n", r);
469 static int test_pvremove_0 (void)
471 /* InitEmpty for pvremove (0) */
475 r = guestfs_umount_all (g);
482 r = guestfs_lvm_remove_all (g);
486 /* TestOutputList for pvremove (0) */
490 r = guestfs_pvcreate (g, "/dev/sda");
501 r = guestfs_vgcreate (g, "VG", physvols);
508 r = guestfs_lvcreate (g, "LV1", "VG", 50);
515 r = guestfs_lvcreate (g, "LV2", "VG", 50);
522 r = guestfs_vgremove (g, "VG");
529 r = guestfs_pvremove (g, "/dev/sda");
541 fprintf (stderr, "test_pvremove_0: extra elements returned from command\n");
545 for (i = 0; r[i] != NULL; ++i)
552 static int test_pvremove_1 (void)
554 /* InitEmpty for pvremove (1) */
558 r = guestfs_umount_all (g);
565 r = guestfs_lvm_remove_all (g);
569 /* TestOutputList for pvremove (1) */
573 r = guestfs_pvcreate (g, "/dev/sda");
584 r = guestfs_vgcreate (g, "VG", physvols);
591 r = guestfs_lvcreate (g, "LV1", "VG", 50);
598 r = guestfs_lvcreate (g, "LV2", "VG", 50);
605 r = guestfs_vgremove (g, "VG");
612 r = guestfs_pvremove (g, "/dev/sda");
624 fprintf (stderr, "test_pvremove_1: extra elements returned from command\n");
628 for (i = 0; r[i] != NULL; ++i)
635 static int test_pvremove_2 (void)
637 /* InitEmpty for pvremove (2) */
641 r = guestfs_umount_all (g);
648 r = guestfs_lvm_remove_all (g);
652 /* TestOutputList for pvremove (2) */
656 r = guestfs_pvcreate (g, "/dev/sda");
667 r = guestfs_vgcreate (g, "VG", physvols);
674 r = guestfs_lvcreate (g, "LV1", "VG", 50);
681 r = guestfs_lvcreate (g, "LV2", "VG", 50);
688 r = guestfs_vgremove (g, "VG");
695 r = guestfs_pvremove (g, "/dev/sda");
707 fprintf (stderr, "test_pvremove_2: extra elements returned from command\n");
711 for (i = 0; r[i] != NULL; ++i)
718 static int test_vgremove_0 (void)
720 /* InitEmpty for vgremove (0) */
724 r = guestfs_umount_all (g);
731 r = guestfs_lvm_remove_all (g);
735 /* TestOutputList for vgremove (0) */
739 r = guestfs_pvcreate (g, "/dev/sda");
750 r = guestfs_vgcreate (g, "VG", physvols);
757 r = guestfs_lvcreate (g, "LV1", "VG", 50);
764 r = guestfs_lvcreate (g, "LV2", "VG", 50);
771 r = guestfs_vgremove (g, "VG");
783 fprintf (stderr, "test_vgremove_0: extra elements returned from command\n");
787 for (i = 0; r[i] != NULL; ++i)
794 static int test_vgremove_1 (void)
796 /* InitEmpty for vgremove (1) */
800 r = guestfs_umount_all (g);
807 r = guestfs_lvm_remove_all (g);
811 /* TestOutputList for vgremove (1) */
815 r = guestfs_pvcreate (g, "/dev/sda");
826 r = guestfs_vgcreate (g, "VG", physvols);
833 r = guestfs_lvcreate (g, "LV1", "VG", 50);
840 r = guestfs_lvcreate (g, "LV2", "VG", 50);
847 r = guestfs_vgremove (g, "VG");
859 fprintf (stderr, "test_vgremove_1: extra elements returned from command\n");
863 for (i = 0; r[i] != NULL; ++i)
870 static int test_lvremove_0 (void)
872 /* InitEmpty for lvremove (0) */
876 r = guestfs_umount_all (g);
883 r = guestfs_lvm_remove_all (g);
887 /* TestOutputList for lvremove (0) */
891 r = guestfs_pvcreate (g, "/dev/sda");
902 r = guestfs_vgcreate (g, "VG", physvols);
909 r = guestfs_lvcreate (g, "LV1", "VG", 50);
916 r = guestfs_lvcreate (g, "LV2", "VG", 50);
923 r = guestfs_lvremove (g, "/dev/VG/LV1");
935 fprintf (stderr, "test_lvremove_0: short list returned from command\n");
939 if (strcmp (r[0], "/dev/VG/LV2") != 0) {
940 fprintf (stderr, "test_lvremove_0: expected \"/dev/VG/LV2\" but got \"%s\"\n", r[0]);
944 fprintf (stderr, "test_lvremove_0: extra elements returned from command\n");
948 for (i = 0; r[i] != NULL; ++i)
955 static int test_lvremove_1 (void)
957 /* InitEmpty for lvremove (1) */
961 r = guestfs_umount_all (g);
968 r = guestfs_lvm_remove_all (g);
972 /* TestOutputList for lvremove (1) */
976 r = guestfs_pvcreate (g, "/dev/sda");
987 r = guestfs_vgcreate (g, "VG", physvols);
994 r = guestfs_lvcreate (g, "LV1", "VG", 50);
1001 r = guestfs_lvcreate (g, "LV2", "VG", 50);
1008 r = guestfs_lvremove (g, "/dev/VG");
1016 r = guestfs_lvs (g);
1020 fprintf (stderr, "test_lvremove_1: extra elements returned from command\n");
1024 for (i = 0; r[i] != NULL; ++i)
1031 static int test_lvremove_2 (void)
1033 /* InitEmpty for lvremove (2) */
1037 r = guestfs_umount_all (g);
1044 r = guestfs_lvm_remove_all (g);
1048 /* TestOutputList for lvremove (2) */
1052 r = guestfs_pvcreate (g, "/dev/sda");
1057 char *physvols[] = {
1063 r = guestfs_vgcreate (g, "VG", physvols);
1070 r = guestfs_lvcreate (g, "LV1", "VG", 50);
1077 r = guestfs_lvcreate (g, "LV2", "VG", 50);
1084 r = guestfs_lvremove (g, "/dev/VG");
1092 r = guestfs_vgs (g);
1096 fprintf (stderr, "test_lvremove_2: short list returned from command\n");
1100 if (strcmp (r[0], "VG") != 0) {
1101 fprintf (stderr, "test_lvremove_2: expected \"VG\" but got \"%s\"\n", r[0]);
1105 fprintf (stderr, "test_lvremove_2: extra elements returned from command\n");
1109 for (i = 0; r[i] != NULL; ++i)
1116 static int test_mount_ro_0 (void)
1118 /* InitBasicFS for mount_ro (0): create ext2 on /dev/sda1 */
1122 r = guestfs_umount_all (g);
1129 r = guestfs_lvm_remove_all (g);
1140 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1147 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1154 r = guestfs_mount (g, "/dev/sda1", "/");
1158 /* TestLastFail for mount_ro (0) */
1162 r = guestfs_umount (g, "/");
1169 r = guestfs_mount_ro (g, "/dev/sda1", "/");
1176 r = guestfs_touch (g, "/new");
1183 static int test_mount_ro_1 (void)
1185 /* InitBasicFS for mount_ro (1): create ext2 on /dev/sda1 */
1189 r = guestfs_umount_all (g);
1196 r = guestfs_lvm_remove_all (g);
1207 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1214 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1221 r = guestfs_mount (g, "/dev/sda1", "/");
1225 /* TestOutput for mount_ro (1) */
1229 r = guestfs_write_file (g, "/new", "data", 0);
1236 r = guestfs_umount (g, "/");
1243 r = guestfs_mount_ro (g, "/dev/sda1", "/");
1250 r = guestfs_cat (g, "/new");
1253 if (strcmp (r, "data") != 0) {
1254 fprintf (stderr, "test_mount_ro_1: expected \"data\" but got \"%s\"\n", r);
1262 static int test_tgz_in_0 (void)
1264 /* InitBasicFS for tgz_in (0): create ext2 on /dev/sda1 */
1268 r = guestfs_umount_all (g);
1275 r = guestfs_lvm_remove_all (g);
1286 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1293 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1300 r = guestfs_mount (g, "/dev/sda1", "/");
1304 /* TestOutput for tgz_in (0) */
1308 r = guestfs_tgz_in (g, "images/helloworld.tar.gz", "/");
1315 r = guestfs_cat (g, "/hello");
1318 if (strcmp (r, "hello\n") != 0) {
1319 fprintf (stderr, "test_tgz_in_0: expected \"hello\n\" but got \"%s\"\n", r);
1327 static int test_tar_in_0 (void)
1329 /* InitBasicFS for tar_in (0): create ext2 on /dev/sda1 */
1333 r = guestfs_umount_all (g);
1340 r = guestfs_lvm_remove_all (g);
1351 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1358 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1365 r = guestfs_mount (g, "/dev/sda1", "/");
1369 /* TestOutput for tar_in (0) */
1373 r = guestfs_tar_in (g, "images/helloworld.tar", "/");
1380 r = guestfs_cat (g, "/hello");
1383 if (strcmp (r, "hello\n") != 0) {
1384 fprintf (stderr, "test_tar_in_0: expected \"hello\n\" but got \"%s\"\n", r);
1392 static int test_checksum_0 (void)
1394 /* InitBasicFS for checksum (0): create ext2 on /dev/sda1 */
1398 r = guestfs_umount_all (g);
1405 r = guestfs_lvm_remove_all (g);
1416 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1423 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1430 r = guestfs_mount (g, "/dev/sda1", "/");
1434 /* TestOutput for checksum (0) */
1438 r = guestfs_write_file (g, "/new", "test\n", 0);
1445 r = guestfs_checksum (g, "crc", "/new");
1448 if (strcmp (r, "935282863") != 0) {
1449 fprintf (stderr, "test_checksum_0: expected \"935282863\" but got \"%s\"\n", r);
1457 static int test_checksum_1 (void)
1459 /* InitBasicFS for checksum (1): create ext2 on /dev/sda1 */
1463 r = guestfs_umount_all (g);
1470 r = guestfs_lvm_remove_all (g);
1481 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1488 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1495 r = guestfs_mount (g, "/dev/sda1", "/");
1499 /* TestLastFail for checksum (1) */
1503 r = guestfs_checksum (g, "crc", "/new");
1511 static int test_checksum_2 (void)
1513 /* InitBasicFS for checksum (2): create ext2 on /dev/sda1 */
1517 r = guestfs_umount_all (g);
1524 r = guestfs_lvm_remove_all (g);
1535 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1542 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1549 r = guestfs_mount (g, "/dev/sda1", "/");
1553 /* TestOutput for checksum (2) */
1557 r = guestfs_write_file (g, "/new", "test\n", 0);
1564 r = guestfs_checksum (g, "md5", "/new");
1567 if (strcmp (r, "d8e8fca2dc0f896fd7cb4cb0031ba249") != 0) {
1568 fprintf (stderr, "test_checksum_2: expected \"d8e8fca2dc0f896fd7cb4cb0031ba249\" but got \"%s\"\n", r);
1576 static int test_checksum_3 (void)
1578 /* InitBasicFS for checksum (3): create ext2 on /dev/sda1 */
1582 r = guestfs_umount_all (g);
1589 r = guestfs_lvm_remove_all (g);
1600 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1607 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1614 r = guestfs_mount (g, "/dev/sda1", "/");
1618 /* TestOutput for checksum (3) */
1622 r = guestfs_write_file (g, "/new", "test\n", 0);
1629 r = guestfs_checksum (g, "sha1", "/new");
1632 if (strcmp (r, "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83") != 0) {
1633 fprintf (stderr, "test_checksum_3: expected \"4e1243bd22c66e76c2ba9eddc1f91394e57f9f83\" but got \"%s\"\n", r);
1641 static int test_checksum_4 (void)
1643 /* InitBasicFS for checksum (4): create ext2 on /dev/sda1 */
1647 r = guestfs_umount_all (g);
1654 r = guestfs_lvm_remove_all (g);
1665 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1672 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1679 r = guestfs_mount (g, "/dev/sda1", "/");
1683 /* TestOutput for checksum (4) */
1687 r = guestfs_write_file (g, "/new", "test\n", 0);
1694 r = guestfs_checksum (g, "sha224", "/new");
1697 if (strcmp (r, "52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec") != 0) {
1698 fprintf (stderr, "test_checksum_4: expected \"52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec\" but got \"%s\"\n", r);
1706 static int test_checksum_5 (void)
1708 /* InitBasicFS for checksum (5): create ext2 on /dev/sda1 */
1712 r = guestfs_umount_all (g);
1719 r = guestfs_lvm_remove_all (g);
1730 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1737 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1744 r = guestfs_mount (g, "/dev/sda1", "/");
1748 /* TestOutput for checksum (5) */
1752 r = guestfs_write_file (g, "/new", "test\n", 0);
1759 r = guestfs_checksum (g, "sha256", "/new");
1762 if (strcmp (r, "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2") != 0) {
1763 fprintf (stderr, "test_checksum_5: expected \"f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2\" but got \"%s\"\n", r);
1771 static int test_checksum_6 (void)
1773 /* InitBasicFS for checksum (6): create ext2 on /dev/sda1 */
1777 r = guestfs_umount_all (g);
1784 r = guestfs_lvm_remove_all (g);
1795 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1802 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1809 r = guestfs_mount (g, "/dev/sda1", "/");
1813 /* TestOutput for checksum (6) */
1817 r = guestfs_write_file (g, "/new", "test\n", 0);
1824 r = guestfs_checksum (g, "sha384", "/new");
1827 if (strcmp (r, "109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d") != 0) {
1828 fprintf (stderr, "test_checksum_6: expected \"109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d\" but got \"%s\"\n", r);
1836 static int test_checksum_7 (void)
1838 /* InitBasicFS for checksum (7): create ext2 on /dev/sda1 */
1842 r = guestfs_umount_all (g);
1849 r = guestfs_lvm_remove_all (g);
1860 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1867 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1874 r = guestfs_mount (g, "/dev/sda1", "/");
1878 /* TestOutput for checksum (7) */
1882 r = guestfs_write_file (g, "/new", "test\n", 0);
1889 r = guestfs_checksum (g, "sha512", "/new");
1892 if (strcmp (r, "0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123") != 0) {
1893 fprintf (stderr, "test_checksum_7: expected \"0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123\" but got \"%s\"\n", r);
1901 static int test_download_0 (void)
1903 /* InitBasicFS for download (0): create ext2 on /dev/sda1 */
1907 r = guestfs_umount_all (g);
1914 r = guestfs_lvm_remove_all (g);
1925 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1932 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1939 r = guestfs_mount (g, "/dev/sda1", "/");
1943 /* TestOutput for download (0) */
1947 r = guestfs_upload (g, "COPYING.LIB", "/COPYING.LIB");
1954 r = guestfs_download (g, "/COPYING.LIB", "testdownload.tmp");
1961 r = guestfs_upload (g, "testdownload.tmp", "/upload");
1968 r = guestfs_checksum (g, "md5", "/upload");
1971 if (strcmp (r, "e3eda01d9815f8d24aae2dbd89b68b06") != 0) {
1972 fprintf (stderr, "test_download_0: expected \"e3eda01d9815f8d24aae2dbd89b68b06\" but got \"%s\"\n", r);
1980 static int test_upload_0 (void)
1982 /* InitBasicFS for upload (0): create ext2 on /dev/sda1 */
1986 r = guestfs_umount_all (g);
1993 r = guestfs_lvm_remove_all (g);
2004 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2011 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2018 r = guestfs_mount (g, "/dev/sda1", "/");
2022 /* TestOutput for upload (0) */
2026 r = guestfs_upload (g, "COPYING.LIB", "/COPYING.LIB");
2033 r = guestfs_checksum (g, "md5", "/COPYING.LIB");
2036 if (strcmp (r, "e3eda01d9815f8d24aae2dbd89b68b06") != 0) {
2037 fprintf (stderr, "test_upload_0: expected \"e3eda01d9815f8d24aae2dbd89b68b06\" but got \"%s\"\n", r);
2045 static int test_blockdev_rereadpt_0 (void)
2047 /* InitEmpty for blockdev_rereadpt (0) */
2051 r = guestfs_umount_all (g);
2058 r = guestfs_lvm_remove_all (g);
2062 /* TestRun for blockdev_rereadpt (0) */
2066 r = guestfs_blockdev_rereadpt (g, "/dev/sda");
2073 static int test_blockdev_flushbufs_0 (void)
2075 /* InitEmpty for blockdev_flushbufs (0) */
2079 r = guestfs_umount_all (g);
2086 r = guestfs_lvm_remove_all (g);
2090 /* TestRun for blockdev_flushbufs (0) */
2094 r = guestfs_blockdev_flushbufs (g, "/dev/sda");
2101 static int test_blockdev_getsize64_0 (void)
2103 /* InitEmpty for blockdev_getsize64 (0) */
2107 r = guestfs_umount_all (g);
2114 r = guestfs_lvm_remove_all (g);
2118 /* TestOutputInt for blockdev_getsize64 (0) */
2122 r = guestfs_blockdev_getsize64 (g, "/dev/sda");
2125 if (r != 524288000) {
2126 fprintf (stderr, "test_blockdev_getsize64_0: expected 524288000 but got %d\n", (int) r);
2133 static int test_blockdev_getsz_0 (void)
2135 /* InitEmpty for blockdev_getsz (0) */
2139 r = guestfs_umount_all (g);
2146 r = guestfs_lvm_remove_all (g);
2150 /* TestOutputInt for blockdev_getsz (0) */
2154 r = guestfs_blockdev_getsz (g, "/dev/sda");
2158 fprintf (stderr, "test_blockdev_getsz_0: expected 1024000 but got %d\n", (int) r);
2165 static int test_blockdev_getbsz_0 (void)
2167 /* InitEmpty for blockdev_getbsz (0) */
2171 r = guestfs_umount_all (g);
2178 r = guestfs_lvm_remove_all (g);
2182 /* TestOutputInt for blockdev_getbsz (0) */
2186 r = guestfs_blockdev_getbsz (g, "/dev/sda");
2190 fprintf (stderr, "test_blockdev_getbsz_0: expected 4096 but got %d\n", (int) r);
2197 static int test_blockdev_getss_0 (void)
2199 /* InitEmpty for blockdev_getss (0) */
2203 r = guestfs_umount_all (g);
2210 r = guestfs_lvm_remove_all (g);
2214 /* TestOutputInt for blockdev_getss (0) */
2218 r = guestfs_blockdev_getss (g, "/dev/sda");
2222 fprintf (stderr, "test_blockdev_getss_0: expected 512 but got %d\n", (int) r);
2229 static int test_blockdev_getro_0 (void)
2231 /* InitEmpty for blockdev_getro (0) */
2235 r = guestfs_umount_all (g);
2242 r = guestfs_lvm_remove_all (g);
2246 /* TestOutputTrue for blockdev_getro (0) */
2250 r = guestfs_blockdev_setro (g, "/dev/sda");
2257 r = guestfs_blockdev_getro (g, "/dev/sda");
2261 fprintf (stderr, "test_blockdev_getro_0: expected true, got false\n");
2268 static int test_blockdev_setrw_0 (void)
2270 /* InitEmpty for blockdev_setrw (0) */
2274 r = guestfs_umount_all (g);
2281 r = guestfs_lvm_remove_all (g);
2285 /* TestOutputFalse for blockdev_setrw (0) */
2289 r = guestfs_blockdev_setrw (g, "/dev/sda");
2296 r = guestfs_blockdev_getro (g, "/dev/sda");
2300 fprintf (stderr, "test_blockdev_setrw_0: expected false, got true\n");
2307 static int test_blockdev_setro_0 (void)
2309 /* InitEmpty for blockdev_setro (0) */
2313 r = guestfs_umount_all (g);
2320 r = guestfs_lvm_remove_all (g);
2324 /* TestOutputTrue for blockdev_setro (0) */
2328 r = guestfs_blockdev_setro (g, "/dev/sda");
2335 r = guestfs_blockdev_getro (g, "/dev/sda");
2339 fprintf (stderr, "test_blockdev_setro_0: expected true, got false\n");
2346 static int test_statvfs_0 (void)
2348 /* InitBasicFS for statvfs (0): create ext2 on /dev/sda1 */
2352 r = guestfs_umount_all (g);
2359 r = guestfs_lvm_remove_all (g);
2370 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2377 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2384 r = guestfs_mount (g, "/dev/sda1", "/");
2388 /* TestOutputStruct for statvfs (0) */
2390 struct guestfs_statvfs *r;
2392 r = guestfs_statvfs (g, "/");
2395 if (r->bfree != 487702) {
2396 fprintf (stderr, "test_statvfs_0: bfree was %d, expected 487702\n",
2400 if (r->blocks != 490020) {
2401 fprintf (stderr, "test_statvfs_0: blocks was %d, expected 490020\n",
2405 if (r->bsize != 1024) {
2406 fprintf (stderr, "test_statvfs_0: bsize was %d, expected 1024\n",
2415 static int test_lstat_0 (void)
2417 /* InitBasicFS for lstat (0): create ext2 on /dev/sda1 */
2421 r = guestfs_umount_all (g);
2428 r = guestfs_lvm_remove_all (g);
2439 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2446 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2453 r = guestfs_mount (g, "/dev/sda1", "/");
2457 /* TestOutputStruct for lstat (0) */
2461 r = guestfs_touch (g, "/new");
2466 struct guestfs_stat *r;
2468 r = guestfs_lstat (g, "/new");
2472 fprintf (stderr, "test_lstat_0: size was %d, expected 0\n",
2481 static int test_stat_0 (void)
2483 /* InitBasicFS for stat (0): create ext2 on /dev/sda1 */
2487 r = guestfs_umount_all (g);
2494 r = guestfs_lvm_remove_all (g);
2505 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2512 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2519 r = guestfs_mount (g, "/dev/sda1", "/");
2523 /* TestOutputStruct for stat (0) */
2527 r = guestfs_touch (g, "/new");
2532 struct guestfs_stat *r;
2534 r = guestfs_stat (g, "/new");
2538 fprintf (stderr, "test_stat_0: size was %d, expected 0\n",
2547 static int test_file_0 (void)
2549 /* InitBasicFS for file (0): create ext2 on /dev/sda1 */
2553 r = guestfs_umount_all (g);
2560 r = guestfs_lvm_remove_all (g);
2571 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2578 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2585 r = guestfs_mount (g, "/dev/sda1", "/");
2589 /* TestOutput for file (0) */
2593 r = guestfs_touch (g, "/new");
2600 r = guestfs_file (g, "/new");
2603 if (strcmp (r, "empty") != 0) {
2604 fprintf (stderr, "test_file_0: expected \"empty\" but got \"%s\"\n", r);
2612 static int test_file_1 (void)
2614 /* InitBasicFS for file (1): create ext2 on /dev/sda1 */
2618 r = guestfs_umount_all (g);
2625 r = guestfs_lvm_remove_all (g);
2636 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2643 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2650 r = guestfs_mount (g, "/dev/sda1", "/");
2654 /* TestOutput for file (1) */
2658 r = guestfs_write_file (g, "/new", "some content\n", 0);
2665 r = guestfs_file (g, "/new");
2668 if (strcmp (r, "ASCII text") != 0) {
2669 fprintf (stderr, "test_file_1: expected \"ASCII text\" but got \"%s\"\n", r);
2677 static int test_file_2 (void)
2679 /* InitBasicFS for file (2): create ext2 on /dev/sda1 */
2683 r = guestfs_umount_all (g);
2690 r = guestfs_lvm_remove_all (g);
2701 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2708 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2715 r = guestfs_mount (g, "/dev/sda1", "/");
2719 /* TestLastFail for file (2) */
2723 r = guestfs_file (g, "/nofile");
2731 static int test_umount_all_0 (void)
2733 /* InitBasicFS for umount_all (0): create ext2 on /dev/sda1 */
2737 r = guestfs_umount_all (g);
2744 r = guestfs_lvm_remove_all (g);
2755 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2762 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2769 r = guestfs_mount (g, "/dev/sda1", "/");
2773 /* TestOutputList for umount_all (0) */
2777 r = guestfs_umount_all (g);
2785 r = guestfs_mounts (g);
2789 fprintf (stderr, "test_umount_all_0: extra elements returned from command\n");
2793 for (i = 0; r[i] != NULL; ++i)
2800 static int test_umount_all_1 (void)
2802 /* InitEmpty for umount_all (1) */
2806 r = guestfs_umount_all (g);
2813 r = guestfs_lvm_remove_all (g);
2817 /* TestOutputList for umount_all (1) */
2827 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2834 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2841 r = guestfs_mkfs (g, "ext2", "/dev/sda2");
2848 r = guestfs_mkfs (g, "ext2", "/dev/sda3");
2855 r = guestfs_mount (g, "/dev/sda1", "/");
2862 r = guestfs_mkdir (g, "/mp1");
2869 r = guestfs_mount (g, "/dev/sda2", "/mp1");
2876 r = guestfs_mkdir (g, "/mp1/mp2");
2883 r = guestfs_mount (g, "/dev/sda3", "/mp1/mp2");
2890 r = guestfs_mkdir (g, "/mp1/mp2/mp3");
2897 r = guestfs_umount_all (g);
2905 r = guestfs_mounts (g);
2909 fprintf (stderr, "test_umount_all_1: extra elements returned from command\n");
2913 for (i = 0; r[i] != NULL; ++i)
2920 static int test_mounts_0 (void)
2922 /* InitBasicFS for mounts (0): create ext2 on /dev/sda1 */
2926 r = guestfs_umount_all (g);
2933 r = guestfs_lvm_remove_all (g);
2944 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2951 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2958 r = guestfs_mount (g, "/dev/sda1", "/");
2962 /* TestOutputList for mounts (0) */
2967 r = guestfs_mounts (g);
2971 fprintf (stderr, "test_mounts_0: short list returned from command\n");
2975 if (strcmp (r[0], "/dev/sda1") != 0) {
2976 fprintf (stderr, "test_mounts_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
2980 fprintf (stderr, "test_mounts_0: extra elements returned from command\n");
2984 for (i = 0; r[i] != NULL; ++i)
2991 static int test_umount_0 (void)
2993 /* InitEmpty for umount (0) */
2997 r = guestfs_umount_all (g);
3004 r = guestfs_lvm_remove_all (g);
3008 /* TestOutputList for umount (0) */
3016 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3023 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3030 r = guestfs_mount (g, "/dev/sda1", "/");
3038 r = guestfs_mounts (g);
3042 fprintf (stderr, "test_umount_0: short list returned from command\n");
3046 if (strcmp (r[0], "/dev/sda1") != 0) {
3047 fprintf (stderr, "test_umount_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
3051 fprintf (stderr, "test_umount_0: extra elements returned from command\n");
3055 for (i = 0; r[i] != NULL; ++i)
3062 static int test_umount_1 (void)
3064 /* InitEmpty for umount (1) */
3068 r = guestfs_umount_all (g);
3075 r = guestfs_lvm_remove_all (g);
3079 /* TestOutputList for umount (1) */
3087 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3094 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3101 r = guestfs_mount (g, "/dev/sda1", "/");
3108 r = guestfs_umount (g, "/");
3116 r = guestfs_mounts (g);
3120 fprintf (stderr, "test_umount_1: extra elements returned from command\n");
3124 for (i = 0; r[i] != NULL; ++i)
3131 static int test_write_file_0 (void)
3133 /* InitBasicFS for write_file (0): create ext2 on /dev/sda1 */
3137 r = guestfs_umount_all (g);
3144 r = guestfs_lvm_remove_all (g);
3155 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3162 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3169 r = guestfs_mount (g, "/dev/sda1", "/");
3173 /* TestOutput for write_file (0) */
3177 r = guestfs_write_file (g, "/new", "new file contents", 0);
3184 r = guestfs_cat (g, "/new");
3187 if (strcmp (r, "new file contents") != 0) {
3188 fprintf (stderr, "test_write_file_0: expected \"new file contents\" but got \"%s\"\n", r);
3196 static int test_write_file_1 (void)
3198 /* InitBasicFS for write_file (1): create ext2 on /dev/sda1 */
3202 r = guestfs_umount_all (g);
3209 r = guestfs_lvm_remove_all (g);
3220 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3227 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3234 r = guestfs_mount (g, "/dev/sda1", "/");
3238 /* TestOutput for write_file (1) */
3242 r = guestfs_write_file (g, "/new", "\nnew file contents\n", 0);
3249 r = guestfs_cat (g, "/new");
3252 if (strcmp (r, "\nnew file contents\n") != 0) {
3253 fprintf (stderr, "test_write_file_1: expected \"\nnew file contents\n\" but got \"%s\"\n", r);
3261 static int test_write_file_2 (void)
3263 /* InitBasicFS for write_file (2): create ext2 on /dev/sda1 */
3267 r = guestfs_umount_all (g);
3274 r = guestfs_lvm_remove_all (g);
3285 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3292 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3299 r = guestfs_mount (g, "/dev/sda1", "/");
3303 /* TestOutput for write_file (2) */
3307 r = guestfs_write_file (g, "/new", "\n\n", 0);
3314 r = guestfs_cat (g, "/new");
3317 if (strcmp (r, "\n\n") != 0) {
3318 fprintf (stderr, "test_write_file_2: expected \"\n\n\" but got \"%s\"\n", r);
3326 static int test_write_file_3 (void)
3328 /* InitBasicFS for write_file (3): create ext2 on /dev/sda1 */
3332 r = guestfs_umount_all (g);
3339 r = guestfs_lvm_remove_all (g);
3350 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3357 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3364 r = guestfs_mount (g, "/dev/sda1", "/");
3368 /* TestOutput for write_file (3) */
3372 r = guestfs_write_file (g, "/new", "", 0);
3379 r = guestfs_cat (g, "/new");
3382 if (strcmp (r, "") != 0) {
3383 fprintf (stderr, "test_write_file_3: expected \"\" but got \"%s\"\n", r);
3391 static int test_write_file_4 (void)
3393 /* InitBasicFS for write_file (4): create ext2 on /dev/sda1 */
3397 r = guestfs_umount_all (g);
3404 r = guestfs_lvm_remove_all (g);
3415 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3422 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3429 r = guestfs_mount (g, "/dev/sda1", "/");
3433 /* TestOutput for write_file (4) */
3437 r = guestfs_write_file (g, "/new", "\n\n\n", 0);
3444 r = guestfs_cat (g, "/new");
3447 if (strcmp (r, "\n\n\n") != 0) {
3448 fprintf (stderr, "test_write_file_4: expected \"\n\n\n\" but got \"%s\"\n", r);
3456 static int test_write_file_5 (void)
3458 /* InitBasicFS for write_file (5): create ext2 on /dev/sda1 */
3462 r = guestfs_umount_all (g);
3469 r = guestfs_lvm_remove_all (g);
3480 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3487 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3494 r = guestfs_mount (g, "/dev/sda1", "/");
3498 /* TestOutput for write_file (5) */
3502 r = guestfs_write_file (g, "/new", "\n", 0);
3509 r = guestfs_cat (g, "/new");
3512 if (strcmp (r, "\n") != 0) {
3513 fprintf (stderr, "test_write_file_5: expected \"\n\" but got \"%s\"\n", r);
3521 static int test_mkfs_0 (void)
3523 /* InitEmpty for mkfs (0) */
3527 r = guestfs_umount_all (g);
3534 r = guestfs_lvm_remove_all (g);
3538 /* TestOutput for mkfs (0) */
3546 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3553 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3560 r = guestfs_mount (g, "/dev/sda1", "/");
3567 r = guestfs_write_file (g, "/new", "new file contents", 0);
3574 r = guestfs_cat (g, "/new");
3577 if (strcmp (r, "new file contents") != 0) {
3578 fprintf (stderr, "test_mkfs_0: expected \"new file contents\" but got \"%s\"\n", r);
3586 static int test_lvcreate_0 (void)
3588 /* InitEmpty for lvcreate (0) */
3592 r = guestfs_umount_all (g);
3599 r = guestfs_lvm_remove_all (g);
3603 /* TestOutputList for lvcreate (0) */
3613 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3620 r = guestfs_pvcreate (g, "/dev/sda1");
3627 r = guestfs_pvcreate (g, "/dev/sda2");
3634 r = guestfs_pvcreate (g, "/dev/sda3");
3639 char *physvols[] = {
3646 r = guestfs_vgcreate (g, "VG1", physvols);
3651 char *physvols[] = {
3657 r = guestfs_vgcreate (g, "VG2", physvols);
3664 r = guestfs_lvcreate (g, "LV1", "VG1", 50);
3671 r = guestfs_lvcreate (g, "LV2", "VG1", 50);
3678 r = guestfs_lvcreate (g, "LV3", "VG2", 50);
3685 r = guestfs_lvcreate (g, "LV4", "VG2", 50);
3692 r = guestfs_lvcreate (g, "LV5", "VG2", 50);
3700 r = guestfs_lvs (g);
3704 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3708 if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
3709 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
3713 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3717 if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
3718 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
3722 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3726 if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
3727 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
3731 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3735 if (strcmp (r[3], "/dev/VG2/LV4") != 0) {
3736 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV4\" but got \"%s\"\n", r[3]);
3740 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3744 if (strcmp (r[4], "/dev/VG2/LV5") != 0) {
3745 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV5\" but got \"%s\"\n", r[4]);
3749 fprintf (stderr, "test_lvcreate_0: extra elements returned from command\n");
3753 for (i = 0; r[i] != NULL; ++i)
3760 static int test_vgcreate_0 (void)
3762 /* InitEmpty for vgcreate (0) */
3766 r = guestfs_umount_all (g);
3773 r = guestfs_lvm_remove_all (g);
3777 /* TestOutputList for vgcreate (0) */
3787 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3794 r = guestfs_pvcreate (g, "/dev/sda1");
3801 r = guestfs_pvcreate (g, "/dev/sda2");
3808 r = guestfs_pvcreate (g, "/dev/sda3");
3813 char *physvols[] = {
3820 r = guestfs_vgcreate (g, "VG1", physvols);
3825 char *physvols[] = {
3831 r = guestfs_vgcreate (g, "VG2", physvols);
3839 r = guestfs_vgs (g);
3843 fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
3847 if (strcmp (r[0], "VG1") != 0) {
3848 fprintf (stderr, "test_vgcreate_0: expected \"VG1\" but got \"%s\"\n", r[0]);
3852 fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
3856 if (strcmp (r[1], "VG2") != 0) {
3857 fprintf (stderr, "test_vgcreate_0: expected \"VG2\" but got \"%s\"\n", r[1]);
3861 fprintf (stderr, "test_vgcreate_0: extra elements returned from command\n");
3865 for (i = 0; r[i] != NULL; ++i)
3872 static int test_pvcreate_0 (void)
3874 /* InitEmpty for pvcreate (0) */
3878 r = guestfs_umount_all (g);
3885 r = guestfs_lvm_remove_all (g);
3889 /* TestOutputList for pvcreate (0) */
3899 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3906 r = guestfs_pvcreate (g, "/dev/sda1");
3913 r = guestfs_pvcreate (g, "/dev/sda2");
3920 r = guestfs_pvcreate (g, "/dev/sda3");
3928 r = guestfs_pvs (g);
3932 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3936 if (strcmp (r[0], "/dev/sda1") != 0) {
3937 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
3941 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3945 if (strcmp (r[1], "/dev/sda2") != 0) {
3946 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
3950 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3954 if (strcmp (r[2], "/dev/sda3") != 0) {
3955 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
3959 fprintf (stderr, "test_pvcreate_0: extra elements returned from command\n");
3963 for (i = 0; r[i] != NULL; ++i)
3970 static int test_is_dir_0 (void)
3972 /* InitBasicFS for is_dir (0): create ext2 on /dev/sda1 */
3976 r = guestfs_umount_all (g);
3983 r = guestfs_lvm_remove_all (g);
3994 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4001 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4008 r = guestfs_mount (g, "/dev/sda1", "/");
4012 /* TestOutputFalse for is_dir (0) */
4016 r = guestfs_touch (g, "/new");
4023 r = guestfs_is_dir (g, "/new");
4027 fprintf (stderr, "test_is_dir_0: expected false, got true\n");
4034 static int test_is_dir_1 (void)
4036 /* InitBasicFS for is_dir (1): create ext2 on /dev/sda1 */
4040 r = guestfs_umount_all (g);
4047 r = guestfs_lvm_remove_all (g);
4058 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4065 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4072 r = guestfs_mount (g, "/dev/sda1", "/");
4076 /* TestOutputTrue for is_dir (1) */
4080 r = guestfs_mkdir (g, "/new");
4087 r = guestfs_is_dir (g, "/new");
4091 fprintf (stderr, "test_is_dir_1: expected true, got false\n");
4098 static int test_is_file_0 (void)
4100 /* InitBasicFS for is_file (0): create ext2 on /dev/sda1 */
4104 r = guestfs_umount_all (g);
4111 r = guestfs_lvm_remove_all (g);
4122 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4129 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4136 r = guestfs_mount (g, "/dev/sda1", "/");
4140 /* TestOutputTrue for is_file (0) */
4144 r = guestfs_touch (g, "/new");
4151 r = guestfs_is_file (g, "/new");
4155 fprintf (stderr, "test_is_file_0: expected true, got false\n");
4162 static int test_is_file_1 (void)
4164 /* InitBasicFS for is_file (1): create ext2 on /dev/sda1 */
4168 r = guestfs_umount_all (g);
4175 r = guestfs_lvm_remove_all (g);
4186 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4193 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4200 r = guestfs_mount (g, "/dev/sda1", "/");
4204 /* TestOutputFalse for is_file (1) */
4208 r = guestfs_mkdir (g, "/new");
4215 r = guestfs_is_file (g, "/new");
4219 fprintf (stderr, "test_is_file_1: expected false, got true\n");
4226 static int test_exists_0 (void)
4228 /* InitBasicFS for exists (0): create ext2 on /dev/sda1 */
4232 r = guestfs_umount_all (g);
4239 r = guestfs_lvm_remove_all (g);
4250 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4257 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4264 r = guestfs_mount (g, "/dev/sda1", "/");
4268 /* TestOutputTrue for exists (0) */
4272 r = guestfs_touch (g, "/new");
4279 r = guestfs_exists (g, "/new");
4283 fprintf (stderr, "test_exists_0: expected true, got false\n");
4290 static int test_exists_1 (void)
4292 /* InitBasicFS for exists (1): create ext2 on /dev/sda1 */
4296 r = guestfs_umount_all (g);
4303 r = guestfs_lvm_remove_all (g);
4314 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4321 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4328 r = guestfs_mount (g, "/dev/sda1", "/");
4332 /* TestOutputTrue for exists (1) */
4336 r = guestfs_mkdir (g, "/new");
4343 r = guestfs_exists (g, "/new");
4347 fprintf (stderr, "test_exists_1: expected true, got false\n");
4354 static int test_mkdir_p_0 (void)
4356 /* InitBasicFS for mkdir_p (0): create ext2 on /dev/sda1 */
4360 r = guestfs_umount_all (g);
4367 r = guestfs_lvm_remove_all (g);
4378 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4385 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4392 r = guestfs_mount (g, "/dev/sda1", "/");
4396 /* TestOutputTrue for mkdir_p (0) */
4400 r = guestfs_mkdir_p (g, "/new/foo/bar");
4407 r = guestfs_is_dir (g, "/new/foo/bar");
4411 fprintf (stderr, "test_mkdir_p_0: expected true, got false\n");
4418 static int test_mkdir_p_1 (void)
4420 /* InitBasicFS for mkdir_p (1): create ext2 on /dev/sda1 */
4424 r = guestfs_umount_all (g);
4431 r = guestfs_lvm_remove_all (g);
4442 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4449 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4456 r = guestfs_mount (g, "/dev/sda1", "/");
4460 /* TestOutputTrue for mkdir_p (1) */
4464 r = guestfs_mkdir_p (g, "/new/foo/bar");
4471 r = guestfs_is_dir (g, "/new/foo");
4475 fprintf (stderr, "test_mkdir_p_1: expected true, got false\n");
4482 static int test_mkdir_p_2 (void)
4484 /* InitBasicFS for mkdir_p (2): create ext2 on /dev/sda1 */
4488 r = guestfs_umount_all (g);
4495 r = guestfs_lvm_remove_all (g);
4506 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4513 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4520 r = guestfs_mount (g, "/dev/sda1", "/");
4524 /* TestOutputTrue for mkdir_p (2) */
4528 r = guestfs_mkdir_p (g, "/new/foo/bar");
4535 r = guestfs_is_dir (g, "/new");
4539 fprintf (stderr, "test_mkdir_p_2: expected true, got false\n");
4546 static int test_mkdir_0 (void)
4548 /* InitBasicFS for mkdir (0): create ext2 on /dev/sda1 */
4552 r = guestfs_umount_all (g);
4559 r = guestfs_lvm_remove_all (g);
4570 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4577 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4584 r = guestfs_mount (g, "/dev/sda1", "/");
4588 /* TestOutputTrue for mkdir (0) */
4592 r = guestfs_mkdir (g, "/new");
4599 r = guestfs_is_dir (g, "/new");
4603 fprintf (stderr, "test_mkdir_0: expected true, got false\n");
4610 static int test_mkdir_1 (void)
4612 /* InitBasicFS for mkdir (1): create ext2 on /dev/sda1 */
4616 r = guestfs_umount_all (g);
4623 r = guestfs_lvm_remove_all (g);
4634 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4641 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4648 r = guestfs_mount (g, "/dev/sda1", "/");
4652 /* TestLastFail for mkdir (1) */
4656 r = guestfs_mkdir (g, "/new/foo/bar");
4663 static int test_rm_rf_0 (void)
4665 /* InitBasicFS for rm_rf (0): create ext2 on /dev/sda1 */
4669 r = guestfs_umount_all (g);
4676 r = guestfs_lvm_remove_all (g);
4687 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4694 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4701 r = guestfs_mount (g, "/dev/sda1", "/");
4705 /* TestOutputFalse for rm_rf (0) */
4709 r = guestfs_mkdir (g, "/new");
4716 r = guestfs_mkdir (g, "/new/foo");
4723 r = guestfs_touch (g, "/new/foo/bar");
4730 r = guestfs_rm_rf (g, "/new");
4737 r = guestfs_exists (g, "/new");
4741 fprintf (stderr, "test_rm_rf_0: expected false, got true\n");
4748 static int test_rmdir_0 (void)
4750 /* InitBasicFS for rmdir (0): create ext2 on /dev/sda1 */
4754 r = guestfs_umount_all (g);
4761 r = guestfs_lvm_remove_all (g);
4772 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4779 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4786 r = guestfs_mount (g, "/dev/sda1", "/");
4790 /* TestRun for rmdir (0) */
4794 r = guestfs_mkdir (g, "/new");
4801 r = guestfs_rmdir (g, "/new");
4808 static int test_rmdir_1 (void)
4810 /* InitBasicFS for rmdir (1): create ext2 on /dev/sda1 */
4814 r = guestfs_umount_all (g);
4821 r = guestfs_lvm_remove_all (g);
4832 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4839 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4846 r = guestfs_mount (g, "/dev/sda1", "/");
4850 /* TestLastFail for rmdir (1) */
4854 r = guestfs_rmdir (g, "/new");
4861 static int test_rmdir_2 (void)
4863 /* InitBasicFS for rmdir (2): create ext2 on /dev/sda1 */
4867 r = guestfs_umount_all (g);
4874 r = guestfs_lvm_remove_all (g);
4885 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4892 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4899 r = guestfs_mount (g, "/dev/sda1", "/");
4903 /* TestLastFail for rmdir (2) */
4907 r = guestfs_touch (g, "/new");
4914 r = guestfs_rmdir (g, "/new");
4921 static int test_rm_0 (void)
4923 /* InitBasicFS for rm (0): create ext2 on /dev/sda1 */
4927 r = guestfs_umount_all (g);
4934 r = guestfs_lvm_remove_all (g);
4945 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4952 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4959 r = guestfs_mount (g, "/dev/sda1", "/");
4963 /* TestRun for rm (0) */
4967 r = guestfs_touch (g, "/new");
4974 r = guestfs_rm (g, "/new");
4981 static int test_rm_1 (void)
4983 /* InitBasicFS for rm (1): create ext2 on /dev/sda1 */
4987 r = guestfs_umount_all (g);
4994 r = guestfs_lvm_remove_all (g);
5005 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5012 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5019 r = guestfs_mount (g, "/dev/sda1", "/");
5023 /* TestLastFail for rm (1) */
5027 r = guestfs_rm (g, "/new");
5034 static int test_rm_2 (void)
5036 /* InitBasicFS for rm (2): create ext2 on /dev/sda1 */
5040 r = guestfs_umount_all (g);
5047 r = guestfs_lvm_remove_all (g);
5058 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5065 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5072 r = guestfs_mount (g, "/dev/sda1", "/");
5076 /* TestLastFail for rm (2) */
5080 r = guestfs_mkdir (g, "/new");
5087 r = guestfs_rm (g, "/new");
5094 static int test_read_lines_0 (void)
5096 /* InitBasicFS for read_lines (0): create ext2 on /dev/sda1 */
5100 r = guestfs_umount_all (g);
5107 r = guestfs_lvm_remove_all (g);
5118 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5125 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5132 r = guestfs_mount (g, "/dev/sda1", "/");
5136 /* TestOutputList for read_lines (0) */
5140 r = guestfs_write_file (g, "/new", "line1\r\nline2\nline3", 0);
5148 r = guestfs_read_lines (g, "/new");
5152 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
5156 if (strcmp (r[0], "line1") != 0) {
5157 fprintf (stderr, "test_read_lines_0: expected \"line1\" but got \"%s\"\n", r[0]);
5161 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
5165 if (strcmp (r[1], "line2") != 0) {
5166 fprintf (stderr, "test_read_lines_0: expected \"line2\" but got \"%s\"\n", r[1]);
5170 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
5174 if (strcmp (r[2], "line3") != 0) {
5175 fprintf (stderr, "test_read_lines_0: expected \"line3\" but got \"%s\"\n", r[2]);
5179 fprintf (stderr, "test_read_lines_0: extra elements returned from command\n");
5183 for (i = 0; r[i] != NULL; ++i)
5190 static int test_read_lines_1 (void)
5192 /* InitBasicFS for read_lines (1): create ext2 on /dev/sda1 */
5196 r = guestfs_umount_all (g);
5203 r = guestfs_lvm_remove_all (g);
5214 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5221 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5228 r = guestfs_mount (g, "/dev/sda1", "/");
5232 /* TestOutputList for read_lines (1) */
5236 r = guestfs_write_file (g, "/new", "", 0);
5244 r = guestfs_read_lines (g, "/new");
5248 fprintf (stderr, "test_read_lines_1: extra elements returned from command\n");
5252 for (i = 0; r[i] != NULL; ++i)
5259 static int test_lvs_0 (void)
5261 /* InitBasicFSonLVM for lvs (0): create ext2 on /dev/VG/LV */
5265 r = guestfs_umount_all (g);
5272 r = guestfs_lvm_remove_all (g);
5283 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5290 r = guestfs_pvcreate (g, "/dev/sda1");
5295 char *physvols[] = {
5301 r = guestfs_vgcreate (g, "VG", physvols);
5308 r = guestfs_lvcreate (g, "LV", "VG", 8);
5315 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5322 r = guestfs_mount (g, "/dev/VG/LV", "/");
5326 /* TestOutputList for lvs (0) */
5331 r = guestfs_lvs (g);
5335 fprintf (stderr, "test_lvs_0: short list returned from command\n");
5339 if (strcmp (r[0], "/dev/VG/LV") != 0) {
5340 fprintf (stderr, "test_lvs_0: expected \"/dev/VG/LV\" but got \"%s\"\n", r[0]);
5344 fprintf (stderr, "test_lvs_0: extra elements returned from command\n");
5348 for (i = 0; r[i] != NULL; ++i)
5355 static int test_lvs_1 (void)
5357 /* InitEmpty for lvs (1) */
5361 r = guestfs_umount_all (g);
5368 r = guestfs_lvm_remove_all (g);
5372 /* TestOutputList for lvs (1) */
5382 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5389 r = guestfs_pvcreate (g, "/dev/sda1");
5396 r = guestfs_pvcreate (g, "/dev/sda2");
5403 r = guestfs_pvcreate (g, "/dev/sda3");
5408 char *physvols[] = {
5415 r = guestfs_vgcreate (g, "VG1", physvols);
5420 char *physvols[] = {
5426 r = guestfs_vgcreate (g, "VG2", physvols);
5433 r = guestfs_lvcreate (g, "LV1", "VG1", 50);
5440 r = guestfs_lvcreate (g, "LV2", "VG1", 50);
5447 r = guestfs_lvcreate (g, "LV3", "VG2", 50);
5455 r = guestfs_lvs (g);
5459 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5463 if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
5464 fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
5468 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5472 if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
5473 fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
5477 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5481 if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
5482 fprintf (stderr, "test_lvs_1: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
5486 fprintf (stderr, "test_lvs_1: extra elements returned from command\n");
5490 for (i = 0; r[i] != NULL; ++i)
5497 static int test_vgs_0 (void)
5499 /* InitBasicFSonLVM for vgs (0): create ext2 on /dev/VG/LV */
5503 r = guestfs_umount_all (g);
5510 r = guestfs_lvm_remove_all (g);
5521 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5528 r = guestfs_pvcreate (g, "/dev/sda1");
5533 char *physvols[] = {
5539 r = guestfs_vgcreate (g, "VG", physvols);
5546 r = guestfs_lvcreate (g, "LV", "VG", 8);
5553 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5560 r = guestfs_mount (g, "/dev/VG/LV", "/");
5564 /* TestOutputList for vgs (0) */
5569 r = guestfs_vgs (g);
5573 fprintf (stderr, "test_vgs_0: short list returned from command\n");
5577 if (strcmp (r[0], "VG") != 0) {
5578 fprintf (stderr, "test_vgs_0: expected \"VG\" but got \"%s\"\n", r[0]);
5582 fprintf (stderr, "test_vgs_0: extra elements returned from command\n");
5586 for (i = 0; r[i] != NULL; ++i)
5593 static int test_vgs_1 (void)
5595 /* InitEmpty for vgs (1) */
5599 r = guestfs_umount_all (g);
5606 r = guestfs_lvm_remove_all (g);
5610 /* TestOutputList for vgs (1) */
5620 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5627 r = guestfs_pvcreate (g, "/dev/sda1");
5634 r = guestfs_pvcreate (g, "/dev/sda2");
5641 r = guestfs_pvcreate (g, "/dev/sda3");
5646 char *physvols[] = {
5653 r = guestfs_vgcreate (g, "VG1", physvols);
5658 char *physvols[] = {
5664 r = guestfs_vgcreate (g, "VG2", physvols);
5672 r = guestfs_vgs (g);
5676 fprintf (stderr, "test_vgs_1: short list returned from command\n");
5680 if (strcmp (r[0], "VG1") != 0) {
5681 fprintf (stderr, "test_vgs_1: expected \"VG1\" but got \"%s\"\n", r[0]);
5685 fprintf (stderr, "test_vgs_1: short list returned from command\n");
5689 if (strcmp (r[1], "VG2") != 0) {
5690 fprintf (stderr, "test_vgs_1: expected \"VG2\" but got \"%s\"\n", r[1]);
5694 fprintf (stderr, "test_vgs_1: extra elements returned from command\n");
5698 for (i = 0; r[i] != NULL; ++i)
5705 static int test_pvs_0 (void)
5707 /* InitBasicFSonLVM for pvs (0): create ext2 on /dev/VG/LV */
5711 r = guestfs_umount_all (g);
5718 r = guestfs_lvm_remove_all (g);
5729 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5736 r = guestfs_pvcreate (g, "/dev/sda1");
5741 char *physvols[] = {
5747 r = guestfs_vgcreate (g, "VG", physvols);
5754 r = guestfs_lvcreate (g, "LV", "VG", 8);
5761 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5768 r = guestfs_mount (g, "/dev/VG/LV", "/");
5772 /* TestOutputList for pvs (0) */
5777 r = guestfs_pvs (g);
5781 fprintf (stderr, "test_pvs_0: short list returned from command\n");
5785 if (strcmp (r[0], "/dev/sda1") != 0) {
5786 fprintf (stderr, "test_pvs_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5790 fprintf (stderr, "test_pvs_0: extra elements returned from command\n");
5794 for (i = 0; r[i] != NULL; ++i)
5801 static int test_pvs_1 (void)
5803 /* InitEmpty for pvs (1) */
5807 r = guestfs_umount_all (g);
5814 r = guestfs_lvm_remove_all (g);
5818 /* TestOutputList for pvs (1) */
5828 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5835 r = guestfs_pvcreate (g, "/dev/sda1");
5842 r = guestfs_pvcreate (g, "/dev/sda2");
5849 r = guestfs_pvcreate (g, "/dev/sda3");
5857 r = guestfs_pvs (g);
5861 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5865 if (strcmp (r[0], "/dev/sda1") != 0) {
5866 fprintf (stderr, "test_pvs_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5870 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5874 if (strcmp (r[1], "/dev/sda2") != 0) {
5875 fprintf (stderr, "test_pvs_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
5879 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5883 if (strcmp (r[2], "/dev/sda3") != 0) {
5884 fprintf (stderr, "test_pvs_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
5888 fprintf (stderr, "test_pvs_1: extra elements returned from command\n");
5892 for (i = 0; r[i] != NULL; ++i)
5899 static int test_list_partitions_0 (void)
5901 /* InitBasicFS for list_partitions (0): create ext2 on /dev/sda1 */
5905 r = guestfs_umount_all (g);
5912 r = guestfs_lvm_remove_all (g);
5923 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5930 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5937 r = guestfs_mount (g, "/dev/sda1", "/");
5941 /* TestOutputList for list_partitions (0) */
5946 r = guestfs_list_partitions (g);
5950 fprintf (stderr, "test_list_partitions_0: short list returned from command\n");
5954 if (strcmp (r[0], "/dev/sda1") != 0) {
5955 fprintf (stderr, "test_list_partitions_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5959 fprintf (stderr, "test_list_partitions_0: extra elements returned from command\n");
5963 for (i = 0; r[i] != NULL; ++i)
5970 static int test_list_partitions_1 (void)
5972 /* InitEmpty for list_partitions (1) */
5976 r = guestfs_umount_all (g);
5983 r = guestfs_lvm_remove_all (g);
5987 /* TestOutputList for list_partitions (1) */
5997 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6005 r = guestfs_list_partitions (g);
6009 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
6013 if (strcmp (r[0], "/dev/sda1") != 0) {
6014 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
6018 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
6022 if (strcmp (r[1], "/dev/sda2") != 0) {
6023 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
6027 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
6031 if (strcmp (r[2], "/dev/sda3") != 0) {
6032 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
6036 fprintf (stderr, "test_list_partitions_1: extra elements returned from command\n");
6040 for (i = 0; r[i] != NULL; ++i)
6047 static int test_list_devices_0 (void)
6049 /* InitEmpty for list_devices (0) */
6053 r = guestfs_umount_all (g);
6060 r = guestfs_lvm_remove_all (g);
6064 /* TestOutputList for list_devices (0) */
6069 r = guestfs_list_devices (g);
6073 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
6077 if (strcmp (r[0], "/dev/sda") != 0) {
6078 fprintf (stderr, "test_list_devices_0: expected \"/dev/sda\" but got \"%s\"\n", r[0]);
6082 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
6086 if (strcmp (r[1], "/dev/sdb") != 0) {
6087 fprintf (stderr, "test_list_devices_0: expected \"/dev/sdb\" but got \"%s\"\n", r[1]);
6091 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
6095 if (strcmp (r[2], "/dev/sdc") != 0) {
6096 fprintf (stderr, "test_list_devices_0: expected \"/dev/sdc\" but got \"%s\"\n", r[2]);
6100 fprintf (stderr, "test_list_devices_0: extra elements returned from command\n");
6104 for (i = 0; r[i] != NULL; ++i)
6111 static int test_ls_0 (void)
6113 /* InitBasicFS for ls (0): create ext2 on /dev/sda1 */
6117 r = guestfs_umount_all (g);
6124 r = guestfs_lvm_remove_all (g);
6135 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6142 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6149 r = guestfs_mount (g, "/dev/sda1", "/");
6153 /* TestOutputList for ls (0) */
6157 r = guestfs_touch (g, "/new");
6164 r = guestfs_touch (g, "/newer");
6171 r = guestfs_touch (g, "/newest");
6179 r = guestfs_ls (g, "/");
6183 fprintf (stderr, "test_ls_0: short list returned from command\n");
6187 if (strcmp (r[0], "lost+found") != 0) {
6188 fprintf (stderr, "test_ls_0: expected \"lost+found\" but got \"%s\"\n", r[0]);
6192 fprintf (stderr, "test_ls_0: short list returned from command\n");
6196 if (strcmp (r[1], "new") != 0) {
6197 fprintf (stderr, "test_ls_0: expected \"new\" but got \"%s\"\n", r[1]);
6201 fprintf (stderr, "test_ls_0: short list returned from command\n");
6205 if (strcmp (r[2], "newer") != 0) {
6206 fprintf (stderr, "test_ls_0: expected \"newer\" but got \"%s\"\n", r[2]);
6210 fprintf (stderr, "test_ls_0: short list returned from command\n");
6214 if (strcmp (r[3], "newest") != 0) {
6215 fprintf (stderr, "test_ls_0: expected \"newest\" but got \"%s\"\n", r[3]);
6219 fprintf (stderr, "test_ls_0: extra elements returned from command\n");
6223 for (i = 0; r[i] != NULL; ++i)
6230 static int test_cat_0 (void)
6232 /* InitBasicFS for cat (0): create ext2 on /dev/sda1 */
6236 r = guestfs_umount_all (g);
6243 r = guestfs_lvm_remove_all (g);
6254 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6261 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6268 r = guestfs_mount (g, "/dev/sda1", "/");
6272 /* TestOutput for cat (0) */
6276 r = guestfs_write_file (g, "/new", "new file contents", 0);
6283 r = guestfs_cat (g, "/new");
6286 if (strcmp (r, "new file contents") != 0) {
6287 fprintf (stderr, "test_cat_0: expected \"new file contents\" but got \"%s\"\n", r);
6295 static int test_touch_0 (void)
6297 /* InitBasicFS for touch (0): create ext2 on /dev/sda1 */
6301 r = guestfs_umount_all (g);
6308 r = guestfs_lvm_remove_all (g);
6319 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6326 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6333 r = guestfs_mount (g, "/dev/sda1", "/");
6337 /* TestOutputTrue for touch (0) */
6341 r = guestfs_touch (g, "/new");
6348 r = guestfs_exists (g, "/new");
6352 fprintf (stderr, "test_touch_0: expected true, got false\n");
6359 static int test_sync_0 (void)
6361 /* InitEmpty for sync (0) */
6365 r = guestfs_umount_all (g);
6372 r = guestfs_lvm_remove_all (g);
6376 /* TestRun for sync (0) */
6380 r = guestfs_sync (g);
6387 static int test_mount_0 (void)
6389 /* InitEmpty for mount (0) */
6393 r = guestfs_umount_all (g);
6400 r = guestfs_lvm_remove_all (g);
6404 /* TestOutput for mount (0) */
6412 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6419 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6426 r = guestfs_mount (g, "/dev/sda1", "/");
6433 r = guestfs_write_file (g, "/new", "new file contents", 0);
6440 r = guestfs_cat (g, "/new");
6443 if (strcmp (r, "new file contents") != 0) {
6444 fprintf (stderr, "test_mount_0: expected \"new file contents\" but got \"%s\"\n", r);
6452 int main (int argc, char *argv[])
6457 const char *filename;
6459 int nr_tests, test_num = 0;
6461 no_test_warnings ();
6463 g = guestfs_create ();
6465 printf ("guestfs_create FAILED\n");
6469 guestfs_set_error_handler (g, print_error, NULL);
6471 srcdir = getenv ("srcdir");
6472 if (!srcdir) srcdir = ".";
6474 guestfs_set_path (g, ".");
6476 filename = "test1.img";
6477 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6482 if (lseek (fd, 524288000, SEEK_SET) == -1) {
6488 if (write (fd, &c, 1) == -1) {
6494 if (close (fd) == -1) {
6499 if (guestfs_add_drive (g, filename) == -1) {
6500 printf ("guestfs_add_drive %s FAILED\n", filename);
6504 filename = "test2.img";
6505 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6510 if (lseek (fd, 52428800, SEEK_SET) == -1) {
6516 if (write (fd, &c, 1) == -1) {
6522 if (close (fd) == -1) {
6527 if (guestfs_add_drive (g, filename) == -1) {
6528 printf ("guestfs_add_drive %s FAILED\n", filename);
6532 filename = "test3.img";
6533 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6538 if (lseek (fd, 10485760, SEEK_SET) == -1) {
6544 if (write (fd, &c, 1) == -1) {
6550 if (close (fd) == -1) {
6555 if (guestfs_add_drive (g, filename) == -1) {
6556 printf ("guestfs_add_drive %s FAILED\n", filename);
6560 if (guestfs_launch (g) == -1) {
6561 printf ("guestfs_launch FAILED\n");
6564 if (guestfs_wait_ready (g) == -1) {
6565 printf ("guestfs_wait_ready FAILED\n");
6572 printf ("%3d/%3d test_fsck_0\n", test_num, nr_tests);
6573 if (test_fsck_0 () == -1) {
6574 printf ("test_fsck_0 FAILED\n");
6578 printf ("%3d/%3d test_set_e2uuid_0\n", test_num, nr_tests);
6579 if (test_set_e2uuid_0 () == -1) {
6580 printf ("test_set_e2uuid_0 FAILED\n");
6584 printf ("%3d/%3d test_set_e2uuid_1\n", test_num, nr_tests);
6585 if (test_set_e2uuid_1 () == -1) {
6586 printf ("test_set_e2uuid_1 FAILED\n");
6590 printf ("%3d/%3d test_set_e2uuid_2\n", test_num, nr_tests);
6591 if (test_set_e2uuid_2 () == -1) {
6592 printf ("test_set_e2uuid_2 FAILED\n");
6596 printf ("%3d/%3d test_set_e2uuid_3\n", test_num, nr_tests);
6597 if (test_set_e2uuid_3 () == -1) {
6598 printf ("test_set_e2uuid_3 FAILED\n");
6602 printf ("%3d/%3d test_set_e2label_0\n", test_num, nr_tests);
6603 if (test_set_e2label_0 () == -1) {
6604 printf ("test_set_e2label_0 FAILED\n");
6608 printf ("%3d/%3d test_pvremove_0\n", test_num, nr_tests);
6609 if (test_pvremove_0 () == -1) {
6610 printf ("test_pvremove_0 FAILED\n");
6614 printf ("%3d/%3d test_pvremove_1\n", test_num, nr_tests);
6615 if (test_pvremove_1 () == -1) {
6616 printf ("test_pvremove_1 FAILED\n");
6620 printf ("%3d/%3d test_pvremove_2\n", test_num, nr_tests);
6621 if (test_pvremove_2 () == -1) {
6622 printf ("test_pvremove_2 FAILED\n");
6626 printf ("%3d/%3d test_vgremove_0\n", test_num, nr_tests);
6627 if (test_vgremove_0 () == -1) {
6628 printf ("test_vgremove_0 FAILED\n");
6632 printf ("%3d/%3d test_vgremove_1\n", test_num, nr_tests);
6633 if (test_vgremove_1 () == -1) {
6634 printf ("test_vgremove_1 FAILED\n");
6638 printf ("%3d/%3d test_lvremove_0\n", test_num, nr_tests);
6639 if (test_lvremove_0 () == -1) {
6640 printf ("test_lvremove_0 FAILED\n");
6644 printf ("%3d/%3d test_lvremove_1\n", test_num, nr_tests);
6645 if (test_lvremove_1 () == -1) {
6646 printf ("test_lvremove_1 FAILED\n");
6650 printf ("%3d/%3d test_lvremove_2\n", test_num, nr_tests);
6651 if (test_lvremove_2 () == -1) {
6652 printf ("test_lvremove_2 FAILED\n");
6656 printf ("%3d/%3d test_mount_ro_0\n", test_num, nr_tests);
6657 if (test_mount_ro_0 () == -1) {
6658 printf ("test_mount_ro_0 FAILED\n");
6662 printf ("%3d/%3d test_mount_ro_1\n", test_num, nr_tests);
6663 if (test_mount_ro_1 () == -1) {
6664 printf ("test_mount_ro_1 FAILED\n");
6668 printf ("%3d/%3d test_tgz_in_0\n", test_num, nr_tests);
6669 if (test_tgz_in_0 () == -1) {
6670 printf ("test_tgz_in_0 FAILED\n");
6674 printf ("%3d/%3d test_tar_in_0\n", test_num, nr_tests);
6675 if (test_tar_in_0 () == -1) {
6676 printf ("test_tar_in_0 FAILED\n");
6680 printf ("%3d/%3d test_checksum_0\n", test_num, nr_tests);
6681 if (test_checksum_0 () == -1) {
6682 printf ("test_checksum_0 FAILED\n");
6686 printf ("%3d/%3d test_checksum_1\n", test_num, nr_tests);
6687 if (test_checksum_1 () == -1) {
6688 printf ("test_checksum_1 FAILED\n");
6692 printf ("%3d/%3d test_checksum_2\n", test_num, nr_tests);
6693 if (test_checksum_2 () == -1) {
6694 printf ("test_checksum_2 FAILED\n");
6698 printf ("%3d/%3d test_checksum_3\n", test_num, nr_tests);
6699 if (test_checksum_3 () == -1) {
6700 printf ("test_checksum_3 FAILED\n");
6704 printf ("%3d/%3d test_checksum_4\n", test_num, nr_tests);
6705 if (test_checksum_4 () == -1) {
6706 printf ("test_checksum_4 FAILED\n");
6710 printf ("%3d/%3d test_checksum_5\n", test_num, nr_tests);
6711 if (test_checksum_5 () == -1) {
6712 printf ("test_checksum_5 FAILED\n");
6716 printf ("%3d/%3d test_checksum_6\n", test_num, nr_tests);
6717 if (test_checksum_6 () == -1) {
6718 printf ("test_checksum_6 FAILED\n");
6722 printf ("%3d/%3d test_checksum_7\n", test_num, nr_tests);
6723 if (test_checksum_7 () == -1) {
6724 printf ("test_checksum_7 FAILED\n");
6728 printf ("%3d/%3d test_download_0\n", test_num, nr_tests);
6729 if (test_download_0 () == -1) {
6730 printf ("test_download_0 FAILED\n");
6734 printf ("%3d/%3d test_upload_0\n", test_num, nr_tests);
6735 if (test_upload_0 () == -1) {
6736 printf ("test_upload_0 FAILED\n");
6740 printf ("%3d/%3d test_blockdev_rereadpt_0\n", test_num, nr_tests);
6741 if (test_blockdev_rereadpt_0 () == -1) {
6742 printf ("test_blockdev_rereadpt_0 FAILED\n");
6746 printf ("%3d/%3d test_blockdev_flushbufs_0\n", test_num, nr_tests);
6747 if (test_blockdev_flushbufs_0 () == -1) {
6748 printf ("test_blockdev_flushbufs_0 FAILED\n");
6752 printf ("%3d/%3d test_blockdev_getsize64_0\n", test_num, nr_tests);
6753 if (test_blockdev_getsize64_0 () == -1) {
6754 printf ("test_blockdev_getsize64_0 FAILED\n");
6758 printf ("%3d/%3d test_blockdev_getsz_0\n", test_num, nr_tests);
6759 if (test_blockdev_getsz_0 () == -1) {
6760 printf ("test_blockdev_getsz_0 FAILED\n");
6764 printf ("%3d/%3d test_blockdev_getbsz_0\n", test_num, nr_tests);
6765 if (test_blockdev_getbsz_0 () == -1) {
6766 printf ("test_blockdev_getbsz_0 FAILED\n");
6770 printf ("%3d/%3d test_blockdev_getss_0\n", test_num, nr_tests);
6771 if (test_blockdev_getss_0 () == -1) {
6772 printf ("test_blockdev_getss_0 FAILED\n");
6776 printf ("%3d/%3d test_blockdev_getro_0\n", test_num, nr_tests);
6777 if (test_blockdev_getro_0 () == -1) {
6778 printf ("test_blockdev_getro_0 FAILED\n");
6782 printf ("%3d/%3d test_blockdev_setrw_0\n", test_num, nr_tests);
6783 if (test_blockdev_setrw_0 () == -1) {
6784 printf ("test_blockdev_setrw_0 FAILED\n");
6788 printf ("%3d/%3d test_blockdev_setro_0\n", test_num, nr_tests);
6789 if (test_blockdev_setro_0 () == -1) {
6790 printf ("test_blockdev_setro_0 FAILED\n");
6794 printf ("%3d/%3d test_statvfs_0\n", test_num, nr_tests);
6795 if (test_statvfs_0 () == -1) {
6796 printf ("test_statvfs_0 FAILED\n");
6800 printf ("%3d/%3d test_lstat_0\n", test_num, nr_tests);
6801 if (test_lstat_0 () == -1) {
6802 printf ("test_lstat_0 FAILED\n");
6806 printf ("%3d/%3d test_stat_0\n", test_num, nr_tests);
6807 if (test_stat_0 () == -1) {
6808 printf ("test_stat_0 FAILED\n");
6812 printf ("%3d/%3d test_file_0\n", test_num, nr_tests);
6813 if (test_file_0 () == -1) {
6814 printf ("test_file_0 FAILED\n");
6818 printf ("%3d/%3d test_file_1\n", test_num, nr_tests);
6819 if (test_file_1 () == -1) {
6820 printf ("test_file_1 FAILED\n");
6824 printf ("%3d/%3d test_file_2\n", test_num, nr_tests);
6825 if (test_file_2 () == -1) {
6826 printf ("test_file_2 FAILED\n");
6830 printf ("%3d/%3d test_umount_all_0\n", test_num, nr_tests);
6831 if (test_umount_all_0 () == -1) {
6832 printf ("test_umount_all_0 FAILED\n");
6836 printf ("%3d/%3d test_umount_all_1\n", test_num, nr_tests);
6837 if (test_umount_all_1 () == -1) {
6838 printf ("test_umount_all_1 FAILED\n");
6842 printf ("%3d/%3d test_mounts_0\n", test_num, nr_tests);
6843 if (test_mounts_0 () == -1) {
6844 printf ("test_mounts_0 FAILED\n");
6848 printf ("%3d/%3d test_umount_0\n", test_num, nr_tests);
6849 if (test_umount_0 () == -1) {
6850 printf ("test_umount_0 FAILED\n");
6854 printf ("%3d/%3d test_umount_1\n", test_num, nr_tests);
6855 if (test_umount_1 () == -1) {
6856 printf ("test_umount_1 FAILED\n");
6860 printf ("%3d/%3d test_write_file_0\n", test_num, nr_tests);
6861 if (test_write_file_0 () == -1) {
6862 printf ("test_write_file_0 FAILED\n");
6866 printf ("%3d/%3d test_write_file_1\n", test_num, nr_tests);
6867 if (test_write_file_1 () == -1) {
6868 printf ("test_write_file_1 FAILED\n");
6872 printf ("%3d/%3d test_write_file_2\n", test_num, nr_tests);
6873 if (test_write_file_2 () == -1) {
6874 printf ("test_write_file_2 FAILED\n");
6878 printf ("%3d/%3d test_write_file_3\n", test_num, nr_tests);
6879 if (test_write_file_3 () == -1) {
6880 printf ("test_write_file_3 FAILED\n");
6884 printf ("%3d/%3d test_write_file_4\n", test_num, nr_tests);
6885 if (test_write_file_4 () == -1) {
6886 printf ("test_write_file_4 FAILED\n");
6890 printf ("%3d/%3d test_write_file_5\n", test_num, nr_tests);
6891 if (test_write_file_5 () == -1) {
6892 printf ("test_write_file_5 FAILED\n");
6896 printf ("%3d/%3d test_mkfs_0\n", test_num, nr_tests);
6897 if (test_mkfs_0 () == -1) {
6898 printf ("test_mkfs_0 FAILED\n");
6902 printf ("%3d/%3d test_lvcreate_0\n", test_num, nr_tests);
6903 if (test_lvcreate_0 () == -1) {
6904 printf ("test_lvcreate_0 FAILED\n");
6908 printf ("%3d/%3d test_vgcreate_0\n", test_num, nr_tests);
6909 if (test_vgcreate_0 () == -1) {
6910 printf ("test_vgcreate_0 FAILED\n");
6914 printf ("%3d/%3d test_pvcreate_0\n", test_num, nr_tests);
6915 if (test_pvcreate_0 () == -1) {
6916 printf ("test_pvcreate_0 FAILED\n");
6920 printf ("%3d/%3d test_is_dir_0\n", test_num, nr_tests);
6921 if (test_is_dir_0 () == -1) {
6922 printf ("test_is_dir_0 FAILED\n");
6926 printf ("%3d/%3d test_is_dir_1\n", test_num, nr_tests);
6927 if (test_is_dir_1 () == -1) {
6928 printf ("test_is_dir_1 FAILED\n");
6932 printf ("%3d/%3d test_is_file_0\n", test_num, nr_tests);
6933 if (test_is_file_0 () == -1) {
6934 printf ("test_is_file_0 FAILED\n");
6938 printf ("%3d/%3d test_is_file_1\n", test_num, nr_tests);
6939 if (test_is_file_1 () == -1) {
6940 printf ("test_is_file_1 FAILED\n");
6944 printf ("%3d/%3d test_exists_0\n", test_num, nr_tests);
6945 if (test_exists_0 () == -1) {
6946 printf ("test_exists_0 FAILED\n");
6950 printf ("%3d/%3d test_exists_1\n", test_num, nr_tests);
6951 if (test_exists_1 () == -1) {
6952 printf ("test_exists_1 FAILED\n");
6956 printf ("%3d/%3d test_mkdir_p_0\n", test_num, nr_tests);
6957 if (test_mkdir_p_0 () == -1) {
6958 printf ("test_mkdir_p_0 FAILED\n");
6962 printf ("%3d/%3d test_mkdir_p_1\n", test_num, nr_tests);
6963 if (test_mkdir_p_1 () == -1) {
6964 printf ("test_mkdir_p_1 FAILED\n");
6968 printf ("%3d/%3d test_mkdir_p_2\n", test_num, nr_tests);
6969 if (test_mkdir_p_2 () == -1) {
6970 printf ("test_mkdir_p_2 FAILED\n");
6974 printf ("%3d/%3d test_mkdir_0\n", test_num, nr_tests);
6975 if (test_mkdir_0 () == -1) {
6976 printf ("test_mkdir_0 FAILED\n");
6980 printf ("%3d/%3d test_mkdir_1\n", test_num, nr_tests);
6981 if (test_mkdir_1 () == -1) {
6982 printf ("test_mkdir_1 FAILED\n");
6986 printf ("%3d/%3d test_rm_rf_0\n", test_num, nr_tests);
6987 if (test_rm_rf_0 () == -1) {
6988 printf ("test_rm_rf_0 FAILED\n");
6992 printf ("%3d/%3d test_rmdir_0\n", test_num, nr_tests);
6993 if (test_rmdir_0 () == -1) {
6994 printf ("test_rmdir_0 FAILED\n");
6998 printf ("%3d/%3d test_rmdir_1\n", test_num, nr_tests);
6999 if (test_rmdir_1 () == -1) {
7000 printf ("test_rmdir_1 FAILED\n");
7004 printf ("%3d/%3d test_rmdir_2\n", test_num, nr_tests);
7005 if (test_rmdir_2 () == -1) {
7006 printf ("test_rmdir_2 FAILED\n");
7010 printf ("%3d/%3d test_rm_0\n", test_num, nr_tests);
7011 if (test_rm_0 () == -1) {
7012 printf ("test_rm_0 FAILED\n");
7016 printf ("%3d/%3d test_rm_1\n", test_num, nr_tests);
7017 if (test_rm_1 () == -1) {
7018 printf ("test_rm_1 FAILED\n");
7022 printf ("%3d/%3d test_rm_2\n", test_num, nr_tests);
7023 if (test_rm_2 () == -1) {
7024 printf ("test_rm_2 FAILED\n");
7028 printf ("%3d/%3d test_read_lines_0\n", test_num, nr_tests);
7029 if (test_read_lines_0 () == -1) {
7030 printf ("test_read_lines_0 FAILED\n");
7034 printf ("%3d/%3d test_read_lines_1\n", test_num, nr_tests);
7035 if (test_read_lines_1 () == -1) {
7036 printf ("test_read_lines_1 FAILED\n");
7040 printf ("%3d/%3d test_lvs_0\n", test_num, nr_tests);
7041 if (test_lvs_0 () == -1) {
7042 printf ("test_lvs_0 FAILED\n");
7046 printf ("%3d/%3d test_lvs_1\n", test_num, nr_tests);
7047 if (test_lvs_1 () == -1) {
7048 printf ("test_lvs_1 FAILED\n");
7052 printf ("%3d/%3d test_vgs_0\n", test_num, nr_tests);
7053 if (test_vgs_0 () == -1) {
7054 printf ("test_vgs_0 FAILED\n");
7058 printf ("%3d/%3d test_vgs_1\n", test_num, nr_tests);
7059 if (test_vgs_1 () == -1) {
7060 printf ("test_vgs_1 FAILED\n");
7064 printf ("%3d/%3d test_pvs_0\n", test_num, nr_tests);
7065 if (test_pvs_0 () == -1) {
7066 printf ("test_pvs_0 FAILED\n");
7070 printf ("%3d/%3d test_pvs_1\n", test_num, nr_tests);
7071 if (test_pvs_1 () == -1) {
7072 printf ("test_pvs_1 FAILED\n");
7076 printf ("%3d/%3d test_list_partitions_0\n", test_num, nr_tests);
7077 if (test_list_partitions_0 () == -1) {
7078 printf ("test_list_partitions_0 FAILED\n");
7082 printf ("%3d/%3d test_list_partitions_1\n", test_num, nr_tests);
7083 if (test_list_partitions_1 () == -1) {
7084 printf ("test_list_partitions_1 FAILED\n");
7088 printf ("%3d/%3d test_list_devices_0\n", test_num, nr_tests);
7089 if (test_list_devices_0 () == -1) {
7090 printf ("test_list_devices_0 FAILED\n");
7094 printf ("%3d/%3d test_ls_0\n", test_num, nr_tests);
7095 if (test_ls_0 () == -1) {
7096 printf ("test_ls_0 FAILED\n");
7100 printf ("%3d/%3d test_cat_0\n", test_num, nr_tests);
7101 if (test_cat_0 () == -1) {
7102 printf ("test_cat_0 FAILED\n");
7106 printf ("%3d/%3d test_touch_0\n", test_num, nr_tests);
7107 if (test_touch_0 () == -1) {
7108 printf ("test_touch_0 FAILED\n");
7112 printf ("%3d/%3d test_sync_0\n", test_num, nr_tests);
7113 if (test_sync_0 () == -1) {
7114 printf ("test_sync_0 FAILED\n");
7118 printf ("%3d/%3d test_mount_0\n", test_num, nr_tests);
7119 if (test_mount_0 () == -1) {
7120 printf ("test_mount_0 FAILED\n");
7125 unlink ("test1.img");
7126 unlink ("test2.img");
7127 unlink ("test3.img");
7130 printf ("***** %d / %d tests FAILED *****\n", failed, nr_tests);