Skip to content

Commit

Permalink
IDE: test flush on empty CDROM
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Wolf <[email protected]>
Signed-off-by: John Snow <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
Message-id: [email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
kevmw authored and stefanhaRH committed Aug 10, 2017
1 parent 4da9712 commit ce317e8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/ide-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,24 @@ static void test_flush_nodev(void)
ide_test_quit();
}

static void test_flush_empty_drive(void)
{
QPCIDevice *dev;
QPCIBar bmdma_bar, ide_bar;

ide_test_start("-device ide-cd,bus=ide.0");
dev = get_pci_device(&bmdma_bar, &ide_bar);

/* FLUSH CACHE command on device 0 */
qpci_io_writeb(dev, ide_bar, reg_device, 0);
qpci_io_writeb(dev, ide_bar, reg_command, CMD_FLUSH_CACHE);

/* Just testing that qemu doesn't crash... */

free_pci_device(dev);
ide_test_quit();
}

static void test_pci_retry_flush(void)
{
test_retry_flush("pc");
Expand Down Expand Up @@ -954,6 +972,7 @@ int main(int argc, char **argv)

qtest_add_func("/ide/flush", test_flush);
qtest_add_func("/ide/flush/nodev", test_flush_nodev);
qtest_add_func("/ide/flush/empty_drive", test_flush_empty_drive);
qtest_add_func("/ide/flush/retry_pci", test_pci_retry_flush);
qtest_add_func("/ide/flush/retry_isa", test_isa_retry_flush);

Expand Down

0 comments on commit ce317e8

Please sign in to comment.