From patchwork Fri Jun 22 10:33:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Hrdina X-Patchwork-Id: 166572 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3F2D1B6EF1 for ; Fri, 22 Jun 2012 20:44:23 +1000 (EST) Received: from localhost ([::1]:37131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si1Ca-00019Y-4r for incoming@patchwork.ozlabs.org; Fri, 22 Jun 2012 06:34:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si1Bq-0007YB-OZ for qemu-devel@nongnu.org; Fri, 22 Jun 2012 06:34:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Si1Bp-00032z-4k for qemu-devel@nongnu.org; Fri, 22 Jun 2012 06:34:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si1Bo-00032N-SW for qemu-devel@nongnu.org; Fri, 22 Jun 2012 06:34:09 -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 q5MAY7je015582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 22 Jun 2012 06:34:07 -0400 Received: from antique-laptop.brq.redhat.com (dhcp-27-171.brq.redhat.com [10.34.27.171]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5MAXvR0009017; Fri, 22 Jun 2012 06:34:06 -0400 From: Pavel Hrdina To: kwolf@redhat.com Date: Fri, 22 Jun 2012 12:33:57 +0200 Message-Id: In-Reply-To: References: In-Reply-To: <3359847e9dbdf4531ed17e86ef55be8b8676e329.1340360906.git.phrdina@redhat.com> References: <3359847e9dbdf4531ed17e86ef55be8b8676e329.1340360906.git.phrdina@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Pavel Hrdina , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v6 6/6] fdc_test: introduce test_sense_interrupt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Calling sense interrupt status while there is no interrupt should return invalid command (0x80). Read command should always returns in st0 seek_end bit set to 1. Signed-off-by: Pavel Hrdina --- tests/fdc-test.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-) diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 5280eff..be14d83 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -142,7 +142,7 @@ static uint8_t send_read_command(void) } st0 = floppy_recv(); - if (st0 != 0x40) { + if (st0 != 0x60) { ret = 1; } @@ -263,6 +263,28 @@ static void test_media_change(void) assert_bit_set(dir, DSKCHG); } +static void test_sense_interrupt(void) +{ + int drive = 0; + int head = 0; + int cyl = 0; + int ret = 0; + + floppy_send(CMD_SENSE_INT); + ret = floppy_recv(); + g_assert(ret == 0x80); + + floppy_send(CMD_SEEK); + floppy_send(head << 2 | drive); + g_assert(!get_irq(FLOPPY_IRQ)); + floppy_send(cyl); + + floppy_send(CMD_SENSE_INT); + ret = floppy_recv(); + g_assert(ret != 0x80); + floppy_recv(); +} + /* success if no crash or abort */ static void fuzz_registers(void) { @@ -310,6 +332,7 @@ int main(int argc, char **argv) qtest_add_func("/fdc/no_media_on_start", test_no_media_on_start); 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/fuzz-registers", fuzz_registers); ret = g_test_run();