From nobody Sun Apr 28 17:52:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148590942835680.248406127061; Tue, 31 Jan 2017 16:37:08 -0800 (PST) Received: from localhost ([::1]:41953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYiux-0006aC-SP for importer@patchew.org; Tue, 31 Jan 2017 19:36:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYiqg-0003zt-KX for qemu-devel@nongnu.org; Tue, 31 Jan 2017 19:32:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYiqe-0001OH-6m for qemu-devel@nongnu.org; Tue, 31 Jan 2017 19:32:34 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34376) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYiqd-0001Me-SK; Tue, 31 Jan 2017 19:32:32 -0500 Received: by mail-wm0-x244.google.com with SMTP id c85so1993716wmi.1; Tue, 31 Jan 2017 16:32:31 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jan 2017 16:32:29 -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=XBXov5JGlBP2M1VVobhUSkaCEjHIvay+ES7WryAMgSE=; b=CALKfUsMMcfeAnomENfDitwrTqY6fghXkzEFptMR0GZKxl56674PlsW8Owv+h0+dYa TgNKwL7Fl0JwmKPVmrBjQgE5jm1c/te1R/jx1HLr+NQEQlDNlx28m5Z6ONI9nQKdueMA vTg+yhoxygiDKgPzl6MoPqQsIytxsBD2iOv3/nm6YgXchel7dr+6o138O0owGDGC8MV2 pKdKPWXksNEpzU+oDI1PY6XTnG8nMH0n9ZwTejpXb3Didn6xBQBtYjZCTBut2Ib/DCga DjQJL5smqsk1tA81s3/B2/D1TVlLNyPvmmYUWjc1Sk3OvyMhm9qMqQJeELvMKgM5bU2j 3DdQ== 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=XBXov5JGlBP2M1VVobhUSkaCEjHIvay+ES7WryAMgSE=; b=uKk2bFJk/HYN6MiyIuT04DzsdvyrOk2BwOiK+oYIKjC7sMApmJ8pwRH/CvlygmHEbz ucW3J56B1N8DEgIMH4lng8Z0/7GOkcXk7LmHLl46sqQP/d2KLHAGmMESBoE/EXn2nQ1O xI7OGSd9te2Q6Fz+k11VY3zB4udaEp1RLl1UWRNQ9qb/NV7end5sBO6cVoewj4RvxeOn l+GtQWY3ejnTgokVwJTOSqCcCKkqQViLHj0F8iUsujZ1WW6JvxtwWvIcJ9yXLeyHhngw /ituIdTUjJ+jwhWH1AGEe7+XKZ3qhoZkK9Rew9tf+FYsGj/YIYUoXAU1JyPBmPhdEzN/ GXZQ== X-Gm-Message-State: AIkVDXJaPhFa3B/2IAsh0Xi3xA4YyjiLT/CK43ep3u88NSol0pa4uipJMWXMsi6QwFZQFg== X-Received: by 10.223.145.227 with SMTP id 90mr67442wri.156.1485909150409; Tue, 31 Jan 2017 16:32:30 -0800 (PST) From: Nir Soffer To: qemu-devel@nongnu.org Date: Wed, 1 Feb 2017 02:31:18 +0200 Message-Id: <20170201003120.23378-2-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::244 Subject: [Qemu-devel] [PATCH v5 1/3] qemu-io: Return non-zero exit code on failure 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The result of openfile was not checked, leading to failure deep in the actual command with confusing error message, and exiting with exit code 0. Here is a simple example - trying to read with the wrong format: $ touch file $ qemu-io -f qcow2 -c 'read -P 1 0 1024' file; echo $? can't open device file: Image is not in qcow2 format no file open, try 'help open' 0 With this patch, we fail earlier with exit code 1: $ ./qemu-io -f qcow2 -c 'read -P 1 0 1024' file; echo $? can't open device file: Image is not in qcow2 format 1 Failing earlier, we don't log this error now: no file open, try 'help open' But some tests expected it; the line was removed from the test output. Signed-off-by: Nir Soffer Reviewed-by: Eric Blake --- qemu-io.c | 8 ++++++-- tests/qemu-iotests/059.out | 3 --- tests/qemu-iotests/070.out | 1 - tests/qemu-iotests/075.out | 7 ------- tests/qemu-iotests/076.out | 3 --- tests/qemu-iotests/078.out | 6 ------ tests/qemu-iotests/080.out | 18 ------------------ tests/qemu-iotests/083.out | 17 ----------------- tests/qemu-iotests/088.out | 6 ------ tests/qemu-iotests/092.out | 12 ------------ tests/qemu-iotests/116.out | 7 ------- tests/qemu-iotests/131.out | 1 - tests/qemu-iotests/140.out | 1 - 13 files changed, 6 insertions(+), 84 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index 23a229f..427cbae 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -595,13 +595,17 @@ int main(int argc, char **argv) exit(1); } opts =3D qemu_opts_to_qdict(qopts, NULL); - openfile(NULL, flags, writethrough, opts); + if (openfile(NULL, flags, writethrough, opts)) { + exit(1); + } } else { if (format) { opts =3D qdict_new(); qdict_put(opts, "driver", qstring_from_str(format)); } - openfile(argv[optind], flags, writethrough, opts); + if (openfile(argv[optind], flags, writethrough, opts)) { + exit(1); + } } } command_loop(); diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out index 678adb4..898b528 100644 --- a/tests/qemu-iotests/059.out +++ b/tests/qemu-iotests/059.out @@ -3,17 +3,14 @@ QA output created by 059 =3D=3D=3D Testing invalid granularity =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.vmdk: Invalid granularity, image may be corru= pt -no file open, try 'help open' =20 =3D=3D=3D Testing too big L2 table size =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.vmdk: L2 table size too big -no file open, try 'help open' =20 =3D=3D=3D Testing too big L1 table size =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.vmdk: L1 size too big -no file open, try 'help open' =20 =3D=3D=3D Testing monolithicFlat creation and opening =3D=3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2147483648 subformat= =3DmonolithicFlat diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out index 131a5b1..c269d99 100644 --- a/tests/qemu-iotests/070.out +++ b/tests/qemu-iotests/070.out @@ -4,7 +4,6 @@ QA output created by 070 can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'T= EST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log t= hat needs to be replayed To replay the log, run: qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' - no file open, try 'help open' =3D=3D=3D Verify open image replays log =3D=3D=3D read 18874368/18874368 bytes at offset 0 18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/qemu-iotests/075.out b/tests/qemu-iotests/075.out index 87beae4..b234b75 100644 --- a/tests/qemu-iotests/075.out +++ b/tests/qemu-iotests/075.out @@ -10,29 +10,22 @@ read 512/512 bytes at offset 1048064 =20 =3D=3D block_size must be a multiple of 512 =3D=3D can't open device TEST_DIR/simple-pattern.cloop: block_size 513 must be a = multiple of 512 -no file open, try 'help open' =20 =3D=3D block_size cannot be zero =3D=3D can't open device TEST_DIR/simple-pattern.cloop: block_size cannot be zero -no file open, try 'help open' =20 =3D=3D huge block_size =3D=3D=3D can't open device TEST_DIR/simple-pattern.cloop: block_size 4294966784 mus= t be 64 MB or less -no file open, try 'help open' =20 =3D=3D offsets_size overflow =3D=3D=3D can't open device TEST_DIR/simple-pattern.cloop: n_blocks 4294967295 must = be 536870911 or less -no file open, try 'help open' =20 =3D=3D refuse images that require too many offsets =3D=3D=3D can't open device TEST_DIR/simple-pattern.cloop: image requires too many o= ffsets, try increasing block size -no file open, try 'help open' =20 =3D=3D refuse images with non-monotonically increasing offsets =3D=3D can't open device TEST_DIR/simple-pattern.cloop: offsets not monotonically= increasing at index 1, image file is corrupt -no file open, try 'help open' =20 =3D=3D refuse images with invalid compressed block size =3D=3D can't open device TEST_DIR/simple-pattern.cloop: invalid compressed block = size at index 1, image file is corrupt -no file open, try 'help open' *** done diff --git a/tests/qemu-iotests/076.out b/tests/qemu-iotests/076.out index 72645b2..9c66c5f 100644 --- a/tests/qemu-iotests/076.out +++ b/tests/qemu-iotests/076.out @@ -6,15 +6,12 @@ read 65536/65536 bytes at offset 0 =20 =3D=3D Negative catalog size =3D=3D can't open device TEST_DIR/parallels-v1: Catalog too large -no file open, try 'help open' =20 =3D=3D Overflow in catalog allocation =3D=3D can't open device TEST_DIR/parallels-v1: Catalog too large -no file open, try 'help open' =20 =3D=3D Zero sectors per track =3D=3D can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per t= rack -no file open, try 'help open' =20 =3D=3D Read from a valid v2 image =3D=3D read 65536/65536 bytes at offset 0 diff --git a/tests/qemu-iotests/078.out b/tests/qemu-iotests/078.out index 42b8a83..c3d6aa4 100644 --- a/tests/qemu-iotests/078.out +++ b/tests/qemu-iotests/078.out @@ -6,23 +6,17 @@ read 512/512 bytes at offset 0 =20 =3D=3D Negative catalog size =3D=3D can't open device TEST_DIR/empty.bochs: Catalog size is too large -no file open, try 'help open' =20 =3D=3D Overflow for catalog size * sizeof(uint32_t) =3D=3D can't open device TEST_DIR/empty.bochs: Catalog size is too large -no file open, try 'help open' =20 =3D=3D Too small catalog bitmap for image size =3D=3D can't open device TEST_DIR/empty.bochs: Catalog size is too small for this= disk size -no file open, try 'help open' can't open device TEST_DIR/empty.bochs: Catalog size is too small for this= disk size -no file open, try 'help open' =20 =3D=3D Negative extent size =3D=3D can't open device TEST_DIR/empty.bochs: Extent size 2147483648 is too large -no file open, try 'help open' =20 =3D=3D Zero extent size =3D=3D can't open device TEST_DIR/empty.bochs: Extent size must be at least 512 -no file open, try 'help open' *** done diff --git a/tests/qemu-iotests/080.out b/tests/qemu-iotests/080.out index 0daac48..6a7fda1 100644 --- a/tests/qemu-iotests/080.out +++ b/tests/qemu-iotests/080.out @@ -3,46 +3,33 @@ QA output created by 080 =3D=3D Huge header size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size -no file open, try 'help open' =20 =3D=3D Huge unknown header extension =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow2: Invalid backing file offset -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Header extension too large -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Header extension too large -no file open, try 'help open' =20 =3D=3D Huge refcount table size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow2: Reference count table too large -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Reference count table too large -no file open, try 'help open' =20 =3D=3D Misaligned refcount table =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow2: Invalid reference count table offset -no file open, try 'help open' =20 =3D=3D Huge refcount offset =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow2: Invalid reference count table offset -no file open, try 'help open' =20 =3D=3D Invalid snapshot table =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow2: Too many snapshots -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Too many snapshots -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Invalid snapshot table offset -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Invalid snapshot table offset -no file open, try 'help open' =20 =3D=3D Hitting snapshot table size limit =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 @@ -53,13 +40,9 @@ read 512/512 bytes at offset 0 =3D=3D Invalid L1 table =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow2: Active L1 table too large -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Active L1 table too large -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Invalid L1 table offset -no file open, try 'help open' can't open device TEST_DIR/t.qcow2: Invalid L1 table offset -no file open, try 'help open' =20 =3D=3D Invalid L1 table (with internal snapshot in the image) =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 @@ -68,7 +51,6 @@ qemu-img: Could not open 'TEST_DIR/t.IMGFMT': L1 table is= too small =3D=3D Invalid backing file size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow2: Backing file name too long -no file open, try 'help open' =20 =3D=3D Invalid L2 entry (huge physical offset) =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 diff --git a/tests/qemu-iotests/083.out b/tests/qemu-iotests/083.out index ef3d1e3..0c13888 100644 --- a/tests/qemu-iotests/083.out +++ b/tests/qemu-iotests/083.out @@ -2,52 +2,42 @@ QA output created by 083 =3D=3D=3D Check disconnect before neg1 =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect after neg1 =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 8 neg1 =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 16 neg1 =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect before export =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect after export =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 4 export =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 12 export =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 16 export =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect before neg2 =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect after neg2 =3D=3D=3D =20 @@ -56,12 +46,10 @@ read failed: Input/output error =3D=3D=3D Check disconnect 8 neg2 =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 10 neg2 =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT:exportname=3Dfoo -no file open, try 'help open' =20 =3D=3D=3D Check disconnect before request =3D=3D=3D =20 @@ -99,27 +87,22 @@ read 512/512 bytes at offset 0 =3D=3D=3D Check disconnect before neg-classic =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 8 neg-classic =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 16 neg-classic =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 24 neg-classic =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT -no file open, try 'help open' =20 =3D=3D=3D Check disconnect 28 neg-classic =3D=3D=3D =20 can't open device nbd:127.0.0.1:PORT -no file open, try 'help open' =20 =3D=3D=3D Check disconnect after neg-classic =3D=3D=3D =20 diff --git a/tests/qemu-iotests/088.out b/tests/qemu-iotests/088.out index a2a83b8..1f6bcf0 100644 --- a/tests/qemu-iotests/088.out +++ b/tests/qemu-iotests/088.out @@ -3,15 +3,9 @@ QA output created by 088 =3D=3D Invalid block size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.vpc: Invalid block size 0 -no file open, try 'help open' can't open device TEST_DIR/t.vpc: Invalid block size 0 -no file open, try 'help open' can't open device TEST_DIR/t.vpc: Invalid block size 128 -no file open, try 'help open' can't open device TEST_DIR/t.vpc: Invalid block size 128 -no file open, try 'help open' can't open device TEST_DIR/t.vpc: Invalid block size 305419896 -no file open, try 'help open' can't open device TEST_DIR/t.vpc: Invalid block size 305419896 -no file open, try 'help open' *** done diff --git a/tests/qemu-iotests/092.out b/tests/qemu-iotests/092.out index e18f54c..6eda321 100644 --- a/tests/qemu-iotests/092.out +++ b/tests/qemu-iotests/092.out @@ -3,36 +3,24 @@ QA output created by 092 =3D=3D Invalid cluster size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k -no file open, try 'help open' can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k -no file open, try 'help open' can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k -no file open, try 'help open' can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k -no file open, try 'help open' =20 =3D=3D Invalid L2 table size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 6= 4k -no file open, try 'help open' can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 6= 4k -no file open, try 'help open' can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 6= 4k -no file open, try 'help open' can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 6= 4k -no file open, try 'help open' =20 =3D=3D Invalid size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow: Image too large -no file open, try 'help open' can't open device TEST_DIR/t.qcow: Image too large -no file open, try 'help open' =20 =3D=3D Invalid backing file length =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 can't open device TEST_DIR/t.qcow: Backing file name too long -no file open, try 'help open' can't open device TEST_DIR/t.qcow: Backing file name too long -no file open, try 'help open' *** done diff --git a/tests/qemu-iotests/116.out b/tests/qemu-iotests/116.out index 1f11d44..24bee57 100644 --- a/tests/qemu-iotests/116.out +++ b/tests/qemu-iotests/116.out @@ -3,35 +3,28 @@ QA output created by 116 =3D=3D truncated header cluster =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid= argument -no file open, try 'help open' =20 =3D=3D invalid header magic =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 can't open device TEST_DIR/t.qed: Image not in QED format -no file open, try 'help open' =20 =3D=3D invalid cluster size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid= argument -no file open, try 'help open' =20 =3D=3D invalid table size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid= argument -no file open, try 'help open' =20 =3D=3D invalid header size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid= argument -no file open, try 'help open' =20 =3D=3D invalid L1 table offset =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid= argument -no file open, try 'help open' =20 =3D=3D invalid image size =3D=3D Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 can't open device TEST_DIR/t.qed: Could not open 'TEST_DIR/t.qed': Invalid= argument -no file open, try 'help open' *** done diff --git a/tests/qemu-iotests/131.out b/tests/qemu-iotests/131.out index ae2412e..27c2c53 100644 --- a/tests/qemu-iotests/131.out +++ b/tests/qemu-iotests/131.out @@ -23,7 +23,6 @@ read 32768/32768 bytes at offset 0 32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =3D=3D Corrupt image =3D=3D can't open device TEST_DIR/t.parallels: parallels: Image was not closed co= rrectly; cannot be opened read/write -no file open, try 'help open' ERROR image was not closed correctly =20 1 errors were found on the image. diff --git a/tests/qemu-iotests/140.out b/tests/qemu-iotests/140.out index 0409cd0..6c04456 100644 --- a/tests/qemu-iotests/140.out +++ b/tests/qemu-iotests/140.out @@ -9,7 +9,6 @@ read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": {}} can't open device nbd+unix:///drv?socket=3DTEST_DIR/nbd: No export with na= me 'drv' available -no file open, try 'help open' {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN"} *** done --=20 2.9.3 From nobody Sun Apr 28 17:52:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1485909259458571.2544055962557; Tue, 31 Jan 2017 16:34:19 -0800 (PST) Received: from localhost ([::1]:41935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYisL-0004p7-Ci for importer@patchew.org; Tue, 31 Jan 2017 19:34:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYiqf-0003zn-Sc for qemu-devel@nongnu.org; Tue, 31 Jan 2017 19:32:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYiqf-0001P0-4p for qemu-devel@nongnu.org; Tue, 31 Jan 2017 19:32:33 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34379) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYiqe-0001OV-VQ; Tue, 31 Jan 2017 19:32:33 -0500 Received: by mail-wm0-x242.google.com with SMTP id c85so1993778wmi.1; Tue, 31 Jan 2017 16:32:32 -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.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jan 2017 16:32:31 -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=V77kzbdvexJFO5fqRKc+v+GnkeRPJMsTqUqwXzSSRiM=; b=GNljaJJCP0a/I/yBuzJJaGYfxDzjv5qP3N7+zO24b6+bZy6Gh6+SQ4plL9/3Mdd7rz YT7jZn8vNh7s1CVMFMpAjax8Imz0pwrqmRCb1/GMI+A1BiE8zDjyGuqA/CpViVI6sLKt zs3V6qIeZRN7CuXDB1pJt3d7iIifVe2QozvJp0RvbO+RobIRgFI2PlNSQtA1iT56L/6b DhOv0Z06pMp6vB0guM1hPxmkmYpm1JyAWIylvd56+kjLtaeYmAjzMpG+ZNRByEmsAvnV rYmwlqvgup7t/bM7jIUzR/Hz6yAnyNe2cYykl/rbvhyvVxQ+cOG1D2v+m90NnK18bpgS dm5Q== 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=V77kzbdvexJFO5fqRKc+v+GnkeRPJMsTqUqwXzSSRiM=; b=tCA2lIV8h/3ThjRknHNMxZT1yDENhbULxhwWEebx6YbuMqUddD8r3j9XGICPnc3Zle m/njm5wQyRmH/gHlG9qTKeb0mf/9ADhN8r/vaJGLWd18iHBKZK0TIOp9wHAn5zPBeHfb yb7suGM/9eP36Jtyk1xkEgnprFX60rW/wWKVoXml1LAolvfKn2Cuz2mEkAFdGfBUyj91 OC6soP0qoDOULmuG9yFxu9qA76DbXGTvqdcmSub4qP9gkfbqvarjtEbfrBbxYeUU19wB becqMwXyvUjGcIYzbjFOfEziIFyG505xtENDju+FORE3bfWFd74BgyDa0MW/38ozyWgL bZ3g== X-Gm-Message-State: AIkVDXJy9d/t2bFaHaeo1+xocPeiVwpcg8MA1eoa3lsEDwK3/+3s3vW90wPSvqcZqBgK9Q== X-Received: by 10.223.161.158 with SMTP id u30mr63075wru.152.1485909151873; Tue, 31 Jan 2017 16:32:31 -0800 (PST) From: Nir Soffer To: qemu-devel@nongnu.org Date: Wed, 1 Feb 2017 02:31:19 +0200 Message-Id: <20170201003120.23378-3-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::242 Subject: [Qemu-devel] [PATCH v5 2/3] qemu-iotests: Add _unsupported_fmt helper 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This helper allows adding tests supporting any format expect the specified formats. This may be useful to test that many formats behave in a common way. Signed-off-by: Nir Soffer --- tests/qemu-iotests/common.rc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 3213765..c6d5d81 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -355,6 +355,17 @@ _supported_fmt() _notrun "not suitable for this image format: $IMGFMT" } =20 +# tests whether $IMGFMT is one of the unsupported image format for a test +# +_unsupported_fmt() +{ + for f; do + if [ "$f" =3D "$IMGFMT" ]; then + _notrun "not suitable for this image format: $IMGFMT" + fi + done +} + # tests whether $IMGPROTO is one of the supported image protocols for a te= st # _supported_proto() --=20 2.9.3 From nobody Sun Apr 28 17:52:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148590953688094.9068711626561; Tue, 31 Jan 2017 16:38:56 -0800 (PST) Received: from localhost ([::1]:41957 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYiwo-0008Lj-Tx for importer@patchew.org; Tue, 31 Jan 2017 19:38:54 -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) 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) 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) 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=3Dnirsof@gmail.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # 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=3D256K +IMGFMT=3Draw IMGOPTS=3D _make_test_img $size | _filter_imgfmt + +echo +echo "=3D=3D reading wrong format should fail =3D=3D" +$QEMU_IO -f $IMGFMT -c "read 0 $size" "$TEST_IMG" 2>/dev/null +test $? -eq 1 || _fail "did not fail" + +echo +echo "=3D=3D reading missing file should fail =3D=3D" +$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=3D0 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=3DIMGFMT size=3D262144 + +=3D=3D reading wrong format should fail =3D=3D + +=3D=3D reading missing file should fail =3D=3D +*** 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 --=20 2.9.3