summaryrefslogtreecommitdiffstats
path: root/capitests
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-06-08 17:44:18 +0100
committerRichard Jones <rjones@redhat.com>2009-06-08 17:44:18 +0100
commit460d139e6a52da67a4f1947035b1978610349f78 (patch)
tree798177aa71bc9615074cd1a9a351ff4b38165c7c /capitests
parent3de234656bc61a2d35b0f1a9ccb1e6ef7535166b (diff)
downloadlibguestfs-460d139e6a52da67a4f1947035b1978610349f78.tar.gz
libguestfs-460d139e6a52da67a4f1947035b1978610349f78.tar.xz
libguestfs-460d139e6a52da67a4f1947035b1978610349f78.zip
Generated code for ntfs_3g_probe command.
Diffstat (limited to 'capitests')
-rw-r--r--capitests/tests.c180
1 files changed, 179 insertions, 1 deletions
diff --git a/capitests/tests.c b/capitests/tests.c
index d2638629..6713a2d6 100644
--- a/capitests/tests.c
+++ b/capitests/tests.c
@@ -155,6 +155,172 @@ static void no_test_warnings (void)
fprintf (stderr, "warning: \"guestfs_e2fsck_f\" has no tests\n");
}
+static int test_ntfs_3g_probe_0_skip (void)
+{
+ const char *str;
+
+ str = getenv ("SKIP_TEST_NTFS_3G_PROBE_0");
+ if (str && strcmp (str, "1") == 0) return 1;
+ str = getenv ("SKIP_TEST_NTFS_3G_PROBE");
+ if (str && strcmp (str, "1") == 0) return 1;
+ return 0;
+}
+
+static int test_ntfs_3g_probe_0 (void)
+{
+ if (test_ntfs_3g_probe_0_skip ()) {
+ printf ("%s skipped (reason: SKIP_TEST_* variable set)\n", "test_ntfs_3g_probe_0");
+ return 0;
+ }
+
+ /* InitNone|InitEmpty for test_ntfs_3g_probe_0 */
+ {
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_umount_all (g);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_lvm_remove_all (g);
+ if (r == -1)
+ return -1;
+ }
+ /* TestOutputInt for ntfs_3g_probe (0) */
+ {
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char fstype[] = "ntfs";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_mkfs (g, fstype, device);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_ntfs_3g_probe (g, 1, device);
+ if (r == -1)
+ return -1;
+ if (r != 0) {
+ fprintf (stderr, "test_ntfs_3g_probe_0: expected 0 but got %d\n", (int) r);
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int test_ntfs_3g_probe_1_skip (void)
+{
+ const char *str;
+
+ str = getenv ("SKIP_TEST_NTFS_3G_PROBE_1");
+ if (str && strcmp (str, "1") == 0) return 1;
+ str = getenv ("SKIP_TEST_NTFS_3G_PROBE");
+ if (str && strcmp (str, "1") == 0) return 1;
+ return 0;
+}
+
+static int test_ntfs_3g_probe_1 (void)
+{
+ if (test_ntfs_3g_probe_1_skip ()) {
+ printf ("%s skipped (reason: SKIP_TEST_* variable set)\n", "test_ntfs_3g_probe_1");
+ return 0;
+ }
+
+ /* InitNone|InitEmpty for test_ntfs_3g_probe_1 */
+ {
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_blockdev_setrw (g, device);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_umount_all (g);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_lvm_remove_all (g);
+ if (r == -1)
+ return -1;
+ }
+ /* TestOutputInt for ntfs_3g_probe (1) */
+ {
+ char device[] = "/dev/sda";
+ device[5] = devchar;
+ char lines_0[] = ",";
+ char *lines[] = {
+ lines_0,
+ NULL
+ };
+ int r;
+ suppress_error = 0;
+ r = guestfs_sfdisk (g, device, 0, 0, 0, lines);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char fstype[] = "ext2";
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_mkfs (g, fstype, device);
+ if (r == -1)
+ return -1;
+ }
+ {
+ char device[] = "/dev/sda1";
+ device[5] = devchar;
+ int r;
+ suppress_error = 0;
+ r = guestfs_ntfs_3g_probe (g, 1, device);
+ if (r == -1)
+ return -1;
+ if (r != 12) {
+ fprintf (stderr, "test_ntfs_3g_probe_1: expected 12 but got %d\n", (int) r);
+ return -1;
+ }
+ }
+ return 0;
+}
+
static int test_sleep_0_skip (void)
{
const char *str;
@@ -16211,9 +16377,21 @@ int main (int argc, char *argv[])
free (devs[i]);
free (devs);
- nr_tests = 144;
+ nr_tests = 146;
test_num++;
+ printf ("%3d/%3d test_ntfs_3g_probe_0\n", test_num, nr_tests);
+ if (test_ntfs_3g_probe_0 () == -1) {
+ printf ("test_ntfs_3g_probe_0 FAILED\n");
+ failed++;
+ }
+ test_num++;
+ printf ("%3d/%3d test_ntfs_3g_probe_1\n", test_num, nr_tests);
+ if (test_ntfs_3g_probe_1 () == -1) {
+ printf ("test_ntfs_3g_probe_1 FAILED\n");
+ failed++;
+ }
+ test_num++;
printf ("%3d/%3d test_sleep_0\n", test_num, nr_tests);
if (test_sleep_0 () == -1) {
printf ("test_sleep_0 FAILED\n");