From: Kevin Wolf <kwolf@redhat.com>
To: phrdina@redhat.com
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] fdc-test: Check RELATIVE SEEK beyond track 0/80
Date: Mon, 16 Jul 2012 16:36:00 +0200 [thread overview]
Message-ID: <1342449360-15227-3-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1342449360-15227-1-git-send-email-kwolf@redhat.com>
TODO This needs to be checked against a real drive
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/fdc-test.c | 48 +++++++++++++++++++++++++++++++++++++-----------
1 files changed, 37 insertions(+), 11 deletions(-)
diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index fa74411..56e745a 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -94,13 +94,17 @@ static uint8_t floppy_recv(void)
}
/* pcn: Present Cylinder Number */
-static void ack_irq(uint8_t *pcn)
+static void ack_irq(uint8_t *st0, uint8_t *pcn)
{
uint8_t ret;
g_assert(get_irq(FLOPPY_IRQ));
floppy_send(CMD_SENSE_INT);
- floppy_recv();
+
+ ret = floppy_recv();
+ if (st0 != NULL) {
+ *st0 = ret;
+ }
ret = floppy_recv();
if (pcn != NULL) {
@@ -175,7 +179,7 @@ static void send_seek(int cyl)
floppy_send(head << 2 | drive);
g_assert(!get_irq(FLOPPY_IRQ));
floppy_send(cyl);
- ack_irq(NULL);
+ ack_irq(NULL, NULL);
}
static uint8_t cmos_read(uint8_t reg)
@@ -295,29 +299,51 @@ static void test_relative_seek(void)
{
uint8_t drive = 0;
uint8_t head = 0;
- uint8_t cyl = 1;
uint8_t pcn;
+ uint8_t st0;
/* Send seek to track 0 */
send_seek(0);
- /* Send relative seek to increase track by 1 */
+ /* Send relative seek to increase track by 3 */
floppy_send(CMD_RELATIVE_SEEK_IN);
floppy_send(head << 2 | drive);
g_assert(!get_irq(FLOPPY_IRQ));
- floppy_send(cyl);
+ floppy_send(3);
- ack_irq(&pcn);
- g_assert(pcn == 1);
+ ack_irq(&st0, &pcn);
+ g_assert_cmpint(pcn, ==, 3);
+ g_assert_cmpint(st0, ==, 0x20);
/* 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);
+ floppy_send(1);
+
+ ack_irq(&st0, &pcn);
+ g_assert_cmpint(pcn, ==, 2);
+ g_assert_cmpint(st0, ==, 0x20);
+
+ /* Send relative seek to beyond track 0 */
+ floppy_send(CMD_RELATIVE_SEEK_OUT);
+ floppy_send(head << 2 | drive);
+ g_assert(!get_irq(FLOPPY_IRQ));
+ floppy_send(42);
+
+ ack_irq(&st0, &pcn);
+ g_assert_cmpint(pcn, ==, 0);
+ g_assert_cmpint(st0, ==, 0x70);
+
+ /* Send try relative seek to beyond track 80 */
+ floppy_send(CMD_RELATIVE_SEEK_IN);
+ floppy_send(head << 2 | drive);
+ g_assert(!get_irq(FLOPPY_IRQ));
+ floppy_send(200);
- ack_irq(&pcn);
- g_assert(pcn == 0);
+ ack_irq(&st0, &pcn);
+ g_assert_cmpint(pcn, ==, 79);
+ g_assert_cmpint(st0, ==, 0x50);
}
/* success if no crash or abort */
--
1.7.6.5
next prev parent reply other threads:[~2012-07-16 14:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-16 14:35 [Qemu-devel] [PATCH 0/2] More RELATIVE SEEK fun Kevin Wolf
2012-07-16 14:35 ` [Qemu-devel] [PATCH 1/2] fdc-test: Clean up a bit Kevin Wolf
2012-07-16 14:36 ` Kevin Wolf [this message]
2012-07-17 9:03 ` [Qemu-devel] [PATCH 2/2] fdc-test: Check RELATIVE SEEK beyond track 0/80 Pavel Hrdina
2012-07-23 17:09 ` Blue Swirl
2012-07-24 9:35 ` Kevin Wolf
2012-07-24 20:01 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1342449360-15227-3-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=phrdina@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).