[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 40/41] fdc-test: introduce test_relative_seek
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 40/41] fdc-test: introduce test_relative_seek |
Date: |
Tue, 17 Jul 2012 18:00:37 +0200 |
From: Pavel Hrdina <address@hidden>
Signed-off-by: Pavel Hrdina <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/fdc-test.c | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index 585fb0e..10d11a4 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -47,9 +47,11 @@ enum {
};
enum {
- CMD_SENSE_INT = 0x08,
- CMD_SEEK = 0x0f,
- CMD_READ = 0xe6,
+ CMD_SENSE_INT = 0x08,
+ CMD_SEEK = 0x0f,
+ CMD_READ = 0xe6,
+ CMD_RELATIVE_SEEK_OUT = 0x8f,
+ CMD_RELATIVE_SEEK_IN = 0xcf,
};
enum {
@@ -91,13 +93,17 @@ static uint8_t floppy_recv(void)
return inb(FLOPPY_BASE + reg_fifo);
}
-static void ack_irq(void)
+static uint8_t ack_irq(void)
{
+ uint8_t ret;
+
g_assert(get_irq(FLOPPY_IRQ));
floppy_send(CMD_SENSE_INT);
floppy_recv();
- floppy_recv();
+ ret = floppy_recv();
g_assert(!get_irq(FLOPPY_IRQ));
+
+ return ret;
}
static uint8_t send_read_command(void)
@@ -281,6 +287,35 @@ static void test_sense_interrupt(void)
floppy_recv();
}
+static void test_relative_seek(void)
+{
+ uint8_t drive = 0;
+ uint8_t head = 0;
+ uint8_t cyl = 1;
+ uint8_t ret;
+
+ /* Send seek to track 0 */
+ send_step_pulse(0);
+
+ /* Send relative seek to increase track by 1 */
+ floppy_send(CMD_RELATIVE_SEEK_IN);
+ floppy_send(head << 2 | drive);
+ g_assert(!get_irq(FLOPPY_IRQ));
+ floppy_send(cyl);
+
+ ret = ack_irq();
+ g_assert(ret == 1);
+
+ /* Send relative seek to decrease track by 1 */
+ floppy_send(CMD_RELATIVE_SEEK_OUT);
+ floppy_send(head << 2 | drive);
+ g_assert(!get_irq(FLOPPY_IRQ));
+ floppy_send(cyl);
+
+ ret = ack_irq();
+ g_assert(ret == 0);
+}
+
/* success if no crash or abort */
static void fuzz_registers(void)
{
@@ -329,6 +364,7 @@ int main(int argc, char **argv)
qtest_add_func("/fdc/read_without_media", test_read_without_media);
qtest_add_func("/fdc/media_change", test_media_change);
qtest_add_func("/fdc/sense_interrupt", test_sense_interrupt);
+ qtest_add_func("/fdc/relative_seek", test_relative_seek);
qtest_add_func("/fdc/fuzz-registers", fuzz_registers);
ret = g_test_run();
--
1.7.6.5
- [Qemu-devel] [PATCH 18/41] scsi-hd: qdev properties for disk geometry, (continued)
- [Qemu-devel] [PATCH 18/41] scsi-hd: qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 26/41] block: Geometry and translation hints are now useless, purge them, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 32/41] hw/block-common: Move BlockConf & friends from block.h, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 38/41] qemu-iotests: Valgrind support, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 28/41] qtest: Test we don't put hard disk info into CMOS for a CD-ROM, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 34/41] blockdev: Don't limit DriveInfo serial to 20 characters, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 12/41] hd-geometry: Clean up confusing use of prior translation hint, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 21/41] qtest: Cover qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 23/41] qdev: New property type chs-translation, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 17/41] hd-geometry: Switch to uint32_t to match BlockConf, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 40/41] fdc-test: introduce test_relative_seek,
Kevin Wolf <=
- [Qemu-devel] [PATCH 36/41] qemu-io: Fix memory leaks, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 19/41] virtio-blk: qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 20/41] ide: qdev properties for disk geometry, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 39/41] fdc: fix relative seek, Kevin Wolf, 2012/07/17
- [Qemu-devel] [PATCH 35/41] hw/block-common: Factor out fall back to legacy -drive cyls=..., Kevin Wolf, 2012/07/17