qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, marc.mari.barcelo@gmail.com,
	qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com,
	John Snow <jsnow@redhat.com>
Subject: [Qemu-devel] [PATCH v2 6/6] qtest/ahci: add flush retry test
Date: Tue, 10 Mar 2015 16:15:03 -0400	[thread overview]
Message-ID: <1426018503-821-7-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1426018503-821-1-git-send-email-jsnow@redhat.com>

Signed-off-by: John Snow <jsnow@redhat.com>
---
 tests/ahci-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 6c99f19..64dff8d 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -46,6 +46,7 @@
 
 /*** Globals ***/
 static char tmp_path[] = "/tmp/qtest.XXXXXX";
+static char debug_path[] = "/tmp/qtest-blkdebug.XXXXXX";
 static bool ahci_pedantic;
 
 /*** Function Declarations ***/
@@ -966,6 +967,41 @@ static void test_flush(void)
     ahci_shutdown(ahci);
 }
 
+static void test_flush_retry(void)
+{
+    AHCIQState *ahci;
+    AHCICommand *cmd;
+    uint8_t port;
+    const char *s;
+
+    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,"
+                                "rerror=stop,werror=stop "
+                                "-M q35 "
+                                "-device ide-hd,drive=drive0 ",
+                                debug_path,
+                                tmp_path);
+
+    /* Issue Flush Command */
+    port = ahci_port_select(ahci);
+    ahci_port_clear(ahci, port);
+    cmd = ahci_command_create(CMD_FLUSH_CACHE);
+    ahci_command_commit(ahci, cmd, port);
+    ahci_command_issue_async(ahci, cmd);
+    qmp_eventwait("STOP");
+
+    /* Complete the command */
+    s = "{'execute':'cont' }";
+    qmp_async(s);
+    qmp_eventwait("RESUME");
+    ahci_command_wait(ahci, cmd);
+    ahci_command_verify(ahci, cmd);
+
+    ahci_command_free(cmd);
+    ahci_shutdown(ahci);
+}
+
 /******************************************************************************/
 /* AHCI I/O Test Matrix Definitions                                           */
 
@@ -1147,6 +1183,7 @@ int main(int argc, char **argv)
 {
     const char *arch;
     int ret;
+    int fd;
     int c;
     int i, j, k, m;
 
@@ -1186,6 +1223,11 @@ int main(int argc, char **argv)
     close(mkstemp(tmp_path));
     mkqcow2(tmp_path, TEST_IMAGE_SIZE_MB);
 
+    /* Create temporary blkdebug instructions */
+    fd = mkstemp(debug_path);
+    g_assert(fd >= 0);
+    close(fd);
+
     /* Run the tests */
     qtest_add_func("/ahci/sanity",     test_sanity);
     qtest_add_func("/ahci/pci_spec",   test_pci_spec);
@@ -1207,11 +1249,13 @@ int main(int argc, char **argv)
     qtest_add_func("/ahci/io/dma/lba28/fragmented", test_dma_fragmented);
 
     qtest_add_func("/ahci/flush/simple", test_flush);
+    qtest_add_func("/ahci/flush/retry", test_flush_retry);
 
     ret = g_test_run();
 
     /* Cleanup */
     unlink(tmp_path);
+    unlink(debug_path);
 
     return ret;
 }
-- 
1.9.3

  parent reply	other threads:[~2015-03-10 20:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 20:14 [Qemu-devel] [PATCH v2 0/6] ahci: rerror/werror=stop resume tests John Snow
2015-03-10 20:14 ` [Qemu-devel] [PATCH v2 1/6] qtest/ahci: Add simple flush test John Snow
2015-03-10 20:14 ` [Qemu-devel] [PATCH v2 2/6] qtest/ahci: Allow override of default CLI options John Snow
2015-03-10 20:15 ` [Qemu-devel] [PATCH v2 3/6] libqtest: add qmp_eventwait John Snow
2015-03-10 20:15 ` [Qemu-devel] [PATCH v2 4/6] libqtest: add qmp_async John Snow
2015-03-10 20:15 ` [Qemu-devel] [PATCH v2 5/6] libqos: add blkdebug_prepare_script John Snow
2015-03-10 20:15 ` John Snow [this message]
2015-03-13 19:35 ` [Qemu-devel] [PATCH v2 0/6] ahci: rerror/werror=stop resume tests John Snow
2015-03-25 22:29 ` John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426018503-821-7-git-send-email-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=marc.mari.barcelo@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).