Commit b236b610 authored by John Snow's avatar John Snow
Browse files

qtest/ahci: always specify image format



Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
Message-id: 1447439479-16775-2-git-send-email-jsnow@redhat.com
parent 6d9e7295
Loading
Loading
Loading
Loading
+29 −22
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ static char tmp_path[] = "/tmp/qtest.XXXXXX";
static char debug_path[] = "/tmp/qtest-blkdebug.XXXXXX";
static char mig_socket[] = "/tmp/qtest-migration.XXXXXX";
static bool ahci_pedantic;
static const char *imgfmt;

/*** Function Declarations ***/
static void ahci_test_port_spec(AHCIQState *ahci, uint8_t port);
@@ -175,11 +176,11 @@ static AHCIQState *ahci_boot(const char *cli, ...)
        va_end(ap);
    } else {
        cli = "-drive if=none,id=drive0,file=%s,cache=writeback,serial=%s"
            ",format=qcow2"
            ",format=%s"
            " -M q35 "
            "-device ide-hd,drive=drive0 "
            "-global ide-hd.ver=%s";
        s = ahci_boot(cli, tmp_path, "testdisk", "version");
        s = ahci_boot(cli, tmp_path, "testdisk", imgfmt, "version");
    }

    return s;
@@ -1078,12 +1079,12 @@ static void test_flush_retry(void)

    prepare_blkdebug_script(debug_path, "flush_to_disk");
    ahci = ahci_boot_and_enable("-drive file=blkdebug:%s:%s,if=none,id=drive0,"
                                "format=qcow2,cache=writeback,"
                                "format=%s,cache=writeback,"
                                "rerror=stop,werror=stop "
                                "-M q35 "
                                "-device ide-hd,drive=drive0 ",
                                debug_path,
                                tmp_path);
                                tmp_path, imgfmt);

    /* Issue Flush Command and wait for error */
    port = ahci_port_select(ahci);
@@ -1113,10 +1114,10 @@ static void test_migrate_sanity(void)
    char *uri = g_strdup_printf("unix:%s", mig_socket);

    src = ahci_boot("-m 1024 -M q35 "
                    "-hda %s ", tmp_path);
                    "-drive if=ide,file=%s,format=%s ", tmp_path, imgfmt);
    dst = ahci_boot("-m 1024 -M q35 "
                    "-hda %s "
                    "-incoming %s", tmp_path, uri);
                    "-drive if=ide,file=%s,format=%s "
                    "-incoming %s", tmp_path, imgfmt, uri);

    ahci_migrate(src, dst, uri);

@@ -1138,10 +1139,11 @@ static void ahci_migrate_simple(uint8_t cmd_read, uint8_t cmd_write)
    char *uri = g_strdup_printf("unix:%s", mig_socket);

    src = ahci_boot_and_enable("-m 1024 -M q35 "
                               "-hda %s ", tmp_path);
                               "-drive if=ide,format=%s,file=%s ",
                               imgfmt, tmp_path);
    dst = ahci_boot("-m 1024 -M q35 "
                    "-hda %s "
                    "-incoming %s", tmp_path, uri);
                    "-drive if=ide,format=%s,file=%s "
                    "-incoming %s", imgfmt, tmp_path, uri);

    set_context(src->parent);

@@ -1197,12 +1199,12 @@ static void ahci_halted_io_test(uint8_t cmd_read, uint8_t cmd_write)
    prepare_blkdebug_script(debug_path, "write_aio");

    ahci = ahci_boot_and_enable("-drive file=blkdebug:%s:%s,if=none,id=drive0,"
                                "format=qcow2,cache=writeback,"
                                "format=%s,cache=writeback,"
                                "rerror=stop,werror=stop "
                                "-M q35 "
                                "-device ide-hd,drive=drive0 ",
                                debug_path,
                                tmp_path);
                                tmp_path, imgfmt);

    /* Initialize and prepare */
    port = ahci_port_select(ahci);
@@ -1263,20 +1265,20 @@ static void ahci_migrate_halted_io(uint8_t cmd_read, uint8_t cmd_write)
    prepare_blkdebug_script(debug_path, "write_aio");

    src = ahci_boot_and_enable("-drive file=blkdebug:%s:%s,if=none,id=drive0,"
                               "format=qcow2,cache=writeback,"
                               "format=%s,cache=writeback,"
                               "rerror=stop,werror=stop "
                               "-M q35 "
                               "-device ide-hd,drive=drive0 ",
                               debug_path,
                               tmp_path);
                               tmp_path, imgfmt);

    dst = ahci_boot("-drive file=%s,if=none,id=drive0,"
                    "format=qcow2,cache=writeback,"
                    "format=%s,cache=writeback,"
                    "rerror=stop,werror=stop "
                    "-M q35 "
                    "-device ide-hd,drive=drive0 "
                    "-incoming %s",
                    tmp_path, uri);
                    tmp_path, imgfmt, uri);

    set_context(src->parent);

@@ -1335,15 +1337,17 @@ static void test_flush_migrate(void)
    prepare_blkdebug_script(debug_path, "flush_to_disk");

    src = ahci_boot_and_enable("-drive file=blkdebug:%s:%s,if=none,id=drive0,"
                               "cache=writeback,rerror=stop,werror=stop "
                               "cache=writeback,rerror=stop,werror=stop,"
                               "format=%s "
                               "-M q35 "
                               "-device ide-hd,drive=drive0 ",
                               debug_path, tmp_path);
                               debug_path, tmp_path, imgfmt);
    dst = ahci_boot("-drive file=%s,if=none,id=drive0,"
                    "cache=writeback,rerror=stop,werror=stop "
                    "cache=writeback,rerror=stop,werror=stop,"
                    "format=%s "
                    "-M q35 "
                    "-device ide-hd,drive=drive0 "
                    "-incoming %s", tmp_path, uri);
                    "-incoming %s", tmp_path, imgfmt, uri);

    set_context(src->parent);

@@ -1626,9 +1630,12 @@ int main(int argc, char **argv)
        return 0;
    }

    /* Create a temporary qcow2 image */
    close(mkstemp(tmp_path));
    /* Create a temporary image */
    fd = mkstemp(tmp_path);
    g_assert(fd >= 0);
    imgfmt = "qcow2";
    mkqcow2(tmp_path, TEST_IMAGE_SIZE_MB);
    close(fd);

    /* Create temporary blkdebug instructions */
    fd = mkstemp(debug_path);