qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 18/19] qtest/ahci: Assert sector size in identify te


From: John Snow
Subject: [Qemu-devel] [PATCH 18/19] qtest/ahci: Assert sector size in identify test
Date: Fri, 30 Jan 2015 13:42:12 -0500

A minor sanity check to assert that the sector size is 512.
The current block layer code deeply assumes that the IDE
sector size will be 512 bytes, so we carry forward that assumption
here.

This is useful for the DMA tests, which currently assume that
a sector will always be 512 bytes.

Signed-off-by: John Snow <address@hidden>
---
 tests/ahci-test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 9207e73..cae94b5 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -678,6 +678,7 @@ static void ahci_test_identify(AHCIQState *ahci)
     uint16_t buff[256];
     unsigned px;
     int rc;
+    uint16_t sect_size;
     const size_t buffsize = 512;
 
     g_assert(ahci != NULL);
@@ -725,6 +726,9 @@ static void ahci_test_identify(AHCIQState *ahci)
     string_bswap16(&buff[23], 8);
     rc = memcmp(&buff[23], "version ", 8);
     g_assert_cmphex(rc, ==, 0);
+
+    sect_size = le16_to_cpu(*((uint16_t *)(&buff[5])));
+    g_assert_cmphex(sect_size, ==, 0x200);
 }
 
 
/******************************************************************************/
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]