aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2015-04-28 15:27:51 -0400
committerJohn Snow <jsnow@redhat.com>2015-04-28 15:27:51 -0400
commit4e217074ca3f704d9a1c3bd1ebb03eb7621ab882 (patch)
treeeaf92985b17251d75bb82919af9db9ff54c0f40b
parent727be1a7550b5caad0b94098a41de8033ad43f85 (diff)
qtest/ahci: Add simple flush test
Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1426018503-821-2-git-send-email-jsnow@redhat.com
-rw-r--r--tests/ahci-test.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 6686242981..4a5c788e59 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -797,6 +797,29 @@ static void ahci_test_io_rw_simple(AHCIQState *ahci, unsigned bufsize,
g_free(rx);
}
+static void ahci_test_nondata(AHCIQState *ahci, uint8_t ide_cmd)
+{
+ uint8_t px;
+ AHCICommand *cmd;
+
+ /* Sanitize */
+ px = ahci_port_select(ahci);
+ ahci_port_clear(ahci, px);
+
+ /* Issue Command */
+ cmd = ahci_command_create(ide_cmd);
+ ahci_command_commit(ahci, cmd, px);
+ ahci_command_issue(ahci, cmd);
+ ahci_command_verify(ahci, cmd);
+ ahci_command_free(cmd);
+}
+
+static void ahci_test_flush(AHCIQState *ahci)
+{
+ ahci_test_nondata(ahci, CMD_FLUSH_CACHE);
+}
+
+
/******************************************************************************/
/* Test Interfaces */
/******************************************************************************/
@@ -931,6 +954,15 @@ static void test_dma_fragmented(void)
g_free(tx);
}
+static void test_flush(void)
+{
+ AHCIQState *ahci;
+
+ ahci = ahci_boot_and_enable();
+ ahci_test_flush(ahci);
+ ahci_shutdown(ahci);
+}
+
/******************************************************************************/
/* AHCI I/O Test Matrix Definitions */
@@ -1171,6 +1203,8 @@ 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);
+
ret = g_test_run();
/* Cleanup */