X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=tests.c;h=49c62dfd54b23340317c42eff391e595d976aee1;hp=5cf8ddc4259c6adfb065cc5ba03167761f884bba;hb=e118c14b9552de311cbc1734e03a3226b484c1e8;hpb=62df226f26bd6ac3c481a7790eb89d760d2f0386 diff --git a/tests.c b/tests.c index 5cf8ddc..49c62df 100644 --- a/tests.c +++ b/tests.c @@ -112,6 +112,70 @@ static void no_test_warnings (void) fprintf (stderr, "warning: \"guestfs_get_e2uuid\" has no tests\n"); } +static int test_grub_install_0 (void) +{ + /* InitBasicFS for grub_install (0): create ext2 on /dev/sda1 */ + { + int r; + suppress_error = 0; + r = guestfs_umount_all (g); + if (r == -1) + return -1; + } + { + int r; + suppress_error = 0; + r = guestfs_lvm_remove_all (g); + if (r == -1) + return -1; + } + { + char *lines[] = { + ",", + NULL + }; + int r; + suppress_error = 0; + r = guestfs_sfdisk (g, "/dev/sda", 0, 0, 0, lines); + if (r == -1) + return -1; + } + { + int r; + suppress_error = 0; + r = guestfs_mkfs (g, "ext2", "/dev/sda1"); + if (r == -1) + return -1; + } + { + int r; + suppress_error = 0; + r = guestfs_mount (g, "/dev/sda1", "/"); + if (r == -1) + return -1; + } + /* TestOutputTrue for grub_install (0) */ + { + int r; + suppress_error = 0; + r = guestfs_grub_install (g, "/", "/dev/sda1"); + if (r == -1) + return -1; + } + { + int r; + suppress_error = 0; + r = guestfs_is_dir (g, "/boot"); + if (r == -1) + return -1; + if (!r) { + fprintf (stderr, "test_grub_install_0: expected true, got false\n"); + return -1; + } + } + return 0; +} + static int test_zero_0 (void) { /* InitBasicFS for zero (0): create ext2 on /dev/sda1 */ @@ -6720,9 +6784,15 @@ int main (int argc, char *argv[]) exit (1); } - nr_tests = 94; + nr_tests = 95; test_num++; + printf ("%3d/%3d test_grub_install_0\n", test_num, nr_tests); + if (test_grub_install_0 () == -1) { + printf ("test_grub_install_0 FAILED\n"); + failed++; + } + test_num++; printf ("%3d/%3d test_zero_0\n", test_num, nr_tests); if (test_zero_0 () == -1) { printf ("test_zero_0 FAILED\n");