From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buFJf-0005at-6X for qemu-devel@nongnu.org; Wed, 12 Oct 2016 04:55:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buFJZ-0004Fh-2K for qemu-devel@nongnu.org; Wed, 12 Oct 2016 04:55:10 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36225 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buFJY-0004FT-TH for qemu-devel@nongnu.org; Wed, 12 Oct 2016 04:55:05 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9C8sPGW049932 for ; Wed, 12 Oct 2016 04:55:04 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 261djycym8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 12 Oct 2016 04:55:03 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Oct 2016 02:55:03 -0600 References: <20160928204644.11523-1-mreitz@redhat.com> From: Hao QingFeng Date: Wed, 12 Oct 2016 16:55:14 +0800 MIME-Version: 1.0 In-Reply-To: <20160928204644.11523-1-mreitz@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Message-Id: <1b3f7281-eaa6-586b-0f3c-f30cebf88322@linux.vnet.ibm.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v4 0/3] iotests: Fix test 162 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-block@nongnu.org Cc: Kevin Wolf , Sascha Silbe , qemu-devel@nongnu.org, Stefan Hajnoczi Max, Just a common question for this case, if sshx block driver wasn't built=20 into qemu-img, this case would fail as below: exec /home/haoqf/KVMonz/qemu/tests/qemu-iotests/../../qemu-img info=20 --image-opts driver=3Dssh,host=3Dlocalhost,port=3D0.42,path=3D/foo qemu-img: Could not open=20 'driver=3Dssh,host=3Dlocalhost,port=3D0.42,path=3D/foo': Unknown driver '= ssh' Adding 162.notrun can bypass this case but it would skip it even if=20 qemu-img has sshx block driver, in which case I think it should be run. So How about adding a script to dynamically check at runtime if the=20 current env qemu-img can meet the requirement to run the test or not? I made a sample here whose result is: [Without sshx built in] ./check -qcow2 162 ... ... 162 0s ... [not run] case 162 not applicable! Not run: 162 Passed all 0 tests [Without sshx built in] ./check -qcow2 162 ... ... 162 0s ... Passed all 1 tests Rough code patch is(new file 162.check is introduced to check if sshx is=20 built in): diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 4cba215..e7ef395 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -18,7 +18,6 @@ # # Control script for QA # - status=3D0 needwrap=3Dtrue try=3D0 @@ -291,6 +290,24 @@ do start=3D`_wallclock` $timestamp && echo -n " ["`date "+%T"`"]" + check_ret=3D0 + if [ -f "$source_iotests/$seq.check" -a -x=20 "$source_iotests/$seq.check" ]; then + if [ "$(head -n 1 "$source_iotests/$seq.check")" =3D=3D=20 "#!/usr/bin/env python" ]; then + $PYTHON $seq.check + else + ./$seq.check + fi + check_ret=3D$? + fi + if [ $check_ret -ne 0 ]; then + $timestamp || echo -n " [not run] " + $timestamp && echo " [not run]" && echo -n " $seq -- = " + echo "case $seq not applicable!" + notrun=3D"$notrun $seq" + seq=3D"after_$seq" + continue + fi + if [ "$(head -n 1 "$source_iotests/$seq")" =3D=3D "#!/usr/bin/e= nv=20 python" ]; then run_command=3D"$PYTHON $seq" else diff --git a/tests/qemu-iotests/162.check b/tests/qemu-iotests/162.check new file mode 100755 index 0000000..a80df7a --- /dev/null +++ b/tests/qemu-iotests/162.check @@ -0,0 +1,35 @@ +#!/bin/bash +#Return 0 if the case can run, others can not +#Typically the block drivers can be queried by "qemu-img --help" and +#the output is as: +#Supported formats: dmg luks ssh sheepdog nbd null-aio null-co=20 host_cdrom host_device file blkreplay blkverify blkdebug parallels=20 quorum qed qcow2 vvfat vpc bochs cloop vmdk vdi qcow raw +#set -x + +#. ./common.config +found=3D0 +. ./common.rc +. ./common.filter +#_supported_fmt generic +#_supported_os Linux +blk_drivers=3D`$QEMU_IMG --help|grep "Supported formats:"|sed=20 's/Supported formats://'` +#echo "drivers:"$blk_drivers +#echo $blk_drivers|awk '{print $0}' +found=3D$( +echo $blk_drivers|awk '{n=3Dsplit($0, arr_drivers, " "); + for(i=3D1; i<=3Dn; i++) print arr_drivers[i]}' | { while=20 read driver + do + if [ "$driver"x =3D "sshx" ]; then + echo 1 + exit + fi + done + echo 0 + } +) + +#echo "ret:$found" +if [ "$found" =3D "1" ]; then + exit 0 +fi + +exit 1 Thanks! Hao QingFeng =E5=9C=A8 2016-09-29 4:46, Max Reitz =E5=86=99=E9=81=93: > 162 is potentially racy and makes some invalid assumptions about what > should happen when connecting to a non-existing domain name. This serie= s > fixes both issues. > > > v4: > - Added documentation for the new --fork option [Kevin] > > > git-backport-diff against v3: > > Key: > [----] : patches are identical > [####] : number of functional differences between upstream/downstream > patch > [down] : patch is downstream-only > The flags [FC] indicate (F)unctional and (C)ontextual differences, > respectively > > 001/3:[0004] [FC] 'qemu-nbd: Add --fork option' > 002/3:[----] [--] 'iotests: Remove raciness from 162' > 003/3:[----] [--] 'iotests: Do not rely on unavailable domains in 162' > > > Max Reitz (3): > qemu-nbd: Add --fork option > iotests: Remove raciness from 162 > iotests: Do not rely on unavailable domains in 162 > > qemu-nbd.c | 17 ++++++++++++++++- > qemu-nbd.texi | 2 ++ > tests/qemu-iotests/162 | 22 ++++++++++++++++------ > tests/qemu-iotests/162.out | 2 +- > 4 files changed, 35 insertions(+), 8 deletions(-) > --=20 QingFeng Hao