From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsDbt-00033w-Mh for qemu-devel@nongnu.org; Fri, 30 Oct 2015 13:37:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZsDbq-00058N-GW for qemu-devel@nongnu.org; Fri, 30 Oct 2015 13:37:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsDbq-00058H-9l for qemu-devel@nongnu.org; Fri, 30 Oct 2015 13:37:02 -0400 References: <1446189186-23104-1-git-send-email-tubo@linux.vnet.ibm.com> From: Eric Blake Message-ID: <5633AAB3.50606@redhat.com> Date: Fri, 30 Oct 2015 11:36:51 -0600 MIME-Version: 1.0 In-Reply-To: <1446189186-23104-1-git-send-email-tubo@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="x2pVxlkXMlW0owGmaG8FEnthX6l49nTh2" Subject: Re: [Qemu-devel] [PATCH v1 1/4] qemu-iotests: refine common.config List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bo Tu , qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, mimu@linux.vnet.ibm.com, armbru@redhat.com, silbe@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --x2pVxlkXMlW0owGmaG8FEnthX6l49nTh2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/30/2015 01:13 AM, Bo Tu wrote: > Be easier to read, and be slightly shorter. You mentioned a very short "what" in the subject line (good), but the "why" in the commit body ("easier to read, shorter") is rather terse and subjective. It would be nicer to go into details (change the definition of default_alias_machine) or give a sample of what changes (use grep instead of awk). [meta-comment] When sending a series, please include a 0/4 cover letter. You may want to do: git config format.coverLetter auto to make it automatic when using git format-patch/send-email. >=20 > Suggested-By: Sascha Silbe > Reviewed-by: Sascha Silbe > Signed-off-by: Bo Tu > --- > tests/qemu-iotests/common.config | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) >=20 > diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/comm= on.config > index 596bb2b..0a165e8 100644 > --- a/tests/qemu-iotests/common.config > +++ b/tests/qemu-iotests/common.config > @@ -129,10 +129,9 @@ export QEMU_IO=3D_qemu_io_wrapper > export QEMU_NBD=3D_qemu_nbd_wrapper > =20 > default_machine=3D$($QEMU -machine \? | awk '/(default)/{print $1}') > -default_alias_machine=3D$($QEMU -machine \? |\ > - awk -v var_default_machine=3D"$default_machine"\)\ > - '{if ($(NF-2)=3D=3D"(alias"&&$(NF-1)=3D=3D"of"&&$(NF)=3D=3Dvar_def= ault_machine){print $1}}') > -if [ ! -z "$default_alias_machine" ]; then > +default_alias_machine=3D$($QEMU -machine \? \ As long as we are touching this, we ought to switch to using '-machine help' rather than the deprecated '-machine \?'. > + | grep -F "(alias of ${default_machine})" |cut -d ' ' -f 1 |head -= n 1) Why are you moving the | across lines? If we are rewriting to avoid awk, why not do it with a single sed process, rather than a grep|cut|head pipeline? For that matter, why not rewrite default_machine to also avoid awk? default_machine=3D$($QEMU -machine help | sed -n '/(default)/ s/ .*//p') default_alias_machine=3D$($QEMU -machine help | \ sed -n "/(alias of $default_machine)"' { s/ .*//p; q; }') (which happens to work even if $default_machine contains '.', but might get a bit dicey if the machine names could ever contain ?, [, *, or other regex metacharacters) > +if [ -n "$default_alias_machine" ]; then Could shorten this to: if [[ $default_alias_machine ]]; then since we are already using bash. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --x2pVxlkXMlW0owGmaG8FEnthX6l49nTh2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWM6qzAAoJEKeha0olJ0NqrC4H+QFyUXYcHp1IyTOMaHaw09Gz aiWZZO09pT3Jug2ZC/7lFo0AUpn2VWCBPlKOr63X113hdcL88W8QkDTC32Yzh6yh ft5aet17YtqxeNWf2rsHOZ/NNGm6PZvfzux2i9ay28kgqeMW/RXPuSI9uztxjw3A nplUnM5jLsQq2TxlOy2OVm/5HtyPnoSI8Bbx1oXkQldBI3zoL3o9zrgL8RadRNfp C5gaIyoVcJIq+WNj91snG4x90oFWfTt5uR/7QRm3g1WI77RBBSdCQWngNJ98aiwF L0ZOkADAC0uYWi+WXoNf4uKCDlgTxDPCF3LKehRBC5HTv53FBiVwoc7S8DBW1oI= =Nm12 -----END PGP SIGNATURE----- --x2pVxlkXMlW0owGmaG8FEnthX6l49nTh2--