From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfrbC-00088g-55 for qemu-devel@nongnu.org; Thu, 10 Aug 2017 13:50:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfrb8-0004Rv-Oc for qemu-devel@nongnu.org; Thu, 10 Aug 2017 13:50:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38340) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfrb8-0004KI-I6 for qemu-devel@nongnu.org; Thu, 10 Aug 2017 13:50:18 -0400 From: Stefan Hajnoczi Date: Thu, 10 Aug 2017 18:48:23 +0100 Message-Id: <20170810174824.9580-3-stefanha@redhat.com> In-Reply-To: <20170810174824.9580-1-stefanha@redhat.com> References: <20170810174824.9580-1-stefanha@redhat.com> Subject: [Qemu-devel] [PULL for-2.10 2/3] IDE: test flush on empty CDROM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Kevin Wolf , John Snow , Stefan Hajnoczi From: Kevin Wolf Signed-off-by: Kevin Wolf Signed-off-by: John Snow Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi Message-id: 20170809160212.29976-3-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- tests/ide-test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/ide-test.c b/tests/ide-test.c index bfd79ddbdc..aa9de065fc 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -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"); @@ -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); -- 2.13.4