From patchwork Wed Feb 1 00:31:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Soffer X-Patchwork-Id: 9548811 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E5BC760416 for ; Wed, 1 Feb 2017 00:38:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3A2E27D5E for ; Wed, 1 Feb 2017 00:38:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C839628408; Wed, 1 Feb 2017 00:38:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1DB5D27D5E for ; Wed, 1 Feb 2017 00:38:20 +0000 (UTC) Received: from localhost ([::1]:41956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYiwF-0007Js-K9 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 31 Jan 2017 19:38:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYiqh-00040a-Vg for qemu-devel@nongnu.org; Tue, 31 Jan 2017 19:32:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYiqg-0001Pc-Sg for qemu-devel@nongnu.org; Tue, 31 Jan 2017 19:32:36 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35815) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYiqg-0001PC-L7; Tue, 31 Jan 2017 19:32:34 -0500 Received: by mail-wm0-x243.google.com with SMTP id u63so1985787wmu.2; Tue, 31 Jan 2017 16:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=F103ty3ASrT5q4tMTwaL5F2yo+WZLBTJNfdqrDxphfE=; b=R4QRvFZLhcNm7vRxSToeZd84TzcFS8yMZ7LQWWEGcV+gL0tzj7ZxLA+oF3p6c0XV+1 BrUxEkvuUqVExBmdLEOiLJeO3zFg3mv/KpqMTc5iTwotoqXMcgTsiN2s64tUMeThHO9d deRRS/RtX1+V7FrZkDsgZ7tvm3/iRWfQ7mAfbIc8NXDWUSPahC7UdyMsVyRWRS/Tu5t0 SSqNBORBBYRNHkWHuvJTTmlheAzjtxeleqRz7W8T1EPzKk4fNjYMDMheeAJ3BvjopJA3 pRcDWLlCmg6vBtZp89MVarcYEe1v19XzS2SforETgvog24mzyn4FPLvUztHWIKA/yoKr tKaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=F103ty3ASrT5q4tMTwaL5F2yo+WZLBTJNfdqrDxphfE=; b=k5WECh/tnfl4ErEjqwwo9MLuNY6n5X2xH5W7nm71IQ4yk3nOdd1anpGCncS2VhGN6J pdQb2k+VBiUU71FnYJrm/ORS918/IEInJDSxw8Xm2PdXB/P0P8ZyXt9QFk/MGjL3BWLb ydt6ZyHa//ZCdN8ZPlBDcDJ5fmgASy/xbct7oe4MMfROsiB5WwpisMDqfsaWJuBwRbpW 8ySnwLUBb9+oQ5UXGQXEz6IPojM55APUGguTrbBjG1z3W7FE/Dt+dltgwbw704a8HRBf cn4CXpeYIcJSlL/sDfXH0FQVqmVo3JuaogpdZ4GMpZ8n3bKBfpRDWgZpuWJXzjZu8CIW +ZWg== X-Gm-Message-State: AIkVDXK+8+3KbXmrm+fwFYX2Adz6mJ0pwlW/2K9KkA+BLHFuia2Mq1j6RsDcqj7/ramvPg== X-Received: by 10.223.145.45 with SMTP id j42mr47707wrj.141.1485909153278; Tue, 31 Jan 2017 16:32:33 -0800 (PST) Received: from lean.local (bzq-79-181-80-51.red.bezeqint.net. [79.181.80.51]) by smtp.gmail.com with ESMTPSA id e14sm26518840wmd.14.2017.01.31.16.32.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jan 2017 16:32:32 -0800 (PST) From: Nir Soffer To: qemu-devel@nongnu.org Date: Wed, 1 Feb 2017 02:31:20 +0200 Message-Id: <20170201003120.23378-4-nirsof@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170201003120.23378-1-nirsof@gmail.com> References: <20170201003120.23378-1-nirsof@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PATCH v5 3/3] qemu-io: Add failure regression tests 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: kwolf@redhat.com, Nir Soffer , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add regression tests checking that qemu-io fails with non-zero exit code when reading non-existing file or using the wrong image format. Signed-off-by: Nir Soffer --- tests/qemu-iotests/174 | 59 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/174.out | 7 ++++++ tests/qemu-iotests/group | 1 + 3 files changed, 67 insertions(+) create mode 100755 tests/qemu-iotests/174 create mode 100644 tests/qemu-iotests/174.out diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174 new file mode 100755 index 0000000..c1c20a1 --- /dev/null +++ b/tests/qemu-iotests/174 @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Test that qemu-io fail with non-zero exit code +# +# Copyright (C) 2017 Nir Soffer +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=nirsof@gmail.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_unsupported_fmt raw + + +size=256K +IMGFMT=raw IMGOPTS= _make_test_img $size | _filter_imgfmt + +echo +echo "== reading wrong format should fail ==" +$QEMU_IO -f $IMGFMT -c "read 0 $size" "$TEST_IMG" 2>/dev/null +test $? -eq 1 || _fail "did not fail" + +echo +echo "== reading missing file should fail ==" +$QEMU_IO -c "read 0 $size" "$TEST_DIR/missing" 2>/dev/null +test $? -eq 1 || _fail "did not fail" + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/174.out b/tests/qemu-iotests/174.out new file mode 100644 index 0000000..a06d237 --- /dev/null +++ b/tests/qemu-iotests/174.out @@ -0,0 +1,7 @@ +QA output created by 174 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=262144 + +== reading wrong format should fail == + +== reading missing file should fail == +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 866c1a0..1732a8b 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -165,3 +165,4 @@ 170 rw auto quick 171 rw auto quick 172 auto +174 auto