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_mounts_0 (void)
2749 /* InitBasicFS for mounts (0): create ext2 on /dev/sda1 */
2753 r = guestfs_umount_all (g);
2760 r = guestfs_lvm_remove_all (g);
2771 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2778 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2785 r = guestfs_mount (g, "/dev/sda1", "/");
2789 /* TestOutputList for mounts (0) */
2794 r = guestfs_mounts (g);
2798 fprintf (stderr, "test_mounts_0: short list returned from command\n");
2802 if (strcmp (r[0], "/dev/sda1") != 0) {
2803 fprintf (stderr, "test_mounts_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
2807 fprintf (stderr, "test_mounts_0: extra elements returned from command\n");
2811 for (i = 0; r[i] != NULL; ++i)
2818 static int test_umount_0 (void)
2820 /* InitEmpty for umount (0) */
2824 r = guestfs_umount_all (g);
2831 r = guestfs_lvm_remove_all (g);
2835 /* TestOutputList for umount (0) */
2843 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2850 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2857 r = guestfs_mount (g, "/dev/sda1", "/");
2865 r = guestfs_mounts (g);
2869 fprintf (stderr, "test_umount_0: short list returned from command\n");
2873 if (strcmp (r[0], "/dev/sda1") != 0) {
2874 fprintf (stderr, "test_umount_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
2878 fprintf (stderr, "test_umount_0: extra elements returned from command\n");
2882 for (i = 0; r[i] != NULL; ++i)
2889 static int test_umount_1 (void)
2891 /* InitEmpty for umount (1) */
2895 r = guestfs_umount_all (g);
2902 r = guestfs_lvm_remove_all (g);
2906 /* TestOutputList for umount (1) */
2914 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2921 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2928 r = guestfs_mount (g, "/dev/sda1", "/");
2935 r = guestfs_umount (g, "/");
2943 r = guestfs_mounts (g);
2947 fprintf (stderr, "test_umount_1: extra elements returned from command\n");
2951 for (i = 0; r[i] != NULL; ++i)
2958 static int test_write_file_0 (void)
2960 /* InitBasicFS for write_file (0): create ext2 on /dev/sda1 */
2964 r = guestfs_umount_all (g);
2971 r = guestfs_lvm_remove_all (g);
2982 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
2989 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
2996 r = guestfs_mount (g, "/dev/sda1", "/");
3000 /* TestOutput for write_file (0) */
3004 r = guestfs_write_file (g, "/new", "new file contents", 0);
3011 r = guestfs_cat (g, "/new");
3014 if (strcmp (r, "new file contents") != 0) {
3015 fprintf (stderr, "test_write_file_0: expected \"new file contents\" but got \"%s\"\n", r);
3023 static int test_write_file_1 (void)
3025 /* InitBasicFS for write_file (1): create ext2 on /dev/sda1 */
3029 r = guestfs_umount_all (g);
3036 r = guestfs_lvm_remove_all (g);
3047 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3054 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3061 r = guestfs_mount (g, "/dev/sda1", "/");
3065 /* TestOutput for write_file (1) */
3069 r = guestfs_write_file (g, "/new", "\nnew file contents\n", 0);
3076 r = guestfs_cat (g, "/new");
3079 if (strcmp (r, "\nnew file contents\n") != 0) {
3080 fprintf (stderr, "test_write_file_1: expected \"\nnew file contents\n\" but got \"%s\"\n", r);
3088 static int test_write_file_2 (void)
3090 /* InitBasicFS for write_file (2): create ext2 on /dev/sda1 */
3094 r = guestfs_umount_all (g);
3101 r = guestfs_lvm_remove_all (g);
3112 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3119 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3126 r = guestfs_mount (g, "/dev/sda1", "/");
3130 /* TestOutput for write_file (2) */
3134 r = guestfs_write_file (g, "/new", "\n\n", 0);
3141 r = guestfs_cat (g, "/new");
3144 if (strcmp (r, "\n\n") != 0) {
3145 fprintf (stderr, "test_write_file_2: expected \"\n\n\" but got \"%s\"\n", r);
3153 static int test_write_file_3 (void)
3155 /* InitBasicFS for write_file (3): create ext2 on /dev/sda1 */
3159 r = guestfs_umount_all (g);
3166 r = guestfs_lvm_remove_all (g);
3177 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3184 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3191 r = guestfs_mount (g, "/dev/sda1", "/");
3195 /* TestOutput for write_file (3) */
3199 r = guestfs_write_file (g, "/new", "", 0);
3206 r = guestfs_cat (g, "/new");
3209 if (strcmp (r, "") != 0) {
3210 fprintf (stderr, "test_write_file_3: expected \"\" but got \"%s\"\n", r);
3218 static int test_write_file_4 (void)
3220 /* InitBasicFS for write_file (4): create ext2 on /dev/sda1 */
3224 r = guestfs_umount_all (g);
3231 r = guestfs_lvm_remove_all (g);
3242 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3249 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3256 r = guestfs_mount (g, "/dev/sda1", "/");
3260 /* TestOutput for write_file (4) */
3264 r = guestfs_write_file (g, "/new", "\n\n\n", 0);
3271 r = guestfs_cat (g, "/new");
3274 if (strcmp (r, "\n\n\n") != 0) {
3275 fprintf (stderr, "test_write_file_4: expected \"\n\n\n\" but got \"%s\"\n", r);
3283 static int test_write_file_5 (void)
3285 /* InitBasicFS for write_file (5): create ext2 on /dev/sda1 */
3289 r = guestfs_umount_all (g);
3296 r = guestfs_lvm_remove_all (g);
3307 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3314 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3321 r = guestfs_mount (g, "/dev/sda1", "/");
3325 /* TestOutput for write_file (5) */
3329 r = guestfs_write_file (g, "/new", "\n", 0);
3336 r = guestfs_cat (g, "/new");
3339 if (strcmp (r, "\n") != 0) {
3340 fprintf (stderr, "test_write_file_5: expected \"\n\" but got \"%s\"\n", r);
3348 static int test_mkfs_0 (void)
3350 /* InitEmpty for mkfs (0) */
3354 r = guestfs_umount_all (g);
3361 r = guestfs_lvm_remove_all (g);
3365 /* TestOutput for mkfs (0) */
3373 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3380 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3387 r = guestfs_mount (g, "/dev/sda1", "/");
3394 r = guestfs_write_file (g, "/new", "new file contents", 0);
3401 r = guestfs_cat (g, "/new");
3404 if (strcmp (r, "new file contents") != 0) {
3405 fprintf (stderr, "test_mkfs_0: expected \"new file contents\" but got \"%s\"\n", r);
3413 static int test_lvcreate_0 (void)
3415 /* InitEmpty for lvcreate (0) */
3419 r = guestfs_umount_all (g);
3426 r = guestfs_lvm_remove_all (g);
3430 /* TestOutputList for lvcreate (0) */
3440 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3447 r = guestfs_pvcreate (g, "/dev/sda1");
3454 r = guestfs_pvcreate (g, "/dev/sda2");
3461 r = guestfs_pvcreate (g, "/dev/sda3");
3466 char *physvols[] = {
3473 r = guestfs_vgcreate (g, "VG1", physvols);
3478 char *physvols[] = {
3484 r = guestfs_vgcreate (g, "VG2", physvols);
3491 r = guestfs_lvcreate (g, "LV1", "VG1", 50);
3498 r = guestfs_lvcreate (g, "LV2", "VG1", 50);
3505 r = guestfs_lvcreate (g, "LV3", "VG2", 50);
3512 r = guestfs_lvcreate (g, "LV4", "VG2", 50);
3519 r = guestfs_lvcreate (g, "LV5", "VG2", 50);
3527 r = guestfs_lvs (g);
3531 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3535 if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
3536 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
3540 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3544 if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
3545 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
3549 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3553 if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
3554 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
3558 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3562 if (strcmp (r[3], "/dev/VG2/LV4") != 0) {
3563 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV4\" but got \"%s\"\n", r[3]);
3567 fprintf (stderr, "test_lvcreate_0: short list returned from command\n");
3571 if (strcmp (r[4], "/dev/VG2/LV5") != 0) {
3572 fprintf (stderr, "test_lvcreate_0: expected \"/dev/VG2/LV5\" but got \"%s\"\n", r[4]);
3576 fprintf (stderr, "test_lvcreate_0: extra elements returned from command\n");
3580 for (i = 0; r[i] != NULL; ++i)
3587 static int test_vgcreate_0 (void)
3589 /* InitEmpty for vgcreate (0) */
3593 r = guestfs_umount_all (g);
3600 r = guestfs_lvm_remove_all (g);
3604 /* TestOutputList for vgcreate (0) */
3614 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3621 r = guestfs_pvcreate (g, "/dev/sda1");
3628 r = guestfs_pvcreate (g, "/dev/sda2");
3635 r = guestfs_pvcreate (g, "/dev/sda3");
3640 char *physvols[] = {
3647 r = guestfs_vgcreate (g, "VG1", physvols);
3652 char *physvols[] = {
3658 r = guestfs_vgcreate (g, "VG2", physvols);
3666 r = guestfs_vgs (g);
3670 fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
3674 if (strcmp (r[0], "VG1") != 0) {
3675 fprintf (stderr, "test_vgcreate_0: expected \"VG1\" but got \"%s\"\n", r[0]);
3679 fprintf (stderr, "test_vgcreate_0: short list returned from command\n");
3683 if (strcmp (r[1], "VG2") != 0) {
3684 fprintf (stderr, "test_vgcreate_0: expected \"VG2\" but got \"%s\"\n", r[1]);
3688 fprintf (stderr, "test_vgcreate_0: extra elements returned from command\n");
3692 for (i = 0; r[i] != NULL; ++i)
3699 static int test_pvcreate_0 (void)
3701 /* InitEmpty for pvcreate (0) */
3705 r = guestfs_umount_all (g);
3712 r = guestfs_lvm_remove_all (g);
3716 /* TestOutputList for pvcreate (0) */
3726 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3733 r = guestfs_pvcreate (g, "/dev/sda1");
3740 r = guestfs_pvcreate (g, "/dev/sda2");
3747 r = guestfs_pvcreate (g, "/dev/sda3");
3755 r = guestfs_pvs (g);
3759 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3763 if (strcmp (r[0], "/dev/sda1") != 0) {
3764 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
3768 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3772 if (strcmp (r[1], "/dev/sda2") != 0) {
3773 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
3777 fprintf (stderr, "test_pvcreate_0: short list returned from command\n");
3781 if (strcmp (r[2], "/dev/sda3") != 0) {
3782 fprintf (stderr, "test_pvcreate_0: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
3786 fprintf (stderr, "test_pvcreate_0: extra elements returned from command\n");
3790 for (i = 0; r[i] != NULL; ++i)
3797 static int test_is_dir_0 (void)
3799 /* InitBasicFS for is_dir (0): create ext2 on /dev/sda1 */
3803 r = guestfs_umount_all (g);
3810 r = guestfs_lvm_remove_all (g);
3821 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3828 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3835 r = guestfs_mount (g, "/dev/sda1", "/");
3839 /* TestOutputFalse for is_dir (0) */
3843 r = guestfs_touch (g, "/new");
3850 r = guestfs_is_dir (g, "/new");
3854 fprintf (stderr, "test_is_dir_0: expected false, got true\n");
3861 static int test_is_dir_1 (void)
3863 /* InitBasicFS for is_dir (1): create ext2 on /dev/sda1 */
3867 r = guestfs_umount_all (g);
3874 r = guestfs_lvm_remove_all (g);
3885 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3892 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3899 r = guestfs_mount (g, "/dev/sda1", "/");
3903 /* TestOutputTrue for is_dir (1) */
3907 r = guestfs_mkdir (g, "/new");
3914 r = guestfs_is_dir (g, "/new");
3918 fprintf (stderr, "test_is_dir_1: expected true, got false\n");
3925 static int test_is_file_0 (void)
3927 /* InitBasicFS for is_file (0): create ext2 on /dev/sda1 */
3931 r = guestfs_umount_all (g);
3938 r = guestfs_lvm_remove_all (g);
3949 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
3956 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
3963 r = guestfs_mount (g, "/dev/sda1", "/");
3967 /* TestOutputTrue for is_file (0) */
3971 r = guestfs_touch (g, "/new");
3978 r = guestfs_is_file (g, "/new");
3982 fprintf (stderr, "test_is_file_0: expected true, got false\n");
3989 static int test_is_file_1 (void)
3991 /* InitBasicFS for is_file (1): create ext2 on /dev/sda1 */
3995 r = guestfs_umount_all (g);
4002 r = guestfs_lvm_remove_all (g);
4013 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4020 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4027 r = guestfs_mount (g, "/dev/sda1", "/");
4031 /* TestOutputFalse for is_file (1) */
4035 r = guestfs_mkdir (g, "/new");
4042 r = guestfs_is_file (g, "/new");
4046 fprintf (stderr, "test_is_file_1: expected false, got true\n");
4053 static int test_exists_0 (void)
4055 /* InitBasicFS for exists (0): create ext2 on /dev/sda1 */
4059 r = guestfs_umount_all (g);
4066 r = guestfs_lvm_remove_all (g);
4077 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4084 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4091 r = guestfs_mount (g, "/dev/sda1", "/");
4095 /* TestOutputTrue for exists (0) */
4099 r = guestfs_touch (g, "/new");
4106 r = guestfs_exists (g, "/new");
4110 fprintf (stderr, "test_exists_0: expected true, got false\n");
4117 static int test_exists_1 (void)
4119 /* InitBasicFS for exists (1): create ext2 on /dev/sda1 */
4123 r = guestfs_umount_all (g);
4130 r = guestfs_lvm_remove_all (g);
4141 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4148 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4155 r = guestfs_mount (g, "/dev/sda1", "/");
4159 /* TestOutputTrue for exists (1) */
4163 r = guestfs_mkdir (g, "/new");
4170 r = guestfs_exists (g, "/new");
4174 fprintf (stderr, "test_exists_1: expected true, got false\n");
4181 static int test_mkdir_p_0 (void)
4183 /* InitBasicFS for mkdir_p (0): create ext2 on /dev/sda1 */
4187 r = guestfs_umount_all (g);
4194 r = guestfs_lvm_remove_all (g);
4205 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4212 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4219 r = guestfs_mount (g, "/dev/sda1", "/");
4223 /* TestOutputTrue for mkdir_p (0) */
4227 r = guestfs_mkdir_p (g, "/new/foo/bar");
4234 r = guestfs_is_dir (g, "/new/foo/bar");
4238 fprintf (stderr, "test_mkdir_p_0: expected true, got false\n");
4245 static int test_mkdir_p_1 (void)
4247 /* InitBasicFS for mkdir_p (1): create ext2 on /dev/sda1 */
4251 r = guestfs_umount_all (g);
4258 r = guestfs_lvm_remove_all (g);
4269 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4276 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4283 r = guestfs_mount (g, "/dev/sda1", "/");
4287 /* TestOutputTrue for mkdir_p (1) */
4291 r = guestfs_mkdir_p (g, "/new/foo/bar");
4298 r = guestfs_is_dir (g, "/new/foo");
4302 fprintf (stderr, "test_mkdir_p_1: expected true, got false\n");
4309 static int test_mkdir_p_2 (void)
4311 /* InitBasicFS for mkdir_p (2): create ext2 on /dev/sda1 */
4315 r = guestfs_umount_all (g);
4322 r = guestfs_lvm_remove_all (g);
4333 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4340 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4347 r = guestfs_mount (g, "/dev/sda1", "/");
4351 /* TestOutputTrue for mkdir_p (2) */
4355 r = guestfs_mkdir_p (g, "/new/foo/bar");
4362 r = guestfs_is_dir (g, "/new");
4366 fprintf (stderr, "test_mkdir_p_2: expected true, got false\n");
4373 static int test_mkdir_0 (void)
4375 /* InitBasicFS for mkdir (0): create ext2 on /dev/sda1 */
4379 r = guestfs_umount_all (g);
4386 r = guestfs_lvm_remove_all (g);
4397 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4404 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4411 r = guestfs_mount (g, "/dev/sda1", "/");
4415 /* TestOutputTrue for mkdir (0) */
4419 r = guestfs_mkdir (g, "/new");
4426 r = guestfs_is_dir (g, "/new");
4430 fprintf (stderr, "test_mkdir_0: expected true, got false\n");
4437 static int test_mkdir_1 (void)
4439 /* InitBasicFS for mkdir (1): create ext2 on /dev/sda1 */
4443 r = guestfs_umount_all (g);
4450 r = guestfs_lvm_remove_all (g);
4461 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4468 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4475 r = guestfs_mount (g, "/dev/sda1", "/");
4479 /* TestLastFail for mkdir (1) */
4483 r = guestfs_mkdir (g, "/new/foo/bar");
4490 static int test_rm_rf_0 (void)
4492 /* InitBasicFS for rm_rf (0): create ext2 on /dev/sda1 */
4496 r = guestfs_umount_all (g);
4503 r = guestfs_lvm_remove_all (g);
4514 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4521 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4528 r = guestfs_mount (g, "/dev/sda1", "/");
4532 /* TestOutputFalse for rm_rf (0) */
4536 r = guestfs_mkdir (g, "/new");
4543 r = guestfs_mkdir (g, "/new/foo");
4550 r = guestfs_touch (g, "/new/foo/bar");
4557 r = guestfs_rm_rf (g, "/new");
4564 r = guestfs_exists (g, "/new");
4568 fprintf (stderr, "test_rm_rf_0: expected false, got true\n");
4575 static int test_rmdir_0 (void)
4577 /* InitBasicFS for rmdir (0): create ext2 on /dev/sda1 */
4581 r = guestfs_umount_all (g);
4588 r = guestfs_lvm_remove_all (g);
4599 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4606 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4613 r = guestfs_mount (g, "/dev/sda1", "/");
4617 /* TestRun for rmdir (0) */
4621 r = guestfs_mkdir (g, "/new");
4628 r = guestfs_rmdir (g, "/new");
4635 static int test_rmdir_1 (void)
4637 /* InitBasicFS for rmdir (1): create ext2 on /dev/sda1 */
4641 r = guestfs_umount_all (g);
4648 r = guestfs_lvm_remove_all (g);
4659 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4666 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4673 r = guestfs_mount (g, "/dev/sda1", "/");
4677 /* TestLastFail for rmdir (1) */
4681 r = guestfs_rmdir (g, "/new");
4688 static int test_rmdir_2 (void)
4690 /* InitBasicFS for rmdir (2): create ext2 on /dev/sda1 */
4694 r = guestfs_umount_all (g);
4701 r = guestfs_lvm_remove_all (g);
4712 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
4719 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
4726 r = guestfs_mount (g, "/dev/sda1", "/");
4730 /* TestLastFail for rmdir (2) */
4734 r = guestfs_touch (g, "/new");
4741 r = guestfs_rmdir (g, "/new");
4748 static int test_rm_0 (void)
4750 /* InitBasicFS for rm (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 rm (0) */
4794 r = guestfs_touch (g, "/new");
4801 r = guestfs_rm (g, "/new");
4808 static int test_rm_1 (void)
4810 /* InitBasicFS for rm (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 rm (1) */
4854 r = guestfs_rm (g, "/new");
4861 static int test_rm_2 (void)
4863 /* InitBasicFS for rm (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 rm (2) */
4907 r = guestfs_mkdir (g, "/new");
4914 r = guestfs_rm (g, "/new");
4921 static int test_read_lines_0 (void)
4923 /* InitBasicFS for read_lines (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 /* TestOutputList for read_lines (0) */
4967 r = guestfs_write_file (g, "/new", "line1\r\nline2\nline3", 0);
4975 r = guestfs_read_lines (g, "/new");
4979 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
4983 if (strcmp (r[0], "line1") != 0) {
4984 fprintf (stderr, "test_read_lines_0: expected \"line1\" but got \"%s\"\n", r[0]);
4988 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
4992 if (strcmp (r[1], "line2") != 0) {
4993 fprintf (stderr, "test_read_lines_0: expected \"line2\" but got \"%s\"\n", r[1]);
4997 fprintf (stderr, "test_read_lines_0: short list returned from command\n");
5001 if (strcmp (r[2], "line3") != 0) {
5002 fprintf (stderr, "test_read_lines_0: expected \"line3\" but got \"%s\"\n", r[2]);
5006 fprintf (stderr, "test_read_lines_0: extra elements returned from command\n");
5010 for (i = 0; r[i] != NULL; ++i)
5017 static int test_read_lines_1 (void)
5019 /* InitBasicFS for read_lines (1): create ext2 on /dev/sda1 */
5023 r = guestfs_umount_all (g);
5030 r = guestfs_lvm_remove_all (g);
5041 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5048 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5055 r = guestfs_mount (g, "/dev/sda1", "/");
5059 /* TestOutputList for read_lines (1) */
5063 r = guestfs_write_file (g, "/new", "", 0);
5071 r = guestfs_read_lines (g, "/new");
5075 fprintf (stderr, "test_read_lines_1: extra elements returned from command\n");
5079 for (i = 0; r[i] != NULL; ++i)
5086 static int test_lvs_0 (void)
5088 /* InitBasicFSonLVM for lvs (0): create ext2 on /dev/VG/LV */
5092 r = guestfs_umount_all (g);
5099 r = guestfs_lvm_remove_all (g);
5110 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5117 r = guestfs_pvcreate (g, "/dev/sda1");
5122 char *physvols[] = {
5128 r = guestfs_vgcreate (g, "VG", physvols);
5135 r = guestfs_lvcreate (g, "LV", "VG", 8);
5142 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5149 r = guestfs_mount (g, "/dev/VG/LV", "/");
5153 /* TestOutputList for lvs (0) */
5158 r = guestfs_lvs (g);
5162 fprintf (stderr, "test_lvs_0: short list returned from command\n");
5166 if (strcmp (r[0], "/dev/VG/LV") != 0) {
5167 fprintf (stderr, "test_lvs_0: expected \"/dev/VG/LV\" but got \"%s\"\n", r[0]);
5171 fprintf (stderr, "test_lvs_0: extra elements returned from command\n");
5175 for (i = 0; r[i] != NULL; ++i)
5182 static int test_lvs_1 (void)
5184 /* InitEmpty for lvs (1) */
5188 r = guestfs_umount_all (g);
5195 r = guestfs_lvm_remove_all (g);
5199 /* TestOutputList for lvs (1) */
5209 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5216 r = guestfs_pvcreate (g, "/dev/sda1");
5223 r = guestfs_pvcreate (g, "/dev/sda2");
5230 r = guestfs_pvcreate (g, "/dev/sda3");
5235 char *physvols[] = {
5242 r = guestfs_vgcreate (g, "VG1", physvols);
5247 char *physvols[] = {
5253 r = guestfs_vgcreate (g, "VG2", physvols);
5260 r = guestfs_lvcreate (g, "LV1", "VG1", 50);
5267 r = guestfs_lvcreate (g, "LV2", "VG1", 50);
5274 r = guestfs_lvcreate (g, "LV3", "VG2", 50);
5282 r = guestfs_lvs (g);
5286 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5290 if (strcmp (r[0], "/dev/VG1/LV1") != 0) {
5291 fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV1\" but got \"%s\"\n", r[0]);
5295 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5299 if (strcmp (r[1], "/dev/VG1/LV2") != 0) {
5300 fprintf (stderr, "test_lvs_1: expected \"/dev/VG1/LV2\" but got \"%s\"\n", r[1]);
5304 fprintf (stderr, "test_lvs_1: short list returned from command\n");
5308 if (strcmp (r[2], "/dev/VG2/LV3") != 0) {
5309 fprintf (stderr, "test_lvs_1: expected \"/dev/VG2/LV3\" but got \"%s\"\n", r[2]);
5313 fprintf (stderr, "test_lvs_1: extra elements returned from command\n");
5317 for (i = 0; r[i] != NULL; ++i)
5324 static int test_vgs_0 (void)
5326 /* InitBasicFSonLVM for vgs (0): create ext2 on /dev/VG/LV */
5330 r = guestfs_umount_all (g);
5337 r = guestfs_lvm_remove_all (g);
5348 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5355 r = guestfs_pvcreate (g, "/dev/sda1");
5360 char *physvols[] = {
5366 r = guestfs_vgcreate (g, "VG", physvols);
5373 r = guestfs_lvcreate (g, "LV", "VG", 8);
5380 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5387 r = guestfs_mount (g, "/dev/VG/LV", "/");
5391 /* TestOutputList for vgs (0) */
5396 r = guestfs_vgs (g);
5400 fprintf (stderr, "test_vgs_0: short list returned from command\n");
5404 if (strcmp (r[0], "VG") != 0) {
5405 fprintf (stderr, "test_vgs_0: expected \"VG\" but got \"%s\"\n", r[0]);
5409 fprintf (stderr, "test_vgs_0: extra elements returned from command\n");
5413 for (i = 0; r[i] != NULL; ++i)
5420 static int test_vgs_1 (void)
5422 /* InitEmpty for vgs (1) */
5426 r = guestfs_umount_all (g);
5433 r = guestfs_lvm_remove_all (g);
5437 /* TestOutputList for vgs (1) */
5447 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5454 r = guestfs_pvcreate (g, "/dev/sda1");
5461 r = guestfs_pvcreate (g, "/dev/sda2");
5468 r = guestfs_pvcreate (g, "/dev/sda3");
5473 char *physvols[] = {
5480 r = guestfs_vgcreate (g, "VG1", physvols);
5485 char *physvols[] = {
5491 r = guestfs_vgcreate (g, "VG2", physvols);
5499 r = guestfs_vgs (g);
5503 fprintf (stderr, "test_vgs_1: short list returned from command\n");
5507 if (strcmp (r[0], "VG1") != 0) {
5508 fprintf (stderr, "test_vgs_1: expected \"VG1\" but got \"%s\"\n", r[0]);
5512 fprintf (stderr, "test_vgs_1: short list returned from command\n");
5516 if (strcmp (r[1], "VG2") != 0) {
5517 fprintf (stderr, "test_vgs_1: expected \"VG2\" but got \"%s\"\n", r[1]);
5521 fprintf (stderr, "test_vgs_1: extra elements returned from command\n");
5525 for (i = 0; r[i] != NULL; ++i)
5532 static int test_pvs_0 (void)
5534 /* InitBasicFSonLVM for pvs (0): create ext2 on /dev/VG/LV */
5538 r = guestfs_umount_all (g);
5545 r = guestfs_lvm_remove_all (g);
5556 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5563 r = guestfs_pvcreate (g, "/dev/sda1");
5568 char *physvols[] = {
5574 r = guestfs_vgcreate (g, "VG", physvols);
5581 r = guestfs_lvcreate (g, "LV", "VG", 8);
5588 r = guestfs_mkfs (g, "ext2", "/dev/VG/LV");
5595 r = guestfs_mount (g, "/dev/VG/LV", "/");
5599 /* TestOutputList for pvs (0) */
5604 r = guestfs_pvs (g);
5608 fprintf (stderr, "test_pvs_0: short list returned from command\n");
5612 if (strcmp (r[0], "/dev/sda1") != 0) {
5613 fprintf (stderr, "test_pvs_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5617 fprintf (stderr, "test_pvs_0: extra elements returned from command\n");
5621 for (i = 0; r[i] != NULL; ++i)
5628 static int test_pvs_1 (void)
5630 /* InitEmpty for pvs (1) */
5634 r = guestfs_umount_all (g);
5641 r = guestfs_lvm_remove_all (g);
5645 /* TestOutputList for pvs (1) */
5655 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5662 r = guestfs_pvcreate (g, "/dev/sda1");
5669 r = guestfs_pvcreate (g, "/dev/sda2");
5676 r = guestfs_pvcreate (g, "/dev/sda3");
5684 r = guestfs_pvs (g);
5688 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5692 if (strcmp (r[0], "/dev/sda1") != 0) {
5693 fprintf (stderr, "test_pvs_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5697 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5701 if (strcmp (r[1], "/dev/sda2") != 0) {
5702 fprintf (stderr, "test_pvs_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
5706 fprintf (stderr, "test_pvs_1: short list returned from command\n");
5710 if (strcmp (r[2], "/dev/sda3") != 0) {
5711 fprintf (stderr, "test_pvs_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
5715 fprintf (stderr, "test_pvs_1: extra elements returned from command\n");
5719 for (i = 0; r[i] != NULL; ++i)
5726 static int test_list_partitions_0 (void)
5728 /* InitBasicFS for list_partitions (0): create ext2 on /dev/sda1 */
5732 r = guestfs_umount_all (g);
5739 r = guestfs_lvm_remove_all (g);
5750 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5757 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5764 r = guestfs_mount (g, "/dev/sda1", "/");
5768 /* TestOutputList for list_partitions (0) */
5773 r = guestfs_list_partitions (g);
5777 fprintf (stderr, "test_list_partitions_0: short list returned from command\n");
5781 if (strcmp (r[0], "/dev/sda1") != 0) {
5782 fprintf (stderr, "test_list_partitions_0: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5786 fprintf (stderr, "test_list_partitions_0: extra elements returned from command\n");
5790 for (i = 0; r[i] != NULL; ++i)
5797 static int test_list_partitions_1 (void)
5799 /* InitEmpty for list_partitions (1) */
5803 r = guestfs_umount_all (g);
5810 r = guestfs_lvm_remove_all (g);
5814 /* TestOutputList for list_partitions (1) */
5824 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5832 r = guestfs_list_partitions (g);
5836 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
5840 if (strcmp (r[0], "/dev/sda1") != 0) {
5841 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda1\" but got \"%s\"\n", r[0]);
5845 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
5849 if (strcmp (r[1], "/dev/sda2") != 0) {
5850 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda2\" but got \"%s\"\n", r[1]);
5854 fprintf (stderr, "test_list_partitions_1: short list returned from command\n");
5858 if (strcmp (r[2], "/dev/sda3") != 0) {
5859 fprintf (stderr, "test_list_partitions_1: expected \"/dev/sda3\" but got \"%s\"\n", r[2]);
5863 fprintf (stderr, "test_list_partitions_1: extra elements returned from command\n");
5867 for (i = 0; r[i] != NULL; ++i)
5874 static int test_list_devices_0 (void)
5876 /* InitEmpty for list_devices (0) */
5880 r = guestfs_umount_all (g);
5887 r = guestfs_lvm_remove_all (g);
5891 /* TestOutputList for list_devices (0) */
5896 r = guestfs_list_devices (g);
5900 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
5904 if (strcmp (r[0], "/dev/sda") != 0) {
5905 fprintf (stderr, "test_list_devices_0: expected \"/dev/sda\" but got \"%s\"\n", r[0]);
5909 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
5913 if (strcmp (r[1], "/dev/sdb") != 0) {
5914 fprintf (stderr, "test_list_devices_0: expected \"/dev/sdb\" but got \"%s\"\n", r[1]);
5918 fprintf (stderr, "test_list_devices_0: short list returned from command\n");
5922 if (strcmp (r[2], "/dev/sdc") != 0) {
5923 fprintf (stderr, "test_list_devices_0: expected \"/dev/sdc\" but got \"%s\"\n", r[2]);
5927 fprintf (stderr, "test_list_devices_0: extra elements returned from command\n");
5931 for (i = 0; r[i] != NULL; ++i)
5938 static int test_ls_0 (void)
5940 /* InitBasicFS for ls (0): create ext2 on /dev/sda1 */
5944 r = guestfs_umount_all (g);
5951 r = guestfs_lvm_remove_all (g);
5962 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
5969 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
5976 r = guestfs_mount (g, "/dev/sda1", "/");
5980 /* TestOutputList for ls (0) */
5984 r = guestfs_touch (g, "/new");
5991 r = guestfs_touch (g, "/newer");
5998 r = guestfs_touch (g, "/newest");
6006 r = guestfs_ls (g, "/");
6010 fprintf (stderr, "test_ls_0: short list returned from command\n");
6014 if (strcmp (r[0], "lost+found") != 0) {
6015 fprintf (stderr, "test_ls_0: expected \"lost+found\" but got \"%s\"\n", r[0]);
6019 fprintf (stderr, "test_ls_0: short list returned from command\n");
6023 if (strcmp (r[1], "new") != 0) {
6024 fprintf (stderr, "test_ls_0: expected \"new\" but got \"%s\"\n", r[1]);
6028 fprintf (stderr, "test_ls_0: short list returned from command\n");
6032 if (strcmp (r[2], "newer") != 0) {
6033 fprintf (stderr, "test_ls_0: expected \"newer\" but got \"%s\"\n", r[2]);
6037 fprintf (stderr, "test_ls_0: short list returned from command\n");
6041 if (strcmp (r[3], "newest") != 0) {
6042 fprintf (stderr, "test_ls_0: expected \"newest\" but got \"%s\"\n", r[3]);
6046 fprintf (stderr, "test_ls_0: extra elements returned from command\n");
6050 for (i = 0; r[i] != NULL; ++i)
6057 static int test_cat_0 (void)
6059 /* InitBasicFS for cat (0): create ext2 on /dev/sda1 */
6063 r = guestfs_umount_all (g);
6070 r = guestfs_lvm_remove_all (g);
6081 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6088 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6095 r = guestfs_mount (g, "/dev/sda1", "/");
6099 /* TestOutput for cat (0) */
6103 r = guestfs_write_file (g, "/new", "new file contents", 0);
6110 r = guestfs_cat (g, "/new");
6113 if (strcmp (r, "new file contents") != 0) {
6114 fprintf (stderr, "test_cat_0: expected \"new file contents\" but got \"%s\"\n", r);
6122 static int test_touch_0 (void)
6124 /* InitBasicFS for touch (0): create ext2 on /dev/sda1 */
6128 r = guestfs_umount_all (g);
6135 r = guestfs_lvm_remove_all (g);
6146 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6153 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6160 r = guestfs_mount (g, "/dev/sda1", "/");
6164 /* TestOutputTrue for touch (0) */
6168 r = guestfs_touch (g, "/new");
6175 r = guestfs_exists (g, "/new");
6179 fprintf (stderr, "test_touch_0: expected true, got false\n");
6186 static int test_sync_0 (void)
6188 /* InitEmpty for sync (0) */
6192 r = guestfs_umount_all (g);
6199 r = guestfs_lvm_remove_all (g);
6203 /* TestRun for sync (0) */
6207 r = guestfs_sync (g);
6214 static int test_mount_0 (void)
6216 /* InitEmpty for mount (0) */
6220 r = guestfs_umount_all (g);
6227 r = guestfs_lvm_remove_all (g);
6231 /* TestOutput for mount (0) */
6239 r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines);
6246 r = guestfs_mkfs (g, "ext2", "/dev/sda1");
6253 r = guestfs_mount (g, "/dev/sda1", "/");
6260 r = guestfs_write_file (g, "/new", "new file contents", 0);
6267 r = guestfs_cat (g, "/new");
6270 if (strcmp (r, "new file contents") != 0) {
6271 fprintf (stderr, "test_mount_0: expected \"new file contents\" but got \"%s\"\n", r);
6279 int main (int argc, char *argv[])
6284 const char *filename;
6286 int nr_tests, test_num = 0;
6288 no_test_warnings ();
6290 g = guestfs_create ();
6292 printf ("guestfs_create FAILED\n");
6296 guestfs_set_error_handler (g, print_error, NULL);
6298 srcdir = getenv ("srcdir");
6299 if (!srcdir) srcdir = ".";
6301 guestfs_set_path (g, ".");
6303 filename = "test1.img";
6304 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6309 if (lseek (fd, 524288000, SEEK_SET) == -1) {
6315 if (write (fd, &c, 1) == -1) {
6321 if (close (fd) == -1) {
6326 if (guestfs_add_drive (g, filename) == -1) {
6327 printf ("guestfs_add_drive %s FAILED\n", filename);
6331 filename = "test2.img";
6332 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6337 if (lseek (fd, 52428800, SEEK_SET) == -1) {
6343 if (write (fd, &c, 1) == -1) {
6349 if (close (fd) == -1) {
6354 if (guestfs_add_drive (g, filename) == -1) {
6355 printf ("guestfs_add_drive %s FAILED\n", filename);
6359 filename = "test3.img";
6360 fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
6365 if (lseek (fd, 10485760, SEEK_SET) == -1) {
6371 if (write (fd, &c, 1) == -1) {
6377 if (close (fd) == -1) {
6382 if (guestfs_add_drive (g, filename) == -1) {
6383 printf ("guestfs_add_drive %s FAILED\n", filename);
6387 if (guestfs_launch (g) == -1) {
6388 printf ("guestfs_launch FAILED\n");
6391 if (guestfs_wait_ready (g) == -1) {
6392 printf ("guestfs_wait_ready FAILED\n");
6399 printf ("%3d/%3d test_set_e2uuid_0\n", test_num, nr_tests);
6400 if (test_set_e2uuid_0 () == -1) {
6401 printf ("test_set_e2uuid_0 FAILED\n");
6405 printf ("%3d/%3d test_set_e2uuid_1\n", test_num, nr_tests);
6406 if (test_set_e2uuid_1 () == -1) {
6407 printf ("test_set_e2uuid_1 FAILED\n");
6411 printf ("%3d/%3d test_set_e2uuid_2\n", test_num, nr_tests);
6412 if (test_set_e2uuid_2 () == -1) {
6413 printf ("test_set_e2uuid_2 FAILED\n");
6417 printf ("%3d/%3d test_set_e2uuid_3\n", test_num, nr_tests);
6418 if (test_set_e2uuid_3 () == -1) {
6419 printf ("test_set_e2uuid_3 FAILED\n");
6423 printf ("%3d/%3d test_set_e2label_0\n", test_num, nr_tests);
6424 if (test_set_e2label_0 () == -1) {
6425 printf ("test_set_e2label_0 FAILED\n");
6429 printf ("%3d/%3d test_pvremove_0\n", test_num, nr_tests);
6430 if (test_pvremove_0 () == -1) {
6431 printf ("test_pvremove_0 FAILED\n");
6435 printf ("%3d/%3d test_pvremove_1\n", test_num, nr_tests);
6436 if (test_pvremove_1 () == -1) {
6437 printf ("test_pvremove_1 FAILED\n");
6441 printf ("%3d/%3d test_pvremove_2\n", test_num, nr_tests);
6442 if (test_pvremove_2 () == -1) {
6443 printf ("test_pvremove_2 FAILED\n");
6447 printf ("%3d/%3d test_vgremove_0\n", test_num, nr_tests);
6448 if (test_vgremove_0 () == -1) {
6449 printf ("test_vgremove_0 FAILED\n");
6453 printf ("%3d/%3d test_vgremove_1\n", test_num, nr_tests);
6454 if (test_vgremove_1 () == -1) {
6455 printf ("test_vgremove_1 FAILED\n");
6459 printf ("%3d/%3d test_lvremove_0\n", test_num, nr_tests);
6460 if (test_lvremove_0 () == -1) {
6461 printf ("test_lvremove_0 FAILED\n");
6465 printf ("%3d/%3d test_lvremove_1\n", test_num, nr_tests);
6466 if (test_lvremove_1 () == -1) {
6467 printf ("test_lvremove_1 FAILED\n");
6471 printf ("%3d/%3d test_lvremove_2\n", test_num, nr_tests);
6472 if (test_lvremove_2 () == -1) {
6473 printf ("test_lvremove_2 FAILED\n");
6477 printf ("%3d/%3d test_mount_ro_0\n", test_num, nr_tests);
6478 if (test_mount_ro_0 () == -1) {
6479 printf ("test_mount_ro_0 FAILED\n");
6483 printf ("%3d/%3d test_mount_ro_1\n", test_num, nr_tests);
6484 if (test_mount_ro_1 () == -1) {
6485 printf ("test_mount_ro_1 FAILED\n");
6489 printf ("%3d/%3d test_tgz_in_0\n", test_num, nr_tests);
6490 if (test_tgz_in_0 () == -1) {
6491 printf ("test_tgz_in_0 FAILED\n");
6495 printf ("%3d/%3d test_tar_in_0\n", test_num, nr_tests);
6496 if (test_tar_in_0 () == -1) {
6497 printf ("test_tar_in_0 FAILED\n");
6501 printf ("%3d/%3d test_checksum_0\n", test_num, nr_tests);
6502 if (test_checksum_0 () == -1) {
6503 printf ("test_checksum_0 FAILED\n");
6507 printf ("%3d/%3d test_checksum_1\n", test_num, nr_tests);
6508 if (test_checksum_1 () == -1) {
6509 printf ("test_checksum_1 FAILED\n");
6513 printf ("%3d/%3d test_checksum_2\n", test_num, nr_tests);
6514 if (test_checksum_2 () == -1) {
6515 printf ("test_checksum_2 FAILED\n");
6519 printf ("%3d/%3d test_checksum_3\n", test_num, nr_tests);
6520 if (test_checksum_3 () == -1) {
6521 printf ("test_checksum_3 FAILED\n");
6525 printf ("%3d/%3d test_checksum_4\n", test_num, nr_tests);
6526 if (test_checksum_4 () == -1) {
6527 printf ("test_checksum_4 FAILED\n");
6531 printf ("%3d/%3d test_checksum_5\n", test_num, nr_tests);
6532 if (test_checksum_5 () == -1) {
6533 printf ("test_checksum_5 FAILED\n");
6537 printf ("%3d/%3d test_checksum_6\n", test_num, nr_tests);
6538 if (test_checksum_6 () == -1) {
6539 printf ("test_checksum_6 FAILED\n");
6543 printf ("%3d/%3d test_checksum_7\n", test_num, nr_tests);
6544 if (test_checksum_7 () == -1) {
6545 printf ("test_checksum_7 FAILED\n");
6549 printf ("%3d/%3d test_download_0\n", test_num, nr_tests);
6550 if (test_download_0 () == -1) {
6551 printf ("test_download_0 FAILED\n");
6555 printf ("%3d/%3d test_upload_0\n", test_num, nr_tests);
6556 if (test_upload_0 () == -1) {
6557 printf ("test_upload_0 FAILED\n");
6561 printf ("%3d/%3d test_blockdev_rereadpt_0\n", test_num, nr_tests);
6562 if (test_blockdev_rereadpt_0 () == -1) {
6563 printf ("test_blockdev_rereadpt_0 FAILED\n");
6567 printf ("%3d/%3d test_blockdev_flushbufs_0\n", test_num, nr_tests);
6568 if (test_blockdev_flushbufs_0 () == -1) {
6569 printf ("test_blockdev_flushbufs_0 FAILED\n");
6573 printf ("%3d/%3d test_blockdev_getsize64_0\n", test_num, nr_tests);
6574 if (test_blockdev_getsize64_0 () == -1) {
6575 printf ("test_blockdev_getsize64_0 FAILED\n");
6579 printf ("%3d/%3d test_blockdev_getsz_0\n", test_num, nr_tests);
6580 if (test_blockdev_getsz_0 () == -1) {
6581 printf ("test_blockdev_getsz_0 FAILED\n");
6585 printf ("%3d/%3d test_blockdev_getbsz_0\n", test_num, nr_tests);
6586 if (test_blockdev_getbsz_0 () == -1) {
6587 printf ("test_blockdev_getbsz_0 FAILED\n");
6591 printf ("%3d/%3d test_blockdev_getss_0\n", test_num, nr_tests);
6592 if (test_blockdev_getss_0 () == -1) {
6593 printf ("test_blockdev_getss_0 FAILED\n");
6597 printf ("%3d/%3d test_blockdev_getro_0\n", test_num, nr_tests);
6598 if (test_blockdev_getro_0 () == -1) {
6599 printf ("test_blockdev_getro_0 FAILED\n");
6603 printf ("%3d/%3d test_blockdev_setrw_0\n", test_num, nr_tests);
6604 if (test_blockdev_setrw_0 () == -1) {
6605 printf ("test_blockdev_setrw_0 FAILED\n");
6609 printf ("%3d/%3d test_blockdev_setro_0\n", test_num, nr_tests);
6610 if (test_blockdev_setro_0 () == -1) {
6611 printf ("test_blockdev_setro_0 FAILED\n");
6615 printf ("%3d/%3d test_statvfs_0\n", test_num, nr_tests);
6616 if (test_statvfs_0 () == -1) {
6617 printf ("test_statvfs_0 FAILED\n");
6621 printf ("%3d/%3d test_lstat_0\n", test_num, nr_tests);
6622 if (test_lstat_0 () == -1) {
6623 printf ("test_lstat_0 FAILED\n");
6627 printf ("%3d/%3d test_stat_0\n", test_num, nr_tests);
6628 if (test_stat_0 () == -1) {
6629 printf ("test_stat_0 FAILED\n");
6633 printf ("%3d/%3d test_file_0\n", test_num, nr_tests);
6634 if (test_file_0 () == -1) {
6635 printf ("test_file_0 FAILED\n");
6639 printf ("%3d/%3d test_file_1\n", test_num, nr_tests);
6640 if (test_file_1 () == -1) {
6641 printf ("test_file_1 FAILED\n");
6645 printf ("%3d/%3d test_file_2\n", test_num, nr_tests);
6646 if (test_file_2 () == -1) {
6647 printf ("test_file_2 FAILED\n");
6651 printf ("%3d/%3d test_umount_all_0\n", test_num, nr_tests);
6652 if (test_umount_all_0 () == -1) {
6653 printf ("test_umount_all_0 FAILED\n");
6657 printf ("%3d/%3d test_mounts_0\n", test_num, nr_tests);
6658 if (test_mounts_0 () == -1) {
6659 printf ("test_mounts_0 FAILED\n");
6663 printf ("%3d/%3d test_umount_0\n", test_num, nr_tests);
6664 if (test_umount_0 () == -1) {
6665 printf ("test_umount_0 FAILED\n");
6669 printf ("%3d/%3d test_umount_1\n", test_num, nr_tests);
6670 if (test_umount_1 () == -1) {
6671 printf ("test_umount_1 FAILED\n");
6675 printf ("%3d/%3d test_write_file_0\n", test_num, nr_tests);
6676 if (test_write_file_0 () == -1) {
6677 printf ("test_write_file_0 FAILED\n");
6681 printf ("%3d/%3d test_write_file_1\n", test_num, nr_tests);
6682 if (test_write_file_1 () == -1) {
6683 printf ("test_write_file_1 FAILED\n");
6687 printf ("%3d/%3d test_write_file_2\n", test_num, nr_tests);
6688 if (test_write_file_2 () == -1) {
6689 printf ("test_write_file_2 FAILED\n");
6693 printf ("%3d/%3d test_write_file_3\n", test_num, nr_tests);
6694 if (test_write_file_3 () == -1) {
6695 printf ("test_write_file_3 FAILED\n");
6699 printf ("%3d/%3d test_write_file_4\n", test_num, nr_tests);
6700 if (test_write_file_4 () == -1) {
6701 printf ("test_write_file_4 FAILED\n");
6705 printf ("%3d/%3d test_write_file_5\n", test_num, nr_tests);
6706 if (test_write_file_5 () == -1) {
6707 printf ("test_write_file_5 FAILED\n");
6711 printf ("%3d/%3d test_mkfs_0\n", test_num, nr_tests);
6712 if (test_mkfs_0 () == -1) {
6713 printf ("test_mkfs_0 FAILED\n");
6717 printf ("%3d/%3d test_lvcreate_0\n", test_num, nr_tests);
6718 if (test_lvcreate_0 () == -1) {
6719 printf ("test_lvcreate_0 FAILED\n");
6723 printf ("%3d/%3d test_vgcreate_0\n", test_num, nr_tests);
6724 if (test_vgcreate_0 () == -1) {
6725 printf ("test_vgcreate_0 FAILED\n");
6729 printf ("%3d/%3d test_pvcreate_0\n", test_num, nr_tests);
6730 if (test_pvcreate_0 () == -1) {
6731 printf ("test_pvcreate_0 FAILED\n");
6735 printf ("%3d/%3d test_is_dir_0\n", test_num, nr_tests);
6736 if (test_is_dir_0 () == -1) {
6737 printf ("test_is_dir_0 FAILED\n");
6741 printf ("%3d/%3d test_is_dir_1\n", test_num, nr_tests);
6742 if (test_is_dir_1 () == -1) {
6743 printf ("test_is_dir_1 FAILED\n");
6747 printf ("%3d/%3d test_is_file_0\n", test_num, nr_tests);
6748 if (test_is_file_0 () == -1) {
6749 printf ("test_is_file_0 FAILED\n");
6753 printf ("%3d/%3d test_is_file_1\n", test_num, nr_tests);
6754 if (test_is_file_1 () == -1) {
6755 printf ("test_is_file_1 FAILED\n");
6759 printf ("%3d/%3d test_exists_0\n", test_num, nr_tests);
6760 if (test_exists_0 () == -1) {
6761 printf ("test_exists_0 FAILED\n");
6765 printf ("%3d/%3d test_exists_1\n", test_num, nr_tests);
6766 if (test_exists_1 () == -1) {
6767 printf ("test_exists_1 FAILED\n");
6771 printf ("%3d/%3d test_mkdir_p_0\n", test_num, nr_tests);
6772 if (test_mkdir_p_0 () == -1) {
6773 printf ("test_mkdir_p_0 FAILED\n");
6777 printf ("%3d/%3d test_mkdir_p_1\n", test_num, nr_tests);
6778 if (test_mkdir_p_1 () == -1) {
6779 printf ("test_mkdir_p_1 FAILED\n");
6783 printf ("%3d/%3d test_mkdir_p_2\n", test_num, nr_tests);
6784 if (test_mkdir_p_2 () == -1) {
6785 printf ("test_mkdir_p_2 FAILED\n");
6789 printf ("%3d/%3d test_mkdir_0\n", test_num, nr_tests);
6790 if (test_mkdir_0 () == -1) {
6791 printf ("test_mkdir_0 FAILED\n");
6795 printf ("%3d/%3d test_mkdir_1\n", test_num, nr_tests);
6796 if (test_mkdir_1 () == -1) {
6797 printf ("test_mkdir_1 FAILED\n");
6801 printf ("%3d/%3d test_rm_rf_0\n", test_num, nr_tests);
6802 if (test_rm_rf_0 () == -1) {
6803 printf ("test_rm_rf_0 FAILED\n");
6807 printf ("%3d/%3d test_rmdir_0\n", test_num, nr_tests);
6808 if (test_rmdir_0 () == -1) {
6809 printf ("test_rmdir_0 FAILED\n");
6813 printf ("%3d/%3d test_rmdir_1\n", test_num, nr_tests);
6814 if (test_rmdir_1 () == -1) {
6815 printf ("test_rmdir_1 FAILED\n");
6819 printf ("%3d/%3d test_rmdir_2\n", test_num, nr_tests);
6820 if (test_rmdir_2 () == -1) {
6821 printf ("test_rmdir_2 FAILED\n");
6825 printf ("%3d/%3d test_rm_0\n", test_num, nr_tests);
6826 if (test_rm_0 () == -1) {
6827 printf ("test_rm_0 FAILED\n");
6831 printf ("%3d/%3d test_rm_1\n", test_num, nr_tests);
6832 if (test_rm_1 () == -1) {
6833 printf ("test_rm_1 FAILED\n");
6837 printf ("%3d/%3d test_rm_2\n", test_num, nr_tests);
6838 if (test_rm_2 () == -1) {
6839 printf ("test_rm_2 FAILED\n");
6843 printf ("%3d/%3d test_read_lines_0\n", test_num, nr_tests);
6844 if (test_read_lines_0 () == -1) {
6845 printf ("test_read_lines_0 FAILED\n");
6849 printf ("%3d/%3d test_read_lines_1\n", test_num, nr_tests);
6850 if (test_read_lines_1 () == -1) {
6851 printf ("test_read_lines_1 FAILED\n");
6855 printf ("%3d/%3d test_lvs_0\n", test_num, nr_tests);
6856 if (test_lvs_0 () == -1) {
6857 printf ("test_lvs_0 FAILED\n");
6861 printf ("%3d/%3d test_lvs_1\n", test_num, nr_tests);
6862 if (test_lvs_1 () == -1) {
6863 printf ("test_lvs_1 FAILED\n");
6867 printf ("%3d/%3d test_vgs_0\n", test_num, nr_tests);
6868 if (test_vgs_0 () == -1) {
6869 printf ("test_vgs_0 FAILED\n");
6873 printf ("%3d/%3d test_vgs_1\n", test_num, nr_tests);
6874 if (test_vgs_1 () == -1) {
6875 printf ("test_vgs_1 FAILED\n");
6879 printf ("%3d/%3d test_pvs_0\n", test_num, nr_tests);
6880 if (test_pvs_0 () == -1) {
6881 printf ("test_pvs_0 FAILED\n");
6885 printf ("%3d/%3d test_pvs_1\n", test_num, nr_tests);
6886 if (test_pvs_1 () == -1) {
6887 printf ("test_pvs_1 FAILED\n");
6891 printf ("%3d/%3d test_list_partitions_0\n", test_num, nr_tests);
6892 if (test_list_partitions_0 () == -1) {
6893 printf ("test_list_partitions_0 FAILED\n");
6897 printf ("%3d/%3d test_list_partitions_1\n", test_num, nr_tests);
6898 if (test_list_partitions_1 () == -1) {
6899 printf ("test_list_partitions_1 FAILED\n");
6903 printf ("%3d/%3d test_list_devices_0\n", test_num, nr_tests);
6904 if (test_list_devices_0 () == -1) {
6905 printf ("test_list_devices_0 FAILED\n");
6909 printf ("%3d/%3d test_ls_0\n", test_num, nr_tests);
6910 if (test_ls_0 () == -1) {
6911 printf ("test_ls_0 FAILED\n");
6915 printf ("%3d/%3d test_cat_0\n", test_num, nr_tests);
6916 if (test_cat_0 () == -1) {
6917 printf ("test_cat_0 FAILED\n");
6921 printf ("%3d/%3d test_touch_0\n", test_num, nr_tests);
6922 if (test_touch_0 () == -1) {
6923 printf ("test_touch_0 FAILED\n");
6927 printf ("%3d/%3d test_sync_0\n", test_num, nr_tests);
6928 if (test_sync_0 () == -1) {
6929 printf ("test_sync_0 FAILED\n");
6933 printf ("%3d/%3d test_mount_0\n", test_num, nr_tests);
6934 if (test_mount_0 () == -1) {
6935 printf ("test_mount_0 FAILED\n");
6940 unlink ("test1.img");
6941 unlink ("test2.img");
6942 unlink ("test3.img");
6945 printf ("***** %d / %d tests FAILED *****\n", failed, nr_tests);