From: Pavel Hrdina <phrdina@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Pavel Hrdina <phrdina@redhat.com>, armbru@redhat.com
Subject: [Qemu-devel] [PATCH v3 3/3] fdc-test: introduced qtest no_media_on_start
Date: Wed, 23 May 2012 13:27:33 +0200 [thread overview]
Message-ID: <c44c9c9c86f84511a17ebae86c6f74c254c42b26.1337771084.git.phrdina@redhat.com> (raw)
In-Reply-To: <cover.1337771084.git.phrdina@redhat.com>
In-Reply-To: <cover.1337771084.git.phrdina@redhat.com>
After guest start DSKCHG bit in DIR register should be set. If there
is no media in drive, this bit should be set all the time.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
tests/fdc-test.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index 5b5dd74..e002c5c 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -108,6 +108,30 @@ static void send_step_pulse(void)
cyl = (cyl + 1) % 4;
}
+static void test_no_media_on_start(void)
+{
+ uint8_t dir;
+
+ /* Media changed bit must be set all time after start if there is
+ * no media in drive. */
+ dir = inb(FLOPPY_BASE + reg_dir);
+ assert_bit_set(dir, DSKCHG);
+ dir = inb(FLOPPY_BASE + reg_dir);
+ assert_bit_set(dir, DSKCHG);
+ send_step_pulse();
+ send_step_pulse();
+ dir = inb(FLOPPY_BASE + reg_dir);
+ assert_bit_set(dir, DSKCHG);
+ dir = inb(FLOPPY_BASE + reg_dir);
+ assert_bit_set(dir, DSKCHG);
+
+ /* Insert media for other tests. */
+ qmp("{'execute':'change', 'arguments':{ 'device':'floppy0', "
+ "'target': '%s' }}", test_image);
+ qmp(""); /* ignore event (FIXME open -> open transition?!) */
+ qmp(""); /* ignore event */
+}
+
static void test_media_change(void)
{
uint8_t dir;
@@ -177,12 +201,11 @@ int main(int argc, char **argv)
/* Run the tests */
g_test_init(&argc, &argv, NULL);
- cmdline = g_strdup_printf("-vnc none "
- "-drive file=%s,if=floppy,cache=writeback ",
- test_image);
+ cmdline = g_strdup_printf("-vnc none ");
qtest_start(cmdline);
qtest_irq_intercept_in(global_qtest, "ioapic");
+ qtest_add_func("/fdc/no_media_on_start", test_no_media_on_start);
qtest_add_func("/fdc/media_change", test_media_change);
ret = g_test_run();
--
1.7.7.6
next prev parent reply other threads:[~2012-05-23 11:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-23 11:27 [Qemu-devel] [PATCH v3 0/3] fdc: fix media handling Pavel Hrdina
2012-05-23 11:27 ` [Qemu-devel] [PATCH v3 1/3] fdc: floppy drive should be visible after start without media Pavel Hrdina
2012-05-23 11:27 ` [Qemu-devel] [PATCH v3 2/3] fdc: fix media detection Pavel Hrdina
2012-05-23 11:27 ` Pavel Hrdina [this message]
2012-05-23 12:15 ` [Qemu-devel] [PATCH v3 3/3] fdc-test: introduced qtest no_media_on_start Paolo Bonzini
2012-05-23 12:35 ` Kevin Wolf
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=c44c9c9c86f84511a17ebae86c6f74c254c42b26.1337771084.git.phrdina@redhat.com \
--to=phrdina@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@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).