fprintf (stderr, "warning: \"guestfs_get_e2uuid\" has no tests\n");
}
+static int test_equal_0 (void)
+{
+ /* InitBasicFS for equal (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 equal (0) */
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_write_file (g, "/file1", "contents of a file", 0);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_cp (g, "/file1", "/file2");
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_equal (g, "/file1", "/file2");
+ if (r == -1)
+ return -1;
+ if (!r) {
+ fprintf (stderr, "test_equal_0: expected true, got false\n");
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int test_equal_1 (void)
+{
+ /* InitBasicFS for equal (1): 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;
+ }
+ /* TestOutputFalse for equal (1) */
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_write_file (g, "/file1", "contents of a file", 0);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_write_file (g, "/file2", "contents of another file", 0);
+ if (r == -1)
+ return -1;
+ }
+ {
+ int r;
+ suppress_error = 0;
+ r = guestfs_equal (g, "/file1", "/file2");
+ if (r == -1)
+ return -1;
+ if (r) {
+ fprintf (stderr, "test_equal_1: expected false, got true\n");
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int test_equal_2 (void)
+{
+ /* InitBasicFS for equal (2): 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;
+ }
+ /* TestLastFail for equal (2) */
+ {
+ int r;
+ suppress_error = 1;
+ r = guestfs_equal (g, "/file1", "/file2");
+ if (r != -1)
+ return -1;
+ }
+ return 0;
+}
+
static int test_ping_daemon_0 (void)
{
/* InitEmpty for ping_daemon (0) */
exit (1);
}
- nr_tests = 104;
+ nr_tests = 107;
test_num++;
+ printf ("%3d/%3d test_equal_0\n", test_num, nr_tests);
+ if (test_equal_0 () == -1) {
+ printf ("test_equal_0 FAILED\n");
+ failed++;
+ }
+ test_num++;
+ printf ("%3d/%3d test_equal_1\n", test_num, nr_tests);
+ if (test_equal_1 () == -1) {
+ printf ("test_equal_1 FAILED\n");
+ failed++;
+ }
+ test_num++;
+ printf ("%3d/%3d test_equal_2\n", test_num, nr_tests);
+ if (test_equal_2 () == -1) {
+ printf ("test_equal_2 FAILED\n");
+ failed++;
+ }
+ test_num++;
printf ("%3d/%3d test_ping_daemon_0\n", test_num, nr_tests);
if (test_ping_daemon_0 () == -1) {
printf ("test_ping_daemon_0 FAILED\n");