Skip to content

Commit 07a1ee7

Browse files
committed
qtest/ahci: ncq migration test
Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1435016308-6150-17-git-send-email-jsnow@redhat.com
1 parent 26ad004 commit 07a1ee7

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/ahci-test.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,9 +1146,9 @@ static void test_migrate_sanity(void)
11461146
}
11471147

11481148
/**
1149-
* DMA Migration test: Write a pattern, migrate, then read.
1149+
* Simple migration test: Write a pattern, migrate, then read.
11501150
*/
1151-
static void test_migrate_dma(void)
1151+
static void ahci_migrate_simple(uint8_t cmd_read, uint8_t cmd_write)
11521152
{
11531153
AHCIQState *src, *dst;
11541154
uint8_t px;
@@ -1176,9 +1176,9 @@ static void test_migrate_dma(void)
11761176
}
11771177

11781178
/* Write, migrate, then read. */
1179-
ahci_io(src, px, CMD_WRITE_DMA, tx, bufsize, 0);
1179+
ahci_io(src, px, cmd_write, tx, bufsize, 0);
11801180
ahci_migrate(src, dst, uri);
1181-
ahci_io(dst, px, CMD_READ_DMA, rx, bufsize, 0);
1181+
ahci_io(dst, px, cmd_read, rx, bufsize, 0);
11821182

11831183
/* Verify pattern */
11841184
g_assert_cmphex(memcmp(tx, rx, bufsize), ==, 0);
@@ -1189,6 +1189,16 @@ static void test_migrate_dma(void)
11891189
g_free(tx);
11901190
}
11911191

1192+
static void test_migrate_dma(void)
1193+
{
1194+
ahci_migrate_simple(CMD_READ_DMA, CMD_WRITE_DMA);
1195+
}
1196+
1197+
static void test_migrate_ncq(void)
1198+
{
1199+
ahci_migrate_simple(READ_FPDMA_QUEUED, WRITE_FPDMA_QUEUED);
1200+
}
1201+
11921202
/**
11931203
* DMA Error Test
11941204
*
@@ -1666,6 +1676,7 @@ int main(int argc, char **argv)
16661676
qtest_add_func("/ahci/reset", test_reset);
16671677

16681678
qtest_add_func("/ahci/io/ncq/simple", test_ncq_simple);
1679+
qtest_add_func("/ahci/migrate/ncq/simple", test_migrate_ncq);
16691680

16701681
ret = g_test_run();
16711682

0 commit comments

Comments
 (0)