From patchwork Sun Jun 4 15:45:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 770935 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wgjHV0mLCz9rxl for ; Mon, 5 Jun 2017 01:56:38 +1000 (AEST) Received: from localhost ([::1]:57402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHXtL-0001BR-Pn for incoming@patchwork.ozlabs.org; Sun, 04 Jun 2017 11:56:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHXpW-0006qh-95 for qemu-devel@nongnu.org; Sun, 04 Jun 2017 11:52:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHXpS-0004yy-BP for qemu-devel@nongnu.org; Sun, 04 Jun 2017 11:52:38 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:60421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHXpS-0004y8-2w; Sun, 04 Jun 2017 11:52:34 -0400 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 44857404E3; Sun, 4 Jun 2017 18:52:33 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id F2FA25F4; Sun, 4 Jun 2017 18:45:29 +0300 (MSK) Received: (nullmailer pid 16393 invoked by uid 1000); Sun, 04 Jun 2017 15:45:27 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Sun, 4 Jun 2017 18:45:23 +0300 Message-Id: <543f8f13e256a081dd820375e9575439b659ccd8.1496591095.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 19/22] ide-test: check return of fwrite X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Michael Tokarev , John Snow Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: John Snow To quiet patchew, add an assert for fwrite's return value. Signed-off-by: John Snow Reviewed-by: Jeff Cody Reviewed-by: Laurent Vivier Signed-off-by: Michael Tokarev --- tests/ide-test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/ide-test.c b/tests/ide-test.c index 139ebc0ec6..bfd79ddbdc 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -796,11 +796,13 @@ static void cdrom_pio_impl(int nblocks) int i, j; uint8_t data; uint16_t limit; + size_t ret; /* Prepopulate the CDROM with an interesting pattern */ generate_pattern(pattern, patt_len, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); - fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); + ret = fwrite(pattern, ATAPI_BLOCK_SIZE, patt_blocks, fh); + g_assert_cmpint(ret, ==, patt_blocks); fclose(fh); ide_test_start("-drive if=none,file=%s,media=cdrom,format=raw,id=sr0,index=0 " @@ -880,6 +882,7 @@ static void test_cdrom_pio_large(void) static void test_cdrom_dma(void) { static const size_t len = ATAPI_BLOCK_SIZE; + size_t ret; char *pattern = g_malloc(ATAPI_BLOCK_SIZE * 16); char *rx = g_malloc0(len); uintptr_t guest_buf; @@ -896,7 +899,8 @@ static void test_cdrom_dma(void) generate_pattern(pattern, ATAPI_BLOCK_SIZE * 16, ATAPI_BLOCK_SIZE); fh = fopen(tmp_path, "w+"); - fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh); + ret = fwrite(pattern, ATAPI_BLOCK_SIZE, 16, fh); + g_assert_cmpint(ret, ==, 16); fclose(fh); send_dma_request(CMD_PACKET, 0, 1, prdt, 1, send_scsi_cdb_read10);