From nobody Thu Nov 6 10:39:53 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 Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540374167375801.6484440234212; Wed, 24 Oct 2018 02:42:47 -0700 (PDT) Received: from localhost ([::1]:47078 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFFgQ-0005Q3-3T for importer@patchew.org; Wed, 24 Oct 2018 05:42:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFFfW-00054y-9R for qemu-devel@nongnu.org; Wed, 24 Oct 2018 05:41:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFFfP-0004wH-VV for qemu-devel@nongnu.org; Wed, 24 Oct 2018 05:41:38 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:56475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFFfL-0004n1-KI for qemu-devel@nongnu.org; Wed, 24 Oct 2018 05:41:28 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app07-12007 (RichMail) with SMTP id 2ee75bd03e2fbb9-2fc96; Wed, 24 Oct 2018 17:41:04 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.149]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee35bd03e291dc-1cf38; Wed, 24 Oct 2018 17:41:03 +0800 (CST) X-RM-TRANSID: 2ee75bd03e2fbb9-2fc96 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee35bd03e291dc-1cf38 From: Mao Zhongyi To: qemu-devel@nongnu.org Date: Wed, 24 Oct 2018 17:40:51 +0800 Message-Id: <20181024094051.4470-4-maozhongyi@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181024094051.4470-1-maozhongyi@cmss.chinamobile.com> References: <20181024094051.4470-1-maozhongyi@cmss.chinamobile.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 221.176.66.80 Subject: [Qemu-devel] [PATCH v2 3/3] 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, Mao Zhongyi , mreitz@redhat.com 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" Various shell files contain a mix between obsolete `` and modern $(); It would be nice to convert to using $() everywhere. Cc: kwolf@redhat.com Cc: mreitz@redhat.com Cc: eblake@redhat.com Suggested-by: Eric Blake Signed-off-by: Mao Zhongyi Reviewed-by: Eric Blake --- tests/qemu-iotests/check | 60 ++++++++++++++++---------------- tests/qemu-iotests/common.config | 4 +-- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index b37713277d..89ed275988 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -80,17 +80,17 @@ _full_imgfmt_details() =20 _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" } =20 # $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 ;; =20 [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/') ;; =20 [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 =20 # 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*//') =20 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 =20 if [ -z "$QEMU_PROG" ] @@ -590,7 +590,7 @@ fi export QEMU_NBD_PROG=3D"$(type -p "$QEMU_NBD_PROG")" =20 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 =20 if [ -x "$build_iotests/socket_scm_helper" ] @@ -616,7 +616,7 @@ _wallclock() =20 _timestamp() { - now=3D`date "+%T"` + now=3D$(date "+%T") printf %s " [$now]" } =20 @@ -642,9 +642,9 @@ END { if (NR > 0) { =20 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 =20 echo "" >>check.log @@ -682,8 +682,8 @@ trap "_wrapup; exit \$status" 0 1 2 3 15 =20 [ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE =20 -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) =20 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) =20 seq=3D"after_$seq" done =20 interrupt=3Dfalse -status=3D`expr $n_bad` +status=3D$(expr $n_bad) exit diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.c= onfig index d4721ba92d..74d1851865 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -21,8 +21,8 @@ export LANG=3DC =20 PATH=3D".:$PATH" =20 -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" =20 export PWD=3D$PWD --=20 2.17.1