From nobody Sun Oct 5 19:22:56 2025 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542650236407797.5379469056558; Mon, 19 Nov 2018 09:57:16 -0800 (PST) Received: from localhost ([::1]:58319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gOnnK-0001s9-B5 for importer@patchew.org; Mon, 19 Nov 2018 12:57:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gOnl0-00007C-90 for qemu-devel@nongnu.org; Mon, 19 Nov 2018 12:54:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gOnkx-0002Wx-Cb for qemu-devel@nongnu.org; Mon, 19 Nov 2018 12:54:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gOnkt-0002RJ-Nq; Mon, 19 Nov 2018 12:54:39 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13909307D844; Mon, 19 Nov 2018 17:54:39 +0000 (UTC) Received: from red.redhat.com (ovpn-121-142.rdu2.redhat.com [10.10.121.142]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19E685C70B; Mon, 19 Nov 2018 17:54:37 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Mon, 19 Nov 2018 11:54:18 -0600 Message-Id: <20181119175427.2298497-4-eblake@redhat.com> In-Reply-To: <20181119175427.2298497-1-eblake@redhat.com> References: <20181119175427.2298497-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 19 Nov 2018 17:54:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/12] qemu-iotests: Modern shell scripting (use $() instead of ``) 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, "open list:Block layer core" , Mao Zhongyi , mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mao Zhongyi Various shell files contain a mix between obsolete `` and modern $(); It would be nice to convert to using $() everywhere. For now, just do the qemu-iotests directory. Cc: kwolf@redhat.com Cc: mreitz@redhat.com Cc: eblake@redhat.com Suggested-by: Eric Blake Signed-off-by: Mao Zhongyi Message-Id: <20181024094051.4470-4-maozhongyi@cmss.chinamobile.com> Reviewed-by: Eric Blake [eblake: tweak commit message] Signed-off-by: Eric Blake --- tests/qemu-iotests/common.config | 4 +-- tests/qemu-iotests/check | 60 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.c= onfig index 3cda0fe5696..9f460f203da 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -21,8 +21,8 @@ export LANG=3DC PATH=3D".:$PATH" -HOSTOS=3D`uname -s` -arch=3D`uname -m` +HOSTOS=3D$(uname -s) +arch=3D$(uname -m) [[ "$arch" =3D~ "ppc64" ]] && qemu_arch=3Dppc64 || qemu_arch=3D"$arch" # make sure we have a standard umask diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index b37713277d1..89ed275988a 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -80,17 +80,17 @@ _full_imgfmt_details() _full_platform_details() { - os=3D`uname -s` - host=3D`hostname -s` - kernel=3D`uname -r` - platform=3D`uname -m` + os=3D$(uname -s) + host=3D$(hostname -s) + kernel=3D$(uname -r) + platform=3D$(uname -m) echo "$os/$platform $host $kernel" } # $1 =3D prog to look for set_prog_path() { - p=3D`command -v $1 2> /dev/null` + p=3D$(command -v $1 2> /dev/null) if [ -n "$p" -a -x "$p" ]; then type -p "$p" else @@ -147,9 +147,9 @@ do if $group then # arg after -g - group_list=3D`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0= -9][0-9][0-9].* $r /"'{ + group_list=3D$(sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[= 0-9][0-9][0-9].* $r /"'{ s/ .*//p -}'` +}') if [ -z "$group_list" ] then echo "Group \"$r\" is empty or not defined?" @@ -173,9 +173,9 @@ s/ .*//p # arg after -x # Populate $tmp.list with all tests awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.lis= t 2>/dev/null - group_list=3D`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0= -9][0-9][0-9].* $r /"'{ + group_list=3D$(sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[= 0-9][0-9][0-9].* $r /"'{ s/ .*//p -}'` +}') if [ -z "$group_list" ] then echo "Group \"$r\" is empty or not defined?" @@ -193,7 +193,7 @@ s/ .*//p rm -f $tmp.sed fi echo "/^$t\$/d" >>$tmp.sed - numsed=3D`expr $numsed + 1` + numsed=3D$(expr $numsed + 1) done sed -f $tmp.sed <$tmp.list >$tmp.tmp mv $tmp.tmp $tmp.list @@ -433,12 +433,12 @@ testlist options ;; [0-9]*-[0-9]*) - eval `echo $r | sed -e 's/^/start=3D/' -e 's/-/ end=3D/'` + eval $(echo $r | sed -e 's/^/start=3D/' -e 's/-/ end=3D/') ;; [0-9]*-) - eval `echo $r | sed -e 's/^/start=3D/' -e 's/-//'` - end=3D`echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\= [0-9]//g' -e 's/ *$//' -e 's/.* //'` + eval $(echo $r | sed -e 's/^/start=3D/' -e 's/-//') + end=3D$(echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/= \[0-9]//g' -e 's/ *$//' -e 's/.* //') if [ -z "$end" ] then echo "No tests in range \"$r\"?" @@ -455,8 +455,8 @@ testlist options esac # get rid of leading 0s as can be interpreted as octal - start=3D`echo $start | sed 's/^0*//'` - end=3D`echo $end | sed 's/^0*//'` + start=3D$(echo $start | sed 's/^0*//') + end=3D$(echo $end | sed 's/^0*//') if $xpand then @@ -531,7 +531,7 @@ fi # should be sort -n, but this did not work for Linux when this # was ported from IRIX # -list=3D`sort $tmp.list` +list=3D$(sort $tmp.list) rm -f $tmp.list $tmp.tmp $tmp.sed if [ -z "$QEMU_PROG" ] @@ -590,7 +590,7 @@ fi export QEMU_NBD_PROG=3D"$(type -p "$QEMU_NBD_PROG")" if [ -z "$QEMU_VXHS_PROG" ]; then - export QEMU_VXHS_PROG=3D"`set_prog_path qnio_server`" + export QEMU_VXHS_PROG=3D"$(set_prog_path qnio_server)" fi if [ -x "$build_iotests/socket_scm_helper" ] @@ -616,7 +616,7 @@ _wallclock() _timestamp() { - now=3D`date "+%T"` + now=3D$(date "+%T") printf %s " [$now]" } @@ -642,9 +642,9 @@ END { if (NR > 0) { if [ -f $tmp.expunged ] then - notrun=3D`wc -l <$tmp.expunged | sed -e 's/ *//g'` - try=3D`expr $try - $notrun` - list=3D`echo "$list" | sed -f $tmp.expunged` + notrun=3D$(wc -l <$tmp.expunged | sed -e 's/ *//g') + try=3D$(expr $try - $notrun) + list=3D$(echo "$list" | sed -f $tmp.expunged) fi echo "" >>check.log @@ -682,8 +682,8 @@ trap "_wrapup; exit \$status" 0 1 2 3 15 [ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE -FULL_IMGFMT_DETAILS=3D`_full_imgfmt_details` -FULL_HOST_DETAILS=3D`_full_platform_details` +FULL_IMGFMT_DETAILS=3D$(_full_imgfmt_details) +FULL_HOST_DETAILS=3D$(_full_platform_details) cat <>$tmp.time + echo "$seq $(expr $stop - $start)" >>$tmp.time fi else echo " - output mismatch (see $seq.out.bad)" @@ -824,14 +824,14 @@ do if $err then bad=3D"$bad $seq" - n_bad=3D`expr $n_bad + 1` + n_bad=3D$(expr $n_bad + 1) quick=3Dfalse fi - [ -f $seq.notrun ] || try=3D`expr $try + 1` + [ -f $seq.notrun ] || try=3D$(expr $try + 1) seq=3D"after_$seq" done interrupt=3Dfalse -status=3D`expr $n_bad` +status=3D$(expr $n_bad) exit --=20 2.17.2