From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sm4KH-0001jI-9S for qemu-devel@nongnu.org; Tue, 03 Jul 2012 10:43:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sm4KA-0006gC-UH for qemu-devel@nongnu.org; Tue, 03 Jul 2012 10:43:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sm4KA-0006fn-ML for qemu-devel@nongnu.org; Tue, 03 Jul 2012 10:43:30 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q63EhT7T010390 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 3 Jul 2012 10:43:29 -0400 Message-ID: <4FF30510.7090106@redhat.com> Date: Tue, 03 Jul 2012 16:43:28 +0200 From: Pavel Hrdina MIME-Version: 1.0 References: <4FE83483.4010204@redhat.com> In-Reply-To: <4FE83483.4010204@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 5/6] fdc_test: update media_change test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On 06/25/2012 11:50 AM, Kevin Wolf wrote: > Am 22.06.2012 12:33, schrieb Pavel Hrdina: >> After rewrite DSKCHG bit handling the test has to be updated. Now >> is needed to seek to different track to clear DSKCHG bit. >> >> Signed-off-by: Pavel Hrdina >> --- >> tests/fdc-test.c | 29 +++++++++++++++++++++-------- >> 1 files changed, 21 insertions(+), 8 deletions(-) >> >> diff --git a/tests/fdc-test.c b/tests/fdc-test.c >> index 610e2f1..5280eff 100644 >> --- a/tests/fdc-test.c >> +++ b/tests/fdc-test.c >> @@ -156,19 +156,20 @@ static uint8_t send_read_command(void) >> return ret; >> } >> >> -static void send_step_pulse(void) >> +static void send_step_pulse(bool chg_cyl) >> { >> int drive = 0; >> int head = 0; >> - static int cyl = 0; >> + int cyl = 0; >> + >> + if (chg_cyl) >> + cyl = (cyl + 1) % 4; > Why do you remove the static? Previously, the function would cycle > through cylinders 1-4. Now it's always 0 if !chg_cyl and 1 if chg_cyl. I > think you need to fix this. > > I also don't quite understand why you move the increment to here instead > of leaving it as the bottom. It doesn't look wrong, but pointless. Now the functionality is different. I need seek to cylinder 0 or 1. After every change of media an actual cylinder is set to 0 and I need to try seek to cylinder 0 to test, that after this seek the DSKCHG bit is still set. Then I need to seek to different cylinder to reset the DSKCHG and for that seek to 1 is enough. I'll chagne the cyl = (cyl + 1) % 4; to cyl = 1; >> >> floppy_send(CMD_SEEK); >> floppy_send(head<< 2 | drive); >> g_assert(!get_irq(FLOPPY_IRQ)); >> floppy_send(cyl); >> ack_irq(); >> - >> - cyl = (cyl + 1) % 4; >> } >> >> static uint8_t cmos_read(uint8_t reg) >> @@ -195,8 +196,7 @@ static void test_no_media_on_start(void) >> assert_bit_set(dir, DSKCHG); >> dir = inb(FLOPPY_BASE + reg_dir); >> assert_bit_set(dir, DSKCHG); >> - send_step_pulse(); >> - send_step_pulse(); >> + send_step_pulse(1); > This is a bool parameter, so you should pass true/false instead of 0/1. > > Other than that, the test case additions look good and I'll accept it as > sufficient for the DSKCHG handling change. It would be great, though, to > add some more cases that test the implicit seeks during commands like > READ (ideally one for each command that can seek). > > Kevin I'll fix the bool parameter and then I'll create new patches for more test cases. Pavel