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_set_e2uuid_0 (void)
117 /* InitBasicFS for set_e2uuid (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 /* TestOutput for set_e2uuid (0) */
161 r = guestfs_set_e2uuid (g, "/dev/sda1", "a3a61220-882b-4f61-89f4-cf24dcc7297d");
168 r = guestfs_get_e2uuid (g, "/dev/sda1");
171 if (strcmp (r, "a3a61220-882b-4f61-89f4-cf24dcc7297d") != 0) {
172 fprintf (stderr, "test_set_e2uuid_0: expected \"a3a61220-882b-4f61-89f4-cf24dcc7297d\" but got \"%s\"\n", r);
180 static int test_set_e2uuid_1 (void)
182 /* InitBasicFS for set_e2uuid (1): create ext2 on /dev/sda1 */
186 r = guestfs_umount_all (g);
193 r = guestfs_lvm_remove_all (g);
204 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
211 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
218 r = guestfs_mount (g, "/dev/sda1", "/");
222 /* TestOutput for set_e2uuid (1) */
226 r = guestfs_set_e2uuid (g, "/dev/sda1", "clear");
233 r = guestfs_get_e2uuid (g, "/dev/sda1");
236 if (strcmp (r, "") != 0) {
237 fprintf (stderr, "test_set_e2uuid_1: expected \"\" but got \"%s\"\n", r);
245 static int test_set_e2uuid_2 (void)
247 /* InitBasicFS for set_e2uuid (2): create ext2 on /dev/sda1 */
251 r = guestfs_umount_all (g);
258 r = guestfs_lvm_remove_all (g);
269 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
276 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
283 r = guestfs_mount (g, "/dev/sda1", "/");
287 /* TestRun for set_e2uuid (2) */
291 r = guestfs_set_e2uuid (g, "/dev/sda1", "random");
298 static int test_set_e2uuid_3 (void)
300 /* InitBasicFS for set_e2uuid (3): 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 (3) */
344 r = guestfs_set_e2uuid (g, "/dev/sda1", "time");
351 static int test_set_e2label_0 (void)
353 /* InitBasicFS for set_e2label (0): 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 /* TestOutput for set_e2label (0) */
397 r = guestfs_set_e2label (g, "/dev/sda1", "testlabel");
404 r = guestfs_get_e2label (g, "/dev/sda1");
407 if (strcmp (r, "testlabel") != 0) {
408 fprintf (stderr, "test_set_e2label_0: expected \"testlabel\" but got \"%s\"\n", r);
416 static int test_pvremove_0 (void)
418 /* InitEmpty for pvremove (0) */
422 r = guestfs_umount_all (g);
429 r = guestfs_lvm_remove_all (g);
433 /* TestOutputList for pvremove (0) */
437 r = guestfs_pvcreate (g, "/dev/sda");
448 r = guestfs_vgcreate (g, "VG", physvols);
455 r = guestfs_lvcreate (g, "LV1", "VG", 50);
462 r = guestfs_lvcreate (g, "LV2", "VG", 50);
469 r = guestfs_vgremove (g, "VG");
476 r = guestfs_pvremove (g, "/dev/sda");
488 fprintf (stderr, "test_pvremove_0: extra elements returned from command\n");
492 for (i = 0; r[i] != NULL; ++i)
499 static int test_pvremove_1 (void)
501 /* InitEmpty for pvremove (1) */
505 r = guestfs_umount_all (g);
512 r = guestfs_lvm_remove_all (g);
516 /* TestOutputList for pvremove (1) */
520 r = guestfs_pvcreate (g, "/dev/sda");
531 r = guestfs_vgcreate (g, "VG", physvols);
538 r = guestfs_lvcreate (g, "LV1", "VG", 50);
545 r = guestfs_lvcreate (g, "LV2", "VG", 50);
552 r = guestfs_vgremove (g, "VG");
559 r = guestfs_pvremove (g, "/dev/sda");
571 fprintf (stderr, "test_pvremove_1: extra elements returned from command\n");
575 for (i = 0; r[i] != NULL; ++i)
582 static int test_pvremove_2 (void)
584 /* InitEmpty for pvremove (2) */
588 r = guestfs_umount_all (g);
595 r = guestfs_lvm_remove_all (g);
599 /* TestOutputList for pvremove (2) */
603 r = guestfs_pvcreate (g, "/dev/sda");
614 r = guestfs_vgcreate (g, "VG", physvols);
621 r = guestfs_lvcreate (g, "LV1", "VG", 50);
628 r = guestfs_lvcreate (g, "LV2", "VG", 50);
635 r = guestfs_vgremove (g, "VG");
642 r = guestfs_pvremove (g, "/dev/sda");
654 fprintf (stderr, "test_pvremove_2: extra elements returned from command\n");
658 for (i = 0; r[i] != NULL; ++i)
665 static int test_vgremove_0 (void)
667 /* InitEmpty for vgremove (0) */
671 r = guestfs_umount_all (g);
678 r = guestfs_lvm_remove_all (g);
682 /* TestOutputList for vgremove (0) */
686 r = guestfs_pvcreate (g, "/dev/sda");
697 r = guestfs_vgcreate (g, "VG", physvols);
704 r = guestfs_lvcreate (g, "LV1", "VG", 50);
711 r = guestfs_lvcreate (g, "LV2", "VG", 50);
718 r = guestfs_vgremove (g, "VG");
730 fprintf (stderr, "test_vgremove_0: extra elements returned from command\n");
734 for (i = 0; r[i] != NULL; ++i)
741 static int test_vgremove_1 (void)
743 /* InitEmpty for vgremove (1) */
747 r = guestfs_umount_all (g);
754 r = guestfs_lvm_remove_all (g);
758 /* TestOutputList for vgremove (1) */
762 r = guestfs_pvcreate (g, "/dev/sda");
773 r = guestfs_vgcreate (g, "VG", physvols);
780 r = guestfs_lvcreate (g, "LV1", "VG", 50);
787 r = guestfs_lvcreate (g, "LV2", "VG", 50);
794 r = guestfs_vgremove (g, "VG");
806 fprintf (stderr, "test_vgremove_1: extra elements returned from command\n");
810 for (i = 0; r[i] != NULL; ++i)
817 static int test_lvremove_0 (void)
819 /* InitEmpty for lvremove (0) */
823 r = guestfs_umount_all (g);
830 r = guestfs_lvm_remove_all (g);
834 /* TestOutputList for lvremove (0) */
838 r = guestfs_pvcreate (g, "/dev/sda");
849 r = guestfs_vgcreate (g, "VG", physvols);
856 r = guestfs_lvcreate (g, "LV1", "VG", 50);
863 r = guestfs_lvcreate (g, "LV2", "VG", 50);
870 r = guestfs_lvremove (g, "/dev/VG/LV1");
882 fprintf (stderr, "test_lvremove_0: short list returned from command\n");
886 if (strcmp (r[0], "/dev/VG/LV2") != 0) {
887 fprintf (stderr, "test_lvremove_0: expected \"/dev/VG/LV2\" but got \"%s\"\n", r[0]);
891 fprintf (stderr, "test_lvremove_0: extra elements returned from command\n");
895 for (i = 0; r[i] != NULL; ++i)
902 static int test_lvremove_1 (void)
904 /* InitEmpty for lvremove (1) */
908 r = guestfs_umount_all (g);
915 r = guestfs_lvm_remove_all (g);
919 /* TestOutputList for lvremove (1) */
923 r = guestfs_pvcreate (g, "/dev/sda");
934 r = guestfs_vgcreate (g, "VG", physvols);
941 r = guestfs_lvcreate (g, "LV1", "VG", 50);
948 r = guestfs_lvcreate (g, "LV2", "VG", 50);
955 r = guestfs_lvremove (g, "/dev/VG");
967 fprintf (stderr, "test_lvremove_1: extra elements returned from command\n");
971 for (i = 0; r[i] != NULL; ++i)
978 static int test_lvremove_2 (void)
980 /* InitEmpty for lvremove (2) */
984 r = guestfs_umount_all (g);
991 r = guestfs_lvm_remove_all (g);
995 /* TestOutputList for lvremove (2) */
999 r = guestfs_pvcreate (g, "/dev/sda");
1004 char *physvols[] = {
1010 r = guestfs_vgcreate (g, "VG", physvols);
1017 r = guestfs_lvcreate (g, "LV1", "VG", 50);
1024 r = guestfs_lvcreate (g, "LV2", "VG", 50);
1031 r = guestfs_lvremove (g, "/dev/VG");
1039 r = guestfs_vgs (g);
1043 fprintf (stderr, "test_lvremove_2: short list returned from command\n");
1047 if (strcmp (r[0], "VG") != 0) {
1048 fprintf (stderr, "test_lvremove_2: expected \"VG\" but got \"%s\"\n", r[0]);
1052 fprintf (stderr, "test_lvremove_2: extra elements returned from command\n");
1056 for (i = 0; r[i] != NULL; ++i)
1063 static int test_mount_ro_0 (void)
1065 /* InitBasicFS for mount_ro (0): create ext2 on /dev/sda1 */
1069 r = guestfs_umount_all (g);
1076 r = guestfs_lvm_remove_all (g);
1087 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1094 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1101 r = guestfs_mount (g, "/dev/sda1", "/");
1105 /* TestLastFail for mount_ro (0) */
1109 r = guestfs_umount (g, "/");
1116 r = guestfs_mount_ro (g, "/dev/sda1", "/");
1123 r = guestfs_touch (g, "/new");
1130 static int test_mount_ro_1 (void)
1132 /* InitBasicFS for mount_ro (1): create ext2 on /dev/sda1 */
1136 r = guestfs_umount_all (g);
1143 r = guestfs_lvm_remove_all (g);
1154 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1161 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1168 r = guestfs_mount (g, "/dev/sda1", "/");
1172 /* TestOutput for mount_ro (1) */
1176 r = guestfs_write_file (g, "/new", "data", 0);
1183 r = guestfs_umount (g, "/");
1190 r = guestfs_mount_ro (g, "/dev/sda1", "/");
1197 r = guestfs_cat (g, "/new");
1200 if (strcmp (r, "data") != 0) {
1201 fprintf (stderr, "test_mount_ro_1: expected \"data\" but got \"%s\"\n", r);
1209 static int test_tgz_in_0 (void)
1211 /* InitBasicFS for tgz_in (0): create ext2 on /dev/sda1 */
1215 r = guestfs_umount_all (g);
1222 r = guestfs_lvm_remove_all (g);
1233 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1240 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1247 r = guestfs_mount (g, "/dev/sda1", "/");
1251 /* TestOutput for tgz_in (0) */
1255 r = guestfs_tgz_in (g, "images/helloworld.tar.gz", "/");
1262 r = guestfs_cat (g, "/hello");
1265 if (strcmp (r, "hello\n") != 0) {
1266 fprintf (stderr, "test_tgz_in_0: expected \"hello\n\" but got \"%s\"\n", r);
1274 static int test_tar_in_0 (void)
1276 /* InitBasicFS for tar_in (0): create ext2 on /dev/sda1 */
1280 r = guestfs_umount_all (g);
1287 r = guestfs_lvm_remove_all (g);
1298 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1305 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1312 r = guestfs_mount (g, "/dev/sda1", "/");
1316 /* TestOutput for tar_in (0) */
1320 r = guestfs_tar_in (g, "images/helloworld.tar", "/");
1327 r = guestfs_cat (g, "/hello");
1330 if (strcmp (r, "hello\n") != 0) {
1331 fprintf (stderr, "test_tar_in_0: expected \"hello\n\" but got \"%s\"\n", r);
1339 static int test_checksum_0 (void)
1341 /* InitBasicFS for checksum (0): create ext2 on /dev/sda1 */
1345 r = guestfs_umount_all (g);
1352 r = guestfs_lvm_remove_all (g);
1363 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1370 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1377 r = guestfs_mount (g, "/dev/sda1", "/");
1381 /* TestOutput for checksum (0) */
1385 r = guestfs_write_file (g, "/new", "test\n", 0);
1392 r = guestfs_checksum (g, "crc", "/new");
1395 if (strcmp (r, "935282863") != 0) {
1396 fprintf (stderr, "test_checksum_0: expected \"935282863\" but got \"%s\"\n", r);
1404 static int test_checksum_1 (void)
1406 /* InitBasicFS for checksum (1): create ext2 on /dev/sda1 */
1410 r = guestfs_umount_all (g);
1417 r = guestfs_lvm_remove_all (g);
1428 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1435 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1442 r = guestfs_mount (g, "/dev/sda1", "/");
1446 /* TestLastFail for checksum (1) */
1450 r = guestfs_checksum (g, "crc", "/new");
1458 static int test_checksum_2 (void)
1460 /* InitBasicFS for checksum (2): create ext2 on /dev/sda1 */
1464 r = guestfs_umount_all (g);
1471 r = guestfs_lvm_remove_all (g);
1482 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1489 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1496 r = guestfs_mount (g, "/dev/sda1", "/");
1500 /* TestOutput for checksum (2) */
1504 r = guestfs_write_file (g, "/new", "test\n", 0);
1511 r = guestfs_checksum (g, "md5", "/new");
1514 if (strcmp (r, "d8e8fca2dc0f896fd7cb4cb0031ba249") != 0) {
1515 fprintf (stderr, "test_checksum_2: expected \"d8e8fca2dc0f896fd7cb4cb0031ba249\" but got \"%s\"\n", r);
1523 static int test_checksum_3 (void)
1525 /* InitBasicFS for checksum (3): create ext2 on /dev/sda1 */
1529 r = guestfs_umount_all (g);
1536 r = guestfs_lvm_remove_all (g);
1547 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1554 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1561 r = guestfs_mount (g, "/dev/sda1", "/");
1565 /* TestOutput for checksum (3) */
1569 r = guestfs_write_file (g, "/new", "test\n", 0);
1576 r = guestfs_checksum (g, "sha1", "/new");
1579 if (strcmp (r, "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83") != 0) {
1580 fprintf (stderr, "test_checksum_3: expected \"4e1243bd22c66e76c2ba9eddc1f91394e57f9f83\" but got \"%s\"\n", r);
1588 static int test_checksum_4 (void)
1590 /* InitBasicFS for checksum (4): create ext2 on /dev/sda1 */
1594 r = guestfs_umount_all (g);
1601 r = guestfs_lvm_remove_all (g);
1612 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1619 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1626 r = guestfs_mount (g, "/dev/sda1", "/");
1630 /* TestOutput for checksum (4) */
1634 r = guestfs_write_file (g, "/new", "test\n", 0);
1641 r = guestfs_checksum (g, "sha224", "/new");
1644 if (strcmp (r, "52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec") != 0) {
1645 fprintf (stderr, "test_checksum_4: expected \"52f1bf093f4b7588726035c176c0cdb4376cfea53819f1395ac9e6ec\" but got \"%s\"\n", r);
1653 static int test_checksum_5 (void)
1655 /* InitBasicFS for checksum (5): create ext2 on /dev/sda1 */
1659 r = guestfs_umount_all (g);
1666 r = guestfs_lvm_remove_all (g);
1677 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1684 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1691 r = guestfs_mount (g, "/dev/sda1", "/");
1695 /* TestOutput for checksum (5) */
1699 r = guestfs_write_file (g, "/new", "test\n", 0);
1706 r = guestfs_checksum (g, "sha256", "/new");
1709 if (strcmp (r, "f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2") != 0) {
1710 fprintf (stderr, "test_checksum_5: expected \"f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2\" but got \"%s\"\n", r);
1718 static int test_checksum_6 (void)
1720 /* InitBasicFS for checksum (6): create ext2 on /dev/sda1 */
1724 r = guestfs_umount_all (g);
1731 r = guestfs_lvm_remove_all (g);
1742 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1749 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1756 r = guestfs_mount (g, "/dev/sda1", "/");
1760 /* TestOutput for checksum (6) */
1764 r = guestfs_write_file (g, "/new", "test\n", 0);
1771 r = guestfs_checksum (g, "sha384", "/new");
1774 if (strcmp (r, "109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d") != 0) {
1775 fprintf (stderr, "test_checksum_6: expected \"109bb6b5b6d5547c1ce03c7a8bd7d8f80c1cb0957f50c4f7fda04692079917e4f9cad52b878f3d8234e1a170b154b72d\" but got \"%s\"\n", r);
1783 static int test_checksum_7 (void)
1785 /* InitBasicFS for checksum (7): create ext2 on /dev/sda1 */
1789 r = guestfs_umount_all (g);
1796 r = guestfs_lvm_remove_all (g);
1807 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1814 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1821 r = guestfs_mount (g, "/dev/sda1", "/");
1825 /* TestOutput for checksum (7) */
1829 r = guestfs_write_file (g, "/new", "test\n", 0);
1836 r = guestfs_checksum (g, "sha512", "/new");
1839 if (strcmp (r, "0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123") != 0) {
1840 fprintf (stderr, "test_checksum_7: expected \"0e3e75234abc68f4378a86b3f4b32a198ba301845b0cd6e50106e874345700cc6663a86c1ea125dc5e92be17c98f9a0f85ca9d5f595db2012f7cc3571945c123\" but got \"%s\"\n", r);
1848 static int test_download_0 (void)
1850 /* InitBasicFS for download (0): create ext2 on /dev/sda1 */
1854 r = guestfs_umount_all (g);
1861 r = guestfs_lvm_remove_all (g);
1872 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1879 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1886 r = guestfs_mount (g, "/dev/sda1", "/");
1890 /* TestOutput for download (0) */
1894 r = guestfs_upload (g, "COPYING.LIB", "/COPYING.LIB");
1901 r = guestfs_download (g, "/COPYING.LIB", "testdownload.tmp");
1908 r = guestfs_upload (g, "testdownload.tmp", "/upload");
1915 r = guestfs_checksum (g, "md5", "/upload");
1918 if (strcmp (r, "e3eda01d9815f8d24aae2dbd89b68b06") != 0) {
1919 fprintf (stderr, "test_download_0: expected \"e3eda01d9815f8d24aae2dbd89b68b06\" but got \"%s\"\n", r);
1927 static int test_upload_0 (void)
1929 /* InitBasicFS for upload (0): create ext2 on /dev/sda1 */
1933 r = guestfs_umount_all (g);
1940 r = guestfs_lvm_remove_all (g);
1951 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
1958 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
1965 r = guestfs_mount (g, "/dev/sda1", "/");
1969 /* TestOutput for upload (0) */
1973 r = guestfs_upload (g, "COPYING.LIB", "/COPYING.LIB");
1980 r = guestfs_checksum (g, "md5", "/COPYING.LIB");
1983 if (strcmp (r, "e3eda01d9815f8d24aae2dbd89b68b06") != 0) {
1984 fprintf (stderr, "test_upload_0: expected \"e3eda01d9815f8d24aae2dbd89b68b06\" but got \"%s\"\n", r);
1992 static int test_blockdev_rereadpt_0 (void)
1994 /* InitEmpty for blockdev_rereadpt (0) */
1998 r = guestfs_umount_all (g);
2005 r = guestfs_lvm_remove_all (g);
2009 /* TestRun for blockdev_rereadpt (0) */
2013 r = guestfs_blockdev_rereadpt (g, "/dev/sda");
2020 static int test_blockdev_flushbufs_0 (void)
2022 /* InitEmpty for blockdev_flushbufs (0) */
2026 r = guestfs_umount_all (g);
2033 r = guestfs_lvm_remove_all (g);
2037 /* TestRun for blockdev_flushbufs (0) */
2041 r = guestfs_blockdev_flushbufs (g, "/dev/sda");
2048 static int test_blockdev_getsize64_0 (void)
2050 /* InitEmpty for blockdev_getsize64 (0) */
2054 r = guestfs_umount_all (g);
2061 r = guestfs_lvm_remove_all (g);
2065 /* TestOutputInt for blockdev_getsize64 (0) */
2069 r = guestfs_blockdev_getsize64 (g, "/dev/sda");
2072 if (r != 524288000) {
2073 fprintf (stderr, "test_blockdev_getsize64_0: expected 524288000 but got %d\n", (int) r);
2080 static int test_blockdev_getsz_0 (void)
2082 /* InitEmpty for blockdev_getsz (0) */
2086 r = guestfs_umount_all (g);
2093 r = guestfs_lvm_remove_all (g);
2097 /* TestOutputInt for blockdev_getsz (0) */
2101 r = guestfs_blockdev_getsz (g, "/dev/sda");
2105 fprintf (stderr, "test_blockdev_getsz_0: expected 1024000 but got %d\n", (int) r);
2112 static int test_blockdev_getbsz_0 (void)
2114 /* InitEmpty for blockdev_getbsz (0) */
2118 r = guestfs_umount_all (g);
2125 r = guestfs_lvm_remove_all (g);
2129 /* TestOutputInt for blockdev_getbsz (0) */
2133 r = guestfs_blockdev_getbsz (g, "/dev/sda");
2137 fprintf (stderr, "test_blockdev_getbsz_0: expected 4096 but got %d\n", (int) r);
2144 static int test_blockdev_getss_0 (void)
2146 /* InitEmpty for blockdev_getss (0) */
2150 r = guestfs_umount_all (g);
2157 r = guestfs_lvm_remove_all (g);
2161 /* TestOutputInt for blockdev_getss (0) */
2165 r = guestfs_blockdev_getss (g, "/dev/sda");
2169 fprintf (stderr, "test_blockdev_getss_0: expected 512 but got %d\n", (int) r);
2176 static int test_blockdev_getro_0 (void)
2178 /* InitEmpty for blockdev_getro (0) */
2182 r = guestfs_umount_all (g);
2189 r = guestfs_lvm_remove_all (g);
2193 /* TestOutputTrue for blockdev_getro (0) */
2197 r = guestfs_blockdev_setro (g, "/dev/sda");
2204 r = guestfs_blockdev_getro (g, "/dev/sda");
2208 fprintf (stderr, "test_blockdev_getro_0: expected true, got false\n");
2215 static int test_blockdev_setrw_0 (void)
2217 /* InitEmpty for blockdev_setrw (0) */
2221 r = guestfs_umount_all (g);
2228 r = guestfs_lvm_remove_all (g);
2232 /* TestOutputFalse for blockdev_setrw (0) */
2236 r = guestfs_blockdev_setrw (g, "/dev/sda");
2243 r = guestfs_blockdev_getro (g, "/dev/sda");
2247 fprintf (stderr, "test_blockdev_setrw_0: expected false, got true\n");
2254 static int test_blockdev_setro_0 (void)
2256 /* InitEmpty for blockdev_setro (0) */
2260 r = guestfs_umount_all (g);
2267 r = guestfs_lvm_remove_all (g);
2271 /* TestOutputTrue for blockdev_setro (0) */
2275 r = guestfs_blockdev_setro (g, "/dev/sda");
2282 r = guestfs_blockdev_getro (g, "/dev/sda");
2286 fprintf (stderr, "test_blockdev_setro_0: expected true, got false\n");
2293 static int test_statvfs_0 (void)
2295 /* InitBasicFS for statvfs (0): create ext2 on /dev/sda1 */
2299 r = guestfs_umount_all (g);
2306 r = guestfs_lvm_remove_all (g);
2317 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2324 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2331 r = guestfs_mount (g, "/dev/sda1", "/");
2335 /* TestOutputStruct for statvfs (0) */
2337 struct guestfs_statvfs *r;
2339 r = guestfs_statvfs (g, "/");
2342 if (r->bfree != 487702) {
2343 fprintf (stderr, "test_statvfs_0: bfree was %d, expected 487702\n",
2347 if (r->blocks != 490020) {
2348 fprintf (stderr, "test_statvfs_0: blocks was %d, expected 490020\n",
2352 if (r->bsize != 1024) {
2353 fprintf (stderr, "test_statvfs_0: bsize was %d, expected 1024\n",
2362 static int test_lstat_0 (void)
2364 /* InitBasicFS for lstat (0): create ext2 on /dev/sda1 */
2368 r = guestfs_umount_all (g);
2375 r = guestfs_lvm_remove_all (g);
2386 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2393 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2400 r = guestfs_mount (g, "/dev/sda1", "/");
2404 /* TestOutputStruct for lstat (0) */
2408 r = guestfs_touch (g, "/new");
2413 struct guestfs_stat *r;
2415 r = guestfs_lstat (g, "/new");
2419 fprintf (stderr, "test_lstat_0: size was %d, expected 0\n",
2428 static int test_stat_0 (void)
2430 /* InitBasicFS for stat (0): create ext2 on /dev/sda1 */
2434 r = guestfs_umount_all (g);
2441 r = guestfs_lvm_remove_all (g);
2452 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2459 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2466 r = guestfs_mount (g, "/dev/sda1", "/");
2470 /* TestOutputStruct for stat (0) */
2474 r = guestfs_touch (g, "/new");
2479 struct guestfs_stat *r;
2481 r = guestfs_stat (g, "/new");
2485 fprintf (stderr, "test_stat_0: size was %d, expected 0\n",
2494 static int test_file_0 (void)
2496 /* InitBasicFS for file (0): create ext2 on /dev/sda1 */
2500 r = guestfs_umount_all (g);
2507 r = guestfs_lvm_remove_all (g);
2518 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2525 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2532 r = guestfs_mount (g, "/dev/sda1", "/");
2536 /* TestOutput for file (0) */
2540 r = guestfs_touch (g, "/new");
2547 r = guestfs_file (g, "/new");
2550 if (strcmp (r, "empty") != 0) {
2551 fprintf (stderr, "test_file_0: expected \"empty\" but got \"%s\"\n", r);
2559 static int test_file_1 (void)
2561 /* InitBasicFS for file (1): create ext2 on /dev/sda1 */
2565 r = guestfs_umount_all (g);
2572 r = guestfs_lvm_remove_all (g);
2583 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2590 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2597 r = guestfs_mount (g, "/dev/sda1", "/");
2601 /* TestOutput for file (1) */
2605 r = guestfs_write_file (g, "/new", "some content\n", 0);
2612 r = guestfs_file (g, "/new");
2615 if (strcmp (r, "ASCII text") != 0) {
2616 fprintf (stderr, "test_file_1: expected \"ASCII text\" but got \"%s\"\n", r);
2624 static int test_file_2 (void)
2626 /* InitBasicFS for file (2): create ext2 on /dev/sda1 */
2630 r = guestfs_umount_all (g);
2637 r = guestfs_lvm_remove_all (g);
2648 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2655 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2662 r = guestfs_mount (g, "/dev/sda1", "/");
2666 /* TestLastFail for file (2) */
2670 r = guestfs_file (g, "/nofile");
2678 static int test_umount_all_0 (void)
2680 /* InitBasicFS for umount_all (0): create ext2 on /dev/sda1 */
2684 r = guestfs_umount_all (g);
2691 r = guestfs_lvm_remove_all (g);
2702 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2709 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2716 r = guestfs_mount (g, "/dev/sda1", "/");
2720 /* TestOutputList for umount_all (0) */
2724 r = guestfs_umount_all (g);
2732 r = guestfs_mounts (g);
2736 fprintf (stderr, "test_umount_all_0: extra elements returned from command\n");
2740 for (i = 0; r[i] != NULL; ++i)
2747 static int test_umount_all_1 (void)
2749 /* InitEmpty for umount_all (1) */
2753 r = guestfs_umount_all (g);
2760 r = guestfs_lvm_remove_all (g);
2764 /* TestOutputList for umount_all (1) */
2774 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2781 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2788 r = guestfs_mkfs (g, "ext2", "/dev/sda2");
2795 r = guestfs_mkfs (g, "ext2", "/dev/sda3");
2802 r = guestfs_mount (g, "/dev/sda1", "/");
2809 r = guestfs_mkdir (g, "/mp1");
2816 r = guestfs_mount (g, "/dev/sda2", "/mp1");
2823 r = guestfs_mkdir (g, "/mp1/mp2");
2830 r = guestfs_mount (g, "/dev/sda3", "/mp1/mp2");
2837 r = guestfs_mkdir (g, "/mp1/mp2/mp3");
2844 r = guestfs_umount_all (g);
2852 r = guestfs_mounts (g);
2856 fprintf (stderr, "test_umount_all_1: extra elements returned from command\n");
2860 for (i = 0; r[i] != NULL; ++i)
2867 static int test_mounts_0 (void)
2869 /* InitBasicFS for mounts (0): create ext2 on /dev/sda1 */
2873 r = guestfs_umount_all (g);
2880 r = guestfs_lvm_remove_all (g);
2891 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2898 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2905 r = guestfs_mount (g, "/dev/sda1", "/");
2909 /* TestOutputList for mounts (0) */
2914 r = guestfs_mounts (g);
2918 fprintf (stderr, "test_mounts_0: short list returned from command\n");
2922 if (strcmp (r[0], "/dev/sda1") != 0) {
2923 fprintf (stderr, "test_mounts_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
2927 fprintf (stderr, "test_mounts_0: extra elements returned from command\n");
2931 for (i = 0; r[i] != NULL; ++i)
2938 static int test_umount_0 (void)
2940 /* InitEmpty for umount (0) */
2944 r = guestfs_umount_all (g);
2951 r = guestfs_lvm_remove_all (g);
2955 /* TestOutputList for umount (0) */
2963 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2970 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2977 r = guestfs_mount (g, "/dev/sda1", "/");
2985 r = guestfs_mounts (g);
2989 fprintf (stderr, "test_umount_0: short list returned from command\n");
2993 if (strcmp (r[0], "/dev/sda1") != 0) {
2994 fprintf (stderr, "test_umount_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
2998 fprintf (stderr, "test_umount_0: extra elements returned from command\n");
3002 for (i = 0; r[i] != NULL; ++i)
3009 static int test_umount_1 (void)
3011 /* InitEmpty for umount (1) */
3015 r = guestfs_umount_all (g);
3022 r = guestfs_lvm_remove_all (g);
3026 /* TestOutputList for umount (1) */
3034 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3041 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3048 r = guestfs_mount (g, "/dev/sda1", "/");
3055 r = guestfs_umount (g, "/");
3063 r = guestfs_mounts (g);
3067 fprintf (stderr, "test_umount_1: extra elements returned from command\n");
3071 for (i = 0; r[i] != NULL; ++i)
3078 static int test_write_file_0 (void)
3080 /* InitBasicFS for write_file (0): create ext2 on /dev/sda1 */
3084 r = guestfs_umount_all (g);
3091 r = guestfs_lvm_remove_all (g);
3102 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3109 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3116 r = guestfs_mount (g, "/dev/sda1", "/");
3120 /* TestOutput for write_file (0) */
3124 r = guestfs_write_file (g, "/new", "new file contents", 0);
3131 r = guestfs_cat (g, "/new");
3134 if (strcmp (r, "new file contents") != 0) {
3135 fprintf (stderr, "test_write_file_0: expected \"new file contents\" but got \"%s\"\n", r);
3143 static int test_write_file_1 (void)
3145 /* InitBasicFS for write_file (1): create ext2 on /dev/sda1 */
3149 r = guestfs_umount_all (g);
3156 r = guestfs_lvm_remove_all (g);
3167 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3174 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3181 r = guestfs_mount (g, "/dev/sda1", "/");
3185 /* TestOutput for write_file (1) */
3189 r = guestfs_write_file (g, "/new", "\nnew file contents\n", 0);
3196 r = guestfs_cat (g, "/new");
3199 if (strcmp (r, "\nnew file contents\n") != 0) {
3200 fprintf (stderr, "test_write_file_1: expected \"\nnew file contents\n\" but got \"%s\"\n", r);
3208 static int test_write_file_2 (void)
3210 /* InitBasicFS for write_file (2): create ext2 on /dev/sda1 */
3214 r = guestfs_umount_all (g);
3221 r = guestfs_lvm_remove_all (g);
3232 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3239 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3246 r = guestfs_mount (g, "/dev/sda1", "/");
3250 /* TestOutput for write_file (2) */
3254 r = guestfs_write_file (g, "/new", "\n\n", 0);
3261 r = guestfs_cat (g, "/new");
3264 if (strcmp (r, "\n\n") != 0) {
3265 fprintf (stderr, "test_write_file_2: expected \"\n\n\" but got \"%s\"\n", r);
3273 static int test_write_file_3 (void)
3275 /* InitBasicFS for write_file (3): create ext2 on /dev/sda1 */
3279 r = guestfs_umount_all (g);
3286 r = guestfs_lvm_remove_all (g);
3297 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3304 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3311 r = guestfs_mount (g, "/dev/sda1", "/");
3315 /* TestOutput for write_file (3) */
3319 r = guestfs_write_file (g, "/new", "", 0);
3326 r = guestfs_cat (g, "/new");
3329 if (strcmp (r, "") != 0) {
3330 fprintf (stderr, "test_write_file_3: expected \"\" but got \"%s\"\n", r);
3338 static int test_write_file_4 (void)
3340 /* InitBasicFS for write_file (4): create ext2 on /dev/sda1 */
3344 r = guestfs_umount_all (g);
3351 r = guestfs_lvm_remove_all (g);
3362 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3369 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3376 r = guestfs_mount (g, "/dev/sda1", "/");
3380 /* TestOutput for write_file (4) */
3384 r = guestfs_write_file (g, "/new", "\n\n\n", 0);
3391 r = guestfs_cat (g, "/new");
3394 if (strcmp (r, "\n\n\n") != 0) {
3395 fprintf (stderr, "test_write_file_4: expected \"\n\n\n\" but got \"%s\"\n", r);
3403 static int test_write_file_5 (void)
3405 /* InitBasicFS for write_file (5): create ext2 on /dev/sda1 */
3409 r = guestfs_umount_all (g);
3416 r = guestfs_lvm_remove_all (g);
3427 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3434 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3441 r = guestfs_mount (g, "/dev/sda1", "/");
3445 /* TestOutput for write_file (5) */
3449 r = guestfs_write_file (g, "/new", "\n", 0);
3456 r = guestfs_cat (g, "/new");
3459 if (strcmp (r, "\n") != 0) {
3460 fprintf (stderr, "test_write_file_5: expected \"\n\" but got \"%s\"\n", r);
3468 static int test_mkfs_0 (void)
3470 /* InitEmpty for mkfs (0) */
3474 r = guestfs_umount_all (g);
3481 r = guestfs_lvm_remove_all (g);
3485 /* TestOutput for mkfs (0) */
3493 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3500 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3507 r = guestfs_mount (g, "/dev/sda1", "/");
3514 r = guestfs_write_file (g, "/new", "new file contents", 0);
3521 r = guestfs_cat (g, "/new");
3524 if (strcmp (r, "new file contents") != 0) {
3525 fprintf (stderr, "test_mkfs_0: expected \"new file contents\" but got \"%s\"\n", r);
3533 static int test_lvcreate_0 (void)
3535 /* InitEmpty for lvcreate (0) */
3539 r = guestfs_umount_all (g);
3546 r = guestfs_lvm_remove_all (g);
3550 /* TestOutputList for lvcreate (0) */
3560 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3567 r = guestfs_pvcreate (g, "/dev/sda1");
3574 r = guestfs_pvcreate (g, "/dev/sda2");
3581 r = guestfs_pvcreate (g, "/dev/sda3");
3586 char *physvols[] = {
3593 r = guestfs_vgcreate (g, "VG1", physvols);
3598 char *physvols[] = {
3604 r = guestfs_vgcreate (g, "VG2", physvols);
3611 r = guestfs_lvcreate (g, "LV1", "VG1", 50);
3618 r = guestfs_lvcreate (g, "LV2", "VG1", 50);
3625 r = guestfs_lvcreate (g, "LV3", "VG2", 50);
3632 r = guestfs_lvcreate (g, "LV4", "VG2", 50);
3639 r = guestfs_lvcreate (g, "LV5", "VG2", 50);
3647 r = guestfs_lvs (g);
3651 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3655 if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
3656 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
3660 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3664 if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
3665 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
3669 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3673 if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
3674 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
3678 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3682 if (strcmp (r[3], "/dev/VG2/LV4") != 0) {
3683 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV4\" but got \"%s\"\n", r[3]);
3687 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3691 if (strcmp (r[4], "/dev/VG2/LV5") != 0) {
3692 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV5\" but got \"%s\"\n", r[4]);
3696 fprintf (stderr, "test_lvcreate_0: extra elements returned from command\n");
3700 for (i = 0; r[i] != NULL; ++i)
3707 static int test_vgcreate_0 (void)
3709 /* InitEmpty for vgcreate (0) */
3713 r = guestfs_umount_all (g);
3720 r = guestfs_lvm_remove_all (g);
3724 /* TestOutputList for vgcreate (0) */
3734 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3741 r = guestfs_pvcreate (g, "/dev/sda1");
3748 r = guestfs_pvcreate (g, "/dev/sda2");
3755 r = guestfs_pvcreate (g, "/dev/sda3");
3760 char *physvols[] = {
3767 r = guestfs_vgcreate (g, "VG1", physvols);
3772 char *physvols[] = {
3778 r = guestfs_vgcreate (g, "VG2", physvols);
3786 r = guestfs_vgs (g);
3790 fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
3794 if (strcmp (r[0], "VG1") != 0) {
3795 fprintf (stderr, "test_vgcreate_0: expected \"VG1\" but got \"%s\"\n", r[0]);
3799 fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
3803 if (strcmp (r[1], "VG2") != 0) {
3804 fprintf (stderr, "test_vgcreate_0: expected \"VG2\" but got \"%s\"\n", r[1]);
3808 fprintf (stderr, "test_vgcreate_0: extra elements returned from command\n");
3812 for (i = 0; r[i] != NULL; ++i)
3819 static int test_pvcreate_0 (void)
3821 /* InitEmpty for pvcreate (0) */
3825 r = guestfs_umount_all (g);
3832 r = guestfs_lvm_remove_all (g);
3836 /* TestOutputList for pvcreate (0) */
3846 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3853 r = guestfs_pvcreate (g, "/dev/sda1");
3860 r = guestfs_pvcreate (g, "/dev/sda2");
3867 r = guestfs_pvcreate (g, "/dev/sda3");
3875 r = guestfs_pvs (g);
3879 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3883 if (strcmp (r[0], "/dev/sda1") != 0) {
3884 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
3888 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3892 if (strcmp (r[1], "/dev/sda2") != 0) {
3893 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
3897 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3901 if (strcmp (r[2], "/dev/sda3") != 0) {
3902 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
3906 fprintf (stderr, "test_pvcreate_0: extra elements returned from command\n");
3910 for (i = 0; r[i] != NULL; ++i)
3917 static int test_is_dir_0 (void)
3919 /* InitBasicFS for is_dir (0): create ext2 on /dev/sda1 */
3923 r = guestfs_umount_all (g);
3930 r = guestfs_lvm_remove_all (g);
3941 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3948 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3955 r = guestfs_mount (g, "/dev/sda1", "/");
3959 /* TestOutputFalse for is_dir (0) */
3963 r = guestfs_touch (g, "/new");
3970 r = guestfs_is_dir (g, "/new");
3974 fprintf (stderr, "test_is_dir_0: expected false, got true\n");
3981 static int test_is_dir_1 (void)
3983 /* InitBasicFS for is_dir (1): create ext2 on /dev/sda1 */
3987 r = guestfs_umount_all (g);
3994 r = guestfs_lvm_remove_all (g);
4005 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4012 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4019 r = guestfs_mount (g, "/dev/sda1", "/");
4023 /* TestOutputTrue for is_dir (1) */
4027 r = guestfs_mkdir (g, "/new");
4034 r = guestfs_is_dir (g, "/new");
4038 fprintf (stderr, "test_is_dir_1: expected true, got false\n");
4045 static int test_is_file_0 (void)
4047 /* InitBasicFS for is_file (0): create ext2 on /dev/sda1 */
4051 r = guestfs_umount_all (g);
4058 r = guestfs_lvm_remove_all (g);
4069 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4076 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4083 r = guestfs_mount (g, "/dev/sda1", "/");
4087 /* TestOutputTrue for is_file (0) */
4091 r = guestfs_touch (g, "/new");
4098 r = guestfs_is_file (g, "/new");
4102 fprintf (stderr, "test_is_file_0: expected true, got false\n");
4109 static int test_is_file_1 (void)
4111 /* InitBasicFS for is_file (1): create ext2 on /dev/sda1 */
4115 r = guestfs_umount_all (g);
4122 r = guestfs_lvm_remove_all (g);
4133 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4140 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4147 r = guestfs_mount (g, "/dev/sda1", "/");
4151 /* TestOutputFalse for is_file (1) */
4155 r = guestfs_mkdir (g, "/new");
4162 r = guestfs_is_file (g, "/new");
4166 fprintf (stderr, "test_is_file_1: expected false, got true\n");
4173 static int test_exists_0 (void)
4175 /* InitBasicFS for exists (0): create ext2 on /dev/sda1 */
4179 r = guestfs_umount_all (g);
4186 r = guestfs_lvm_remove_all (g);
4197 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4204 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4211 r = guestfs_mount (g, "/dev/sda1", "/");
4215 /* TestOutputTrue for exists (0) */
4219 r = guestfs_touch (g, "/new");
4226 r = guestfs_exists (g, "/new");
4230 fprintf (stderr, "test_exists_0: expected true, got false\n");
4237 static int test_exists_1 (void)
4239 /* InitBasicFS for exists (1): create ext2 on /dev/sda1 */
4243 r = guestfs_umount_all (g);
4250 r = guestfs_lvm_remove_all (g);
4261 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4268 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4275 r = guestfs_mount (g, "/dev/sda1", "/");
4279 /* TestOutputTrue for exists (1) */
4283 r = guestfs_mkdir (g, "/new");
4290 r = guestfs_exists (g, "/new");
4294 fprintf (stderr, "test_exists_1: expected true, got false\n");
4301 static int test_mkdir_p_0 (void)
4303 /* InitBasicFS for mkdir_p (0): create ext2 on /dev/sda1 */
4307 r = guestfs_umount_all (g);
4314 r = guestfs_lvm_remove_all (g);
4325 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4332 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4339 r = guestfs_mount (g, "/dev/sda1", "/");
4343 /* TestOutputTrue for mkdir_p (0) */
4347 r = guestfs_mkdir_p (g, "/new/foo/bar");
4354 r = guestfs_is_dir (g, "/new/foo/bar");
4358 fprintf (stderr, "test_mkdir_p_0: expected true, got false\n");
4365 static int test_mkdir_p_1 (void)
4367 /* InitBasicFS for mkdir_p (1): create ext2 on /dev/sda1 */
4371 r = guestfs_umount_all (g);
4378 r = guestfs_lvm_remove_all (g);
4389 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4396 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4403 r = guestfs_mount (g, "/dev/sda1", "/");
4407 /* TestOutputTrue for mkdir_p (1) */
4411 r = guestfs_mkdir_p (g, "/new/foo/bar");
4418 r = guestfs_is_dir (g, "/new/foo");
4422 fprintf (stderr, "test_mkdir_p_1: expected true, got false\n");
4429 static int test_mkdir_p_2 (void)
4431 /* InitBasicFS for mkdir_p (2): create ext2 on /dev/sda1 */
4435 r = guestfs_umount_all (g);
4442 r = guestfs_lvm_remove_all (g);
4453 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4460 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4467 r = guestfs_mount (g, "/dev/sda1", "/");
4471 /* TestOutputTrue for mkdir_p (2) */
4475 r = guestfs_mkdir_p (g, "/new/foo/bar");
4482 r = guestfs_is_dir (g, "/new");
4486 fprintf (stderr, "test_mkdir_p_2: expected true, got false\n");
4493 static int test_mkdir_0 (void)
4495 /* InitBasicFS for mkdir (0): create ext2 on /dev/sda1 */
4499 r = guestfs_umount_all (g);
4506 r = guestfs_lvm_remove_all (g);
4517 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4524 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4531 r = guestfs_mount (g, "/dev/sda1", "/");
4535 /* TestOutputTrue for mkdir (0) */
4539 r = guestfs_mkdir (g, "/new");
4546 r = guestfs_is_dir (g, "/new");
4550 fprintf (stderr, "test_mkdir_0: expected true, got false\n");
4557 static int test_mkdir_1 (void)
4559 /* InitBasicFS for mkdir (1): create ext2 on /dev/sda1 */
4563 r = guestfs_umount_all (g);
4570 r = guestfs_lvm_remove_all (g);
4581 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4588 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4595 r = guestfs_mount (g, "/dev/sda1", "/");
4599 /* TestLastFail for mkdir (1) */
4603 r = guestfs_mkdir (g, "/new/foo/bar");
4610 static int test_rm_rf_0 (void)
4612 /* InitBasicFS for rm_rf (0): 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 /* TestOutputFalse for rm_rf (0) */
4656 r = guestfs_mkdir (g, "/new");
4663 r = guestfs_mkdir (g, "/new/foo");
4670 r = guestfs_touch (g, "/new/foo/bar");
4677 r = guestfs_rm_rf (g, "/new");
4684 r = guestfs_exists (g, "/new");
4688 fprintf (stderr, "test_rm_rf_0: expected false, got true\n");
4695 static int test_rmdir_0 (void)
4697 /* InitBasicFS for rmdir (0): create ext2 on /dev/sda1 */
4701 r = guestfs_umount_all (g);
4708 r = guestfs_lvm_remove_all (g);
4719 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4726 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4733 r = guestfs_mount (g, "/dev/sda1", "/");
4737 /* TestRun for rmdir (0) */
4741 r = guestfs_mkdir (g, "/new");
4748 r = guestfs_rmdir (g, "/new");
4755 static int test_rmdir_1 (void)
4757 /* InitBasicFS for rmdir (1): create ext2 on /dev/sda1 */
4761 r = guestfs_umount_all (g);
4768 r = guestfs_lvm_remove_all (g);
4779 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4786 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4793 r = guestfs_mount (g, "/dev/sda1", "/");
4797 /* TestLastFail for rmdir (1) */
4801 r = guestfs_rmdir (g, "/new");
4808 static int test_rmdir_2 (void)
4810 /* InitBasicFS for rmdir (2): 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 (2) */
4854 r = guestfs_touch (g, "/new");
4861 r = guestfs_rmdir (g, "/new");
4868 static int test_rm_0 (void)
4870 /* InitBasicFS for rm (0): create ext2 on /dev/sda1 */
4874 r = guestfs_umount_all (g);
4881 r = guestfs_lvm_remove_all (g);
4892 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4899 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4906 r = guestfs_mount (g, "/dev/sda1", "/");
4910 /* TestRun for rm (0) */
4914 r = guestfs_touch (g, "/new");
4921 r = guestfs_rm (g, "/new");
4928 static int test_rm_1 (void)
4930 /* InitBasicFS for rm (1): create ext2 on /dev/sda1 */
4934 r = guestfs_umount_all (g);
4941 r = guestfs_lvm_remove_all (g);
4952 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4959 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4966 r = guestfs_mount (g, "/dev/sda1", "/");
4970 /* TestLastFail for rm (1) */
4974 r = guestfs_rm (g, "/new");
4981 static int test_rm_2 (void)
4983 /* InitBasicFS for rm (2): 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 (2) */
5027 r = guestfs_mkdir (g, "/new");
5034 r = guestfs_rm (g, "/new");
5041 static int test_read_lines_0 (void)
5043 /* InitBasicFS for read_lines (0): create ext2 on /dev/sda1 */
5047 r = guestfs_umount_all (g);
5054 r = guestfs_lvm_remove_all (g);
5065 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5072 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5079 r = guestfs_mount (g, "/dev/sda1", "/");
5083 /* TestOutputList for read_lines (0) */
5087 r = guestfs_write_file (g, "/new", "line1\r\nline2\nline3", 0);
5095 r = guestfs_read_lines (g, "/new");
5099 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
5103 if (strcmp (r[0], "line1") != 0) {
5104 fprintf (stderr, "test_read_lines_0: expected \"line1\" but got \"%s\"\n", r[0]);
5108 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
5112 if (strcmp (r[1], "line2") != 0) {
5113 fprintf (stderr, "test_read_lines_0: expected \"line2\" but got \"%s\"\n", r[1]);
5117 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
5121 if (strcmp (r[2], "line3") != 0) {
5122 fprintf (stderr, "test_read_lines_0: expected \"line3\" but got \"%s\"\n", r[2]);
5126 fprintf (stderr, "test_read_lines_0: extra elements returned from command\n");
5130 for (i = 0; r[i] != NULL; ++i)
5137 static int test_read_lines_1 (void)
5139 /* InitBasicFS for read_lines (1): create ext2 on /dev/sda1 */
5143 r = guestfs_umount_all (g);
5150 r = guestfs_lvm_remove_all (g);
5161 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5168 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5175 r = guestfs_mount (g, "/dev/sda1", "/");
5179 /* TestOutputList for read_lines (1) */
5183 r = guestfs_write_file (g, "/new", "", 0);
5191 r = guestfs_read_lines (g, "/new");
5195 fprintf (stderr, "test_read_lines_1: extra elements returned from command\n");
5199 for (i = 0; r[i] != NULL; ++i)
5206 static int test_lvs_0 (void)
5208 /* InitBasicFSonLVM for lvs (0): create ext2 on /dev/VG/LV */
5212 r = guestfs_umount_all (g);
5219 r = guestfs_lvm_remove_all (g);
5230 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5237 r = guestfs_pvcreate (g, "/dev/sda1");
5242 char *physvols[] = {
5248 r = guestfs_vgcreate (g, "VG", physvols);
5255 r = guestfs_lvcreate (g, "LV", "VG", 8);
5262 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5269 r = guestfs_mount (g, "/dev/VG/LV", "/");
5273 /* TestOutputList for lvs (0) */
5278 r = guestfs_lvs (g);
5282 fprintf (stderr, "test_lvs_0: short list returned from command\n");
5286 if (strcmp (r[0], "/dev/VG/LV") != 0) {
5287 fprintf (stderr, "test_lvs_0: expected \"/dev/VG/LV\" but got \"%s\"\n", r[0]);
5291 fprintf (stderr, "test_lvs_0: extra elements returned from command\n");
5295 for (i = 0; r[i] != NULL; ++i)
5302 static int test_lvs_1 (void)
5304 /* InitEmpty for lvs (1) */
5308 r = guestfs_umount_all (g);
5315 r = guestfs_lvm_remove_all (g);
5319 /* TestOutputList for lvs (1) */
5329 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5336 r = guestfs_pvcreate (g, "/dev/sda1");
5343 r = guestfs_pvcreate (g, "/dev/sda2");
5350 r = guestfs_pvcreate (g, "/dev/sda3");
5355 char *physvols[] = {
5362 r = guestfs_vgcreate (g, "VG1", physvols);
5367 char *physvols[] = {
5373 r = guestfs_vgcreate (g, "VG2", physvols);
5380 r = guestfs_lvcreate (g, "LV1", "VG1", 50);
5387 r = guestfs_lvcreate (g, "LV2", "VG1", 50);
5394 r = guestfs_lvcreate (g, "LV3", "VG2", 50);
5402 r = guestfs_lvs (g);
5406 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5410 if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
5411 fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
5415 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5419 if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
5420 fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
5424 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5428 if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
5429 fprintf (stderr, "test_lvs_1: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
5433 fprintf (stderr, "test_lvs_1: extra elements returned from command\n");
5437 for (i = 0; r[i] != NULL; ++i)
5444 static int test_vgs_0 (void)
5446 /* InitBasicFSonLVM for vgs (0): create ext2 on /dev/VG/LV */
5450 r = guestfs_umount_all (g);
5457 r = guestfs_lvm_remove_all (g);
5468 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5475 r = guestfs_pvcreate (g, "/dev/sda1");
5480 char *physvols[] = {
5486 r = guestfs_vgcreate (g, "VG", physvols);
5493 r = guestfs_lvcreate (g, "LV", "VG", 8);
5500 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5507 r = guestfs_mount (g, "/dev/VG/LV", "/");
5511 /* TestOutputList for vgs (0) */
5516 r = guestfs_vgs (g);
5520 fprintf (stderr, "test_vgs_0: short list returned from command\n");
5524 if (strcmp (r[0], "VG") != 0) {
5525 fprintf (stderr, "test_vgs_0: expected \"VG\" but got \"%s\"\n", r[0]);
5529 fprintf (stderr, "test_vgs_0: extra elements returned from command\n");
5533 for (i = 0; r[i] != NULL; ++i)
5540 static int test_vgs_1 (void)
5542 /* InitEmpty for vgs (1) */
5546 r = guestfs_umount_all (g);
5553 r = guestfs_lvm_remove_all (g);
5557 /* TestOutputList for vgs (1) */
5567 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5574 r = guestfs_pvcreate (g, "/dev/sda1");
5581 r = guestfs_pvcreate (g, "/dev/sda2");
5588 r = guestfs_pvcreate (g, "/dev/sda3");
5593 char *physvols[] = {
5600 r = guestfs_vgcreate (g, "VG1", physvols);
5605 char *physvols[] = {
5611 r = guestfs_vgcreate (g, "VG2", physvols);
5619 r = guestfs_vgs (g);
5623 fprintf (stderr, "test_vgs_1: short list returned from command\n");
5627 if (strcmp (r[0], "VG1") != 0) {
5628 fprintf (stderr, "test_vgs_1: expected \"VG1\" but got \"%s\"\n", r[0]);
5632 fprintf (stderr, "test_vgs_1: short list returned from command\n");
5636 if (strcmp (r[1], "VG2") != 0) {
5637 fprintf (stderr, "test_vgs_1: expected \"VG2\" but got \"%s\"\n", r[1]);
5641 fprintf (stderr, "test_vgs_1: extra elements returned from command\n");
5645 for (i = 0; r[i] != NULL; ++i)
5652 static int test_pvs_0 (void)
5654 /* InitBasicFSonLVM for pvs (0): create ext2 on /dev/VG/LV */
5658 r = guestfs_umount_all (g);
5665 r = guestfs_lvm_remove_all (g);
5676 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5683 r = guestfs_pvcreate (g, "/dev/sda1");
5688 char *physvols[] = {
5694 r = guestfs_vgcreate (g, "VG", physvols);
5701 r = guestfs_lvcreate (g, "LV", "VG", 8);
5708 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5715 r = guestfs_mount (g, "/dev/VG/LV", "/");
5719 /* TestOutputList for pvs (0) */
5724 r = guestfs_pvs (g);
5728 fprintf (stderr, "test_pvs_0: short list returned from command\n");
5732 if (strcmp (r[0], "/dev/sda1") != 0) {
5733 fprintf (stderr, "test_pvs_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5737 fprintf (stderr, "test_pvs_0: extra elements returned from command\n");
5741 for (i = 0; r[i] != NULL; ++i)
5748 static int test_pvs_1 (void)
5750 /* InitEmpty for pvs (1) */
5754 r = guestfs_umount_all (g);
5761 r = guestfs_lvm_remove_all (g);
5765 /* TestOutputList for pvs (1) */
5775 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5782 r = guestfs_pvcreate (g, "/dev/sda1");
5789 r = guestfs_pvcreate (g, "/dev/sda2");
5796 r = guestfs_pvcreate (g, "/dev/sda3");
5804 r = guestfs_pvs (g);
5808 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5812 if (strcmp (r[0], "/dev/sda1") != 0) {
5813 fprintf (stderr, "test_pvs_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5817 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5821 if (strcmp (r[1], "/dev/sda2") != 0) {
5822 fprintf (stderr, "test_pvs_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
5826 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5830 if (strcmp (r[2], "/dev/sda3") != 0) {
5831 fprintf (stderr, "test_pvs_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
5835 fprintf (stderr, "test_pvs_1: extra elements returned from command\n");
5839 for (i = 0; r[i] != NULL; ++i)
5846 static int test_list_partitions_0 (void)
5848 /* InitBasicFS for list_partitions (0): create ext2 on /dev/sda1 */
5852 r = guestfs_umount_all (g);
5859 r = guestfs_lvm_remove_all (g);
5870 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5877 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5884 r = guestfs_mount (g, "/dev/sda1", "/");
5888 /* TestOutputList for list_partitions (0) */
5893 r = guestfs_list_partitions (g);
5897 fprintf (stderr, "test_list_partitions_0: short list returned from command\n");
5901 if (strcmp (r[0], "/dev/sda1") != 0) {
5902 fprintf (stderr, "test_list_partitions_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5906 fprintf (stderr, "test_list_partitions_0: extra elements returned from command\n");
5910 for (i = 0; r[i] != NULL; ++i)
5917 static int test_list_partitions_1 (void)
5919 /* InitEmpty for list_partitions (1) */
5923 r = guestfs_umount_all (g);
5930 r = guestfs_lvm_remove_all (g);
5934 /* TestOutputList for list_partitions (1) */
5944 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5952 r = guestfs_list_partitions (g);
5956 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
5960 if (strcmp (r[0], "/dev/sda1") != 0) {
5961 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5965 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
5969 if (strcmp (r[1], "/dev/sda2") != 0) {
5970 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
5974 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
5978 if (strcmp (r[2], "/dev/sda3") != 0) {
5979 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
5983 fprintf (stderr, "test_list_partitions_1: extra elements returned from command\n");
5987 for (i = 0; r[i] != NULL; ++i)
5994 static int test_list_devices_0 (void)
5996 /* InitEmpty for list_devices (0) */
6000 r = guestfs_umount_all (g);
6007 r = guestfs_lvm_remove_all (g);
6011 /* TestOutputList for list_devices (0) */
6016 r = guestfs_list_devices (g);
6020 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
6024 if (strcmp (r[0], "/dev/sda") != 0) {
6025 fprintf (stderr, "test_list_devices_0: expected \"/dev/sda\" but got \"%s\"\n", r[0]);
6029 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
6033 if (strcmp (r[1], "/dev/sdb") != 0) {
6034 fprintf (stderr, "test_list_devices_0: expected \"/dev/sdb\" but got \"%s\"\n", r[1]);
6038 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
6042 if (strcmp (r[2], "/dev/sdc") != 0) {
6043 fprintf (stderr, "test_list_devices_0: expected \"/dev/sdc\" but got \"%s\"\n", r[2]);
6047 fprintf (stderr, "test_list_devices_0: extra elements returned from command\n");
6051 for (i = 0; r[i] != NULL; ++i)
6058 static int test_ls_0 (void)
6060 /* InitBasicFS for ls (0): create ext2 on /dev/sda1 */
6064 r = guestfs_umount_all (g);
6071 r = guestfs_lvm_remove_all (g);
6082 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6089 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6096 r = guestfs_mount (g, "/dev/sda1", "/");
6100 /* TestOutputList for ls (0) */
6104 r = guestfs_touch (g, "/new");
6111 r = guestfs_touch (g, "/newer");
6118 r = guestfs_touch (g, "/newest");
6126 r = guestfs_ls (g, "/");
6130 fprintf (stderr, "test_ls_0: short list returned from command\n");
6134 if (strcmp (r[0], "lost+found") != 0) {
6135 fprintf (stderr, "test_ls_0: expected \"lost+found\" but got \"%s\"\n", r[0]);
6139 fprintf (stderr, "test_ls_0: short list returned from command\n");
6143 if (strcmp (r[1], "new") != 0) {
6144 fprintf (stderr, "test_ls_0: expected \"new\" but got \"%s\"\n", r[1]);
6148 fprintf (stderr, "test_ls_0: short list returned from command\n");
6152 if (strcmp (r[2], "newer") != 0) {
6153 fprintf (stderr, "test_ls_0: expected \"newer\" but got \"%s\"\n", r[2]);
6157 fprintf (stderr, "test_ls_0: short list returned from command\n");
6161 if (strcmp (r[3], "newest") != 0) {
6162 fprintf (stderr, "test_ls_0: expected \"newest\" but got \"%s\"\n", r[3]);
6166 fprintf (stderr, "test_ls_0: extra elements returned from command\n");
6170 for (i = 0; r[i] != NULL; ++i)
6177 static int test_cat_0 (void)
6179 /* InitBasicFS for cat (0): create ext2 on /dev/sda1 */
6183 r = guestfs_umount_all (g);
6190 r = guestfs_lvm_remove_all (g);
6201 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6208 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6215 r = guestfs_mount (g, "/dev/sda1", "/");
6219 /* TestOutput for cat (0) */
6223 r = guestfs_write_file (g, "/new", "new file contents", 0);
6230 r = guestfs_cat (g, "/new");
6233 if (strcmp (r, "new file contents") != 0) {
6234 fprintf (stderr, "test_cat_0: expected \"new file contents\" but got \"%s\"\n", r);
6242 static int test_touch_0 (void)
6244 /* InitBasicFS for touch (0): create ext2 on /dev/sda1 */
6248 r = guestfs_umount_all (g);
6255 r = guestfs_lvm_remove_all (g);
6266 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6273 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6280 r = guestfs_mount (g, "/dev/sda1", "/");
6284 /* TestOutputTrue for touch (0) */
6288 r = guestfs_touch (g, "/new");
6295 r = guestfs_exists (g, "/new");
6299 fprintf (stderr, "test_touch_0: expected true, got false\n");
6306 static int test_sync_0 (void)
6308 /* InitEmpty for sync (0) */
6312 r = guestfs_umount_all (g);
6319 r = guestfs_lvm_remove_all (g);
6323 /* TestRun for sync (0) */
6327 r = guestfs_sync (g);
6334 static int test_mount_0 (void)
6336 /* InitEmpty for mount (0) */
6340 r = guestfs_umount_all (g);
6347 r = guestfs_lvm_remove_all (g);
6351 /* TestOutput for mount (0) */
6359 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6366 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6373 r = guestfs_mount (g, "/dev/sda1", "/");
6380 r = guestfs_write_file (g, "/new", "new file contents", 0);
6387 r = guestfs_cat (g, "/new");
6390 if (strcmp (r, "new file contents") != 0) {
6391 fprintf (stderr, "test_mount_0: expected \"new file contents\" but got \"%s\"\n", r);
6399 int main (int argc, char *argv[])
6404 const char *filename;
6406 int nr_tests, test_num = 0;
6408 no_test_warnings ();
6410 g = guestfs_create ();
6412 printf ("guestfs_create FAILED\n");
6416 guestfs_set_error_handler (g, print_error, NULL);
6418 srcdir = getenv ("srcdir");
6419 if (!srcdir) srcdir = ".";
6421 guestfs_set_path (g, ".");
6423 filename = "test1.img";
6424 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6429 if (lseek (fd, 524288000, SEEK_SET) == -1) {
6435 if (write (fd, &c, 1) == -1) {
6441 if (close (fd) == -1) {
6446 if (guestfs_add_drive (g, filename) == -1) {
6447 printf ("guestfs_add_drive %s FAILED\n", filename);
6451 filename = "test2.img";
6452 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6457 if (lseek (fd, 52428800, SEEK_SET) == -1) {
6463 if (write (fd, &c, 1) == -1) {
6469 if (close (fd) == -1) {
6474 if (guestfs_add_drive (g, filename) == -1) {
6475 printf ("guestfs_add_drive %s FAILED\n", filename);
6479 filename = "test3.img";
6480 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6485 if (lseek (fd, 10485760, SEEK_SET) == -1) {
6491 if (write (fd, &c, 1) == -1) {
6497 if (close (fd) == -1) {
6502 if (guestfs_add_drive (g, filename) == -1) {
6503 printf ("guestfs_add_drive %s FAILED\n", filename);
6507 if (guestfs_launch (g) == -1) {
6508 printf ("guestfs_launch FAILED\n");
6511 if (guestfs_wait_ready (g) == -1) {
6512 printf ("guestfs_wait_ready FAILED\n");
6519 printf ("%3d/%3d test_set_e2uuid_0\n", test_num, nr_tests);
6520 if (test_set_e2uuid_0 () == -1) {
6521 printf ("test_set_e2uuid_0 FAILED\n");
6525 printf ("%3d/%3d test_set_e2uuid_1\n", test_num, nr_tests);
6526 if (test_set_e2uuid_1 () == -1) {
6527 printf ("test_set_e2uuid_1 FAILED\n");
6531 printf ("%3d/%3d test_set_e2uuid_2\n", test_num, nr_tests);
6532 if (test_set_e2uuid_2 () == -1) {
6533 printf ("test_set_e2uuid_2 FAILED\n");
6537 printf ("%3d/%3d test_set_e2uuid_3\n", test_num, nr_tests);
6538 if (test_set_e2uuid_3 () == -1) {
6539 printf ("test_set_e2uuid_3 FAILED\n");
6543 printf ("%3d/%3d test_set_e2label_0\n", test_num, nr_tests);
6544 if (test_set_e2label_0 () == -1) {
6545 printf ("test_set_e2label_0 FAILED\n");
6549 printf ("%3d/%3d test_pvremove_0\n", test_num, nr_tests);
6550 if (test_pvremove_0 () == -1) {
6551 printf ("test_pvremove_0 FAILED\n");
6555 printf ("%3d/%3d test_pvremove_1\n", test_num, nr_tests);
6556 if (test_pvremove_1 () == -1) {
6557 printf ("test_pvremove_1 FAILED\n");
6561 printf ("%3d/%3d test_pvremove_2\n", test_num, nr_tests);
6562 if (test_pvremove_2 () == -1) {
6563 printf ("test_pvremove_2 FAILED\n");
6567 printf ("%3d/%3d test_vgremove_0\n", test_num, nr_tests);
6568 if (test_vgremove_0 () == -1) {
6569 printf ("test_vgremove_0 FAILED\n");
6573 printf ("%3d/%3d test_vgremove_1\n", test_num, nr_tests);
6574 if (test_vgremove_1 () == -1) {
6575 printf ("test_vgremove_1 FAILED\n");
6579 printf ("%3d/%3d test_lvremove_0\n", test_num, nr_tests);
6580 if (test_lvremove_0 () == -1) {
6581 printf ("test_lvremove_0 FAILED\n");
6585 printf ("%3d/%3d test_lvremove_1\n", test_num, nr_tests);
6586 if (test_lvremove_1 () == -1) {
6587 printf ("test_lvremove_1 FAILED\n");
6591 printf ("%3d/%3d test_lvremove_2\n", test_num, nr_tests);
6592 if (test_lvremove_2 () == -1) {
6593 printf ("test_lvremove_2 FAILED\n");
6597 printf ("%3d/%3d test_mount_ro_0\n", test_num, nr_tests);
6598 if (test_mount_ro_0 () == -1) {
6599 printf ("test_mount_ro_0 FAILED\n");
6603 printf ("%3d/%3d test_mount_ro_1\n", test_num, nr_tests);
6604 if (test_mount_ro_1 () == -1) {
6605 printf ("test_mount_ro_1 FAILED\n");
6609 printf ("%3d/%3d test_tgz_in_0\n", test_num, nr_tests);
6610 if (test_tgz_in_0 () == -1) {
6611 printf ("test_tgz_in_0 FAILED\n");
6615 printf ("%3d/%3d test_tar_in_0\n", test_num, nr_tests);
6616 if (test_tar_in_0 () == -1) {
6617 printf ("test_tar_in_0 FAILED\n");
6621 printf ("%3d/%3d test_checksum_0\n", test_num, nr_tests);
6622 if (test_checksum_0 () == -1) {
6623 printf ("test_checksum_0 FAILED\n");
6627 printf ("%3d/%3d test_checksum_1\n", test_num, nr_tests);
6628 if (test_checksum_1 () == -1) {
6629 printf ("test_checksum_1 FAILED\n");
6633 printf ("%3d/%3d test_checksum_2\n", test_num, nr_tests);
6634 if (test_checksum_2 () == -1) {
6635 printf ("test_checksum_2 FAILED\n");
6639 printf ("%3d/%3d test_checksum_3\n", test_num, nr_tests);
6640 if (test_checksum_3 () == -1) {
6641 printf ("test_checksum_3 FAILED\n");
6645 printf ("%3d/%3d test_checksum_4\n", test_num, nr_tests);
6646 if (test_checksum_4 () == -1) {
6647 printf ("test_checksum_4 FAILED\n");
6651 printf ("%3d/%3d test_checksum_5\n", test_num, nr_tests);
6652 if (test_checksum_5 () == -1) {
6653 printf ("test_checksum_5 FAILED\n");
6657 printf ("%3d/%3d test_checksum_6\n", test_num, nr_tests);
6658 if (test_checksum_6 () == -1) {
6659 printf ("test_checksum_6 FAILED\n");
6663 printf ("%3d/%3d test_checksum_7\n", test_num, nr_tests);
6664 if (test_checksum_7 () == -1) {
6665 printf ("test_checksum_7 FAILED\n");
6669 printf ("%3d/%3d test_download_0\n", test_num, nr_tests);
6670 if (test_download_0 () == -1) {
6671 printf ("test_download_0 FAILED\n");
6675 printf ("%3d/%3d test_upload_0\n", test_num, nr_tests);
6676 if (test_upload_0 () == -1) {
6677 printf ("test_upload_0 FAILED\n");
6681 printf ("%3d/%3d test_blockdev_rereadpt_0\n", test_num, nr_tests);
6682 if (test_blockdev_rereadpt_0 () == -1) {
6683 printf ("test_blockdev_rereadpt_0 FAILED\n");
6687 printf ("%3d/%3d test_blockdev_flushbufs_0\n", test_num, nr_tests);
6688 if (test_blockdev_flushbufs_0 () == -1) {
6689 printf ("test_blockdev_flushbufs_0 FAILED\n");
6693 printf ("%3d/%3d test_blockdev_getsize64_0\n", test_num, nr_tests);
6694 if (test_blockdev_getsize64_0 () == -1) {
6695 printf ("test_blockdev_getsize64_0 FAILED\n");
6699 printf ("%3d/%3d test_blockdev_getsz_0\n", test_num, nr_tests);
6700 if (test_blockdev_getsz_0 () == -1) {
6701 printf ("test_blockdev_getsz_0 FAILED\n");
6705 printf ("%3d/%3d test_blockdev_getbsz_0\n", test_num, nr_tests);
6706 if (test_blockdev_getbsz_0 () == -1) {
6707 printf ("test_blockdev_getbsz_0 FAILED\n");
6711 printf ("%3d/%3d test_blockdev_getss_0\n", test_num, nr_tests);
6712 if (test_blockdev_getss_0 () == -1) {
6713 printf ("test_blockdev_getss_0 FAILED\n");
6717 printf ("%3d/%3d test_blockdev_getro_0\n", test_num, nr_tests);
6718 if (test_blockdev_getro_0 () == -1) {
6719 printf ("test_blockdev_getro_0 FAILED\n");
6723 printf ("%3d/%3d test_blockdev_setrw_0\n", test_num, nr_tests);
6724 if (test_blockdev_setrw_0 () == -1) {
6725 printf ("test_blockdev_setrw_0 FAILED\n");
6729 printf ("%3d/%3d test_blockdev_setro_0\n", test_num, nr_tests);
6730 if (test_blockdev_setro_0 () == -1) {
6731 printf ("test_blockdev_setro_0 FAILED\n");
6735 printf ("%3d/%3d test_statvfs_0\n", test_num, nr_tests);
6736 if (test_statvfs_0 () == -1) {
6737 printf ("test_statvfs_0 FAILED\n");
6741 printf ("%3d/%3d test_lstat_0\n", test_num, nr_tests);
6742 if (test_lstat_0 () == -1) {
6743 printf ("test_lstat_0 FAILED\n");
6747 printf ("%3d/%3d test_stat_0\n", test_num, nr_tests);
6748 if (test_stat_0 () == -1) {
6749 printf ("test_stat_0 FAILED\n");
6753 printf ("%3d/%3d test_file_0\n", test_num, nr_tests);
6754 if (test_file_0 () == -1) {
6755 printf ("test_file_0 FAILED\n");
6759 printf ("%3d/%3d test_file_1\n", test_num, nr_tests);
6760 if (test_file_1 () == -1) {
6761 printf ("test_file_1 FAILED\n");
6765 printf ("%3d/%3d test_file_2\n", test_num, nr_tests);
6766 if (test_file_2 () == -1) {
6767 printf ("test_file_2 FAILED\n");
6771 printf ("%3d/%3d test_umount_all_0\n", test_num, nr_tests);
6772 if (test_umount_all_0 () == -1) {
6773 printf ("test_umount_all_0 FAILED\n");
6777 printf ("%3d/%3d test_umount_all_1\n", test_num, nr_tests);
6778 if (test_umount_all_1 () == -1) {
6779 printf ("test_umount_all_1 FAILED\n");
6783 printf ("%3d/%3d test_mounts_0\n", test_num, nr_tests);
6784 if (test_mounts_0 () == -1) {
6785 printf ("test_mounts_0 FAILED\n");
6789 printf ("%3d/%3d test_umount_0\n", test_num, nr_tests);
6790 if (test_umount_0 () == -1) {
6791 printf ("test_umount_0 FAILED\n");
6795 printf ("%3d/%3d test_umount_1\n", test_num, nr_tests);
6796 if (test_umount_1 () == -1) {
6797 printf ("test_umount_1 FAILED\n");
6801 printf ("%3d/%3d test_write_file_0\n", test_num, nr_tests);
6802 if (test_write_file_0 () == -1) {
6803 printf ("test_write_file_0 FAILED\n");
6807 printf ("%3d/%3d test_write_file_1\n", test_num, nr_tests);
6808 if (test_write_file_1 () == -1) {
6809 printf ("test_write_file_1 FAILED\n");
6813 printf ("%3d/%3d test_write_file_2\n", test_num, nr_tests);
6814 if (test_write_file_2 () == -1) {
6815 printf ("test_write_file_2 FAILED\n");
6819 printf ("%3d/%3d test_write_file_3\n", test_num, nr_tests);
6820 if (test_write_file_3 () == -1) {
6821 printf ("test_write_file_3 FAILED\n");
6825 printf ("%3d/%3d test_write_file_4\n", test_num, nr_tests);
6826 if (test_write_file_4 () == -1) {
6827 printf ("test_write_file_4 FAILED\n");
6831 printf ("%3d/%3d test_write_file_5\n", test_num, nr_tests);
6832 if (test_write_file_5 () == -1) {
6833 printf ("test_write_file_5 FAILED\n");
6837 printf ("%3d/%3d test_mkfs_0\n", test_num, nr_tests);
6838 if (test_mkfs_0 () == -1) {
6839 printf ("test_mkfs_0 FAILED\n");
6843 printf ("%3d/%3d test_lvcreate_0\n", test_num, nr_tests);
6844 if (test_lvcreate_0 () == -1) {
6845 printf ("test_lvcreate_0 FAILED\n");
6849 printf ("%3d/%3d test_vgcreate_0\n", test_num, nr_tests);
6850 if (test_vgcreate_0 () == -1) {
6851 printf ("test_vgcreate_0 FAILED\n");
6855 printf ("%3d/%3d test_pvcreate_0\n", test_num, nr_tests);
6856 if (test_pvcreate_0 () == -1) {
6857 printf ("test_pvcreate_0 FAILED\n");
6861 printf ("%3d/%3d test_is_dir_0\n", test_num, nr_tests);
6862 if (test_is_dir_0 () == -1) {
6863 printf ("test_is_dir_0 FAILED\n");
6867 printf ("%3d/%3d test_is_dir_1\n", test_num, nr_tests);
6868 if (test_is_dir_1 () == -1) {
6869 printf ("test_is_dir_1 FAILED\n");
6873 printf ("%3d/%3d test_is_file_0\n", test_num, nr_tests);
6874 if (test_is_file_0 () == -1) {
6875 printf ("test_is_file_0 FAILED\n");
6879 printf ("%3d/%3d test_is_file_1\n", test_num, nr_tests);
6880 if (test_is_file_1 () == -1) {
6881 printf ("test_is_file_1 FAILED\n");
6885 printf ("%3d/%3d test_exists_0\n", test_num, nr_tests);
6886 if (test_exists_0 () == -1) {
6887 printf ("test_exists_0 FAILED\n");
6891 printf ("%3d/%3d test_exists_1\n", test_num, nr_tests);
6892 if (test_exists_1 () == -1) {
6893 printf ("test_exists_1 FAILED\n");
6897 printf ("%3d/%3d test_mkdir_p_0\n", test_num, nr_tests);
6898 if (test_mkdir_p_0 () == -1) {
6899 printf ("test_mkdir_p_0 FAILED\n");
6903 printf ("%3d/%3d test_mkdir_p_1\n", test_num, nr_tests);
6904 if (test_mkdir_p_1 () == -1) {
6905 printf ("test_mkdir_p_1 FAILED\n");
6909 printf ("%3d/%3d test_mkdir_p_2\n", test_num, nr_tests);
6910 if (test_mkdir_p_2 () == -1) {
6911 printf ("test_mkdir_p_2 FAILED\n");
6915 printf ("%3d/%3d test_mkdir_0\n", test_num, nr_tests);
6916 if (test_mkdir_0 () == -1) {
6917 printf ("test_mkdir_0 FAILED\n");
6921 printf ("%3d/%3d test_mkdir_1\n", test_num, nr_tests);
6922 if (test_mkdir_1 () == -1) {
6923 printf ("test_mkdir_1 FAILED\n");
6927 printf ("%3d/%3d test_rm_rf_0\n", test_num, nr_tests);
6928 if (test_rm_rf_0 () == -1) {
6929 printf ("test_rm_rf_0 FAILED\n");
6933 printf ("%3d/%3d test_rmdir_0\n", test_num, nr_tests);
6934 if (test_rmdir_0 () == -1) {
6935 printf ("test_rmdir_0 FAILED\n");
6939 printf ("%3d/%3d test_rmdir_1\n", test_num, nr_tests);
6940 if (test_rmdir_1 () == -1) {
6941 printf ("test_rmdir_1 FAILED\n");
6945 printf ("%3d/%3d test_rmdir_2\n", test_num, nr_tests);
6946 if (test_rmdir_2 () == -1) {
6947 printf ("test_rmdir_2 FAILED\n");
6951 printf ("%3d/%3d test_rm_0\n", test_num, nr_tests);
6952 if (test_rm_0 () == -1) {
6953 printf ("test_rm_0 FAILED\n");
6957 printf ("%3d/%3d test_rm_1\n", test_num, nr_tests);
6958 if (test_rm_1 () == -1) {
6959 printf ("test_rm_1 FAILED\n");
6963 printf ("%3d/%3d test_rm_2\n", test_num, nr_tests);
6964 if (test_rm_2 () == -1) {
6965 printf ("test_rm_2 FAILED\n");
6969 printf ("%3d/%3d test_read_lines_0\n", test_num, nr_tests);
6970 if (test_read_lines_0 () == -1) {
6971 printf ("test_read_lines_0 FAILED\n");
6975 printf ("%3d/%3d test_read_lines_1\n", test_num, nr_tests);
6976 if (test_read_lines_1 () == -1) {
6977 printf ("test_read_lines_1 FAILED\n");
6981 printf ("%3d/%3d test_lvs_0\n", test_num, nr_tests);
6982 if (test_lvs_0 () == -1) {
6983 printf ("test_lvs_0 FAILED\n");
6987 printf ("%3d/%3d test_lvs_1\n", test_num, nr_tests);
6988 if (test_lvs_1 () == -1) {
6989 printf ("test_lvs_1 FAILED\n");
6993 printf ("%3d/%3d test_vgs_0\n", test_num, nr_tests);
6994 if (test_vgs_0 () == -1) {
6995 printf ("test_vgs_0 FAILED\n");
6999 printf ("%3d/%3d test_vgs_1\n", test_num, nr_tests);
7000 if (test_vgs_1 () == -1) {
7001 printf ("test_vgs_1 FAILED\n");
7005 printf ("%3d/%3d test_pvs_0\n", test_num, nr_tests);
7006 if (test_pvs_0 () == -1) {
7007 printf ("test_pvs_0 FAILED\n");
7011 printf ("%3d/%3d test_pvs_1\n", test_num, nr_tests);
7012 if (test_pvs_1 () == -1) {
7013 printf ("test_pvs_1 FAILED\n");
7017 printf ("%3d/%3d test_list_partitions_0\n", test_num, nr_tests);
7018 if (test_list_partitions_0 () == -1) {
7019 printf ("test_list_partitions_0 FAILED\n");
7023 printf ("%3d/%3d test_list_partitions_1\n", test_num, nr_tests);
7024 if (test_list_partitions_1 () == -1) {
7025 printf ("test_list_partitions_1 FAILED\n");
7029 printf ("%3d/%3d test_list_devices_0\n", test_num, nr_tests);
7030 if (test_list_devices_0 () == -1) {
7031 printf ("test_list_devices_0 FAILED\n");
7035 printf ("%3d/%3d test_ls_0\n", test_num, nr_tests);
7036 if (test_ls_0 () == -1) {
7037 printf ("test_ls_0 FAILED\n");
7041 printf ("%3d/%3d test_cat_0\n", test_num, nr_tests);
7042 if (test_cat_0 () == -1) {
7043 printf ("test_cat_0 FAILED\n");
7047 printf ("%3d/%3d test_touch_0\n", test_num, nr_tests);
7048 if (test_touch_0 () == -1) {
7049 printf ("test_touch_0 FAILED\n");
7053 printf ("%3d/%3d test_sync_0\n", test_num, nr_tests);
7054 if (test_sync_0 () == -1) {
7055 printf ("test_sync_0 FAILED\n");
7059 printf ("%3d/%3d test_mount_0\n", test_num, nr_tests);
7060 if (test_mount_0 () == -1) {
7061 printf ("test_mount_0 FAILED\n");
7066 unlink ("test1.img");
7067 unlink ("test2.img");
7068 unlink ("test3.img");
7071 printf ("***** %d / %d tests FAILED *****\n", failed, nr_tests);