From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXATN-0007k4-LS for qemu-devel@nongnu.org; Wed, 23 May 2012 08:15:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXATD-0002tl-N6 for qemu-devel@nongnu.org; Wed, 23 May 2012 08:15:25 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:54156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXATD-0002rg-DN for qemu-devel@nongnu.org; Wed, 23 May 2012 08:15:15 -0400 Received: by dadv2 with SMTP id v2so11595140dad.4 for ; Wed, 23 May 2012 05:15:13 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4FBCD4CB.2090203@redhat.com> Date: Wed, 23 May 2012 14:15:07 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 3/3] fdc-test: introduced qtest no_media_on_start List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com Il 23/05/2012 13:27, Pavel Hrdina ha scritto: > 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 > --- > 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 */ > +} This makes it impossible to use the testcase with -p/-s (try tests/fdc-test --help). Please move these commands to test_media_change. Alternatively (perhaps better), leave the "-drive" option and add a matching eject command to test_no_media_on_start. Thanks! Paolo > 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();