From nobody Thu Nov 6 08:40:03 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539769710932283.7871584013109; Wed, 17 Oct 2018 02:48:30 -0700 (PDT) Received: from localhost ([::1]:34989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCiRJ-0004n6-Bn for importer@patchew.org; Wed, 17 Oct 2018 05:48:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCiNZ-0002Mh-Ar for qemu-devel@nongnu.org; Wed, 17 Oct 2018 05:44:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCiNU-00054F-0w for qemu-devel@nongnu.org; Wed, 17 Oct 2018 05:44:37 -0400 Received: from cmccmta1.chinamobile.com ([221.176.66.79]:25822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCiNO-0004rn-PO; Wed, 17 Oct 2018 05:44:28 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.3]) by rmmx-syy-dmz-app01-12001 (RichMail) with SMTP id 2ee15bc7046fccc-8d8e2; Wed, 17 Oct 2018 17:44:15 +0800 (CST) Received: from localhost.localdomain (unknown[112.25.154.149]) by rmsmtp-syy-appsvr02-12002 (RichMail) with SMTP id 2ee25bc70468719-372a1; Wed, 17 Oct 2018 17:44:15 +0800 (CST) X-RM-TRANSID: 2ee15bc7046fccc-8d8e2 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 X-RM-TRANSID: 2ee25bc70468719-372a1 From: Mao Zhongyi To: qemu-devel@nongnu.org Date: Wed, 17 Oct 2018 17:44:04 +0800 Message-Id: <20181017094406.4844-2-maozhongyi@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181017094406.4844-1-maozhongyi@cmss.chinamobile.com> References: <20181017094406.4844-1-maozhongyi@cmss.chinamobile.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 221.176.66.79 Subject: [Qemu-devel] [PATCH 1/3] qemu-iotests: Modern shellscripting (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, qemu-block@nongnu.org, 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. `pwd` and `basename $0` are in 231 files under directory tests/qemu-iotests, so replaced it with the following: sed -i 's/`pwd`/$(pwd)/g' $(git grep -l "\`pwd\`") sed -i 's/`basename $0`/$(basename $0)/g' $(git grep -l "basename \$0") A small amount of the rest is manually modified. Cc: kwolf@redhat.com Cc: mreitz@redhat.com Cc: qemu-block@nongnu.org Signed-off-by: Mao Zhongyi --- tests/qemu-iotests/001 | 4 +- tests/qemu-iotests/002 | 4 +- tests/qemu-iotests/003 | 4 +- tests/qemu-iotests/004 | 4 +- tests/qemu-iotests/005 | 4 +- tests/qemu-iotests/007 | 6 +-- tests/qemu-iotests/008 | 4 +- tests/qemu-iotests/009 | 4 +- tests/qemu-iotests/010 | 4 +- tests/qemu-iotests/011 | 6 +-- tests/qemu-iotests/012 | 4 +- tests/qemu-iotests/013 | 4 +- tests/qemu-iotests/014 | 6 +-- tests/qemu-iotests/015 | 4 +- tests/qemu-iotests/017 | 4 +- tests/qemu-iotests/018 | 4 +- tests/qemu-iotests/019 | 4 +- tests/qemu-iotests/020 | 4 +- tests/qemu-iotests/021 | 4 +- tests/qemu-iotests/022 | 4 +- tests/qemu-iotests/023 | 4 +- tests/qemu-iotests/024 | 4 +- tests/qemu-iotests/025 | 4 +- tests/qemu-iotests/026 | 4 +- tests/qemu-iotests/027 | 4 +- tests/qemu-iotests/028 | 4 +- tests/qemu-iotests/029 | 4 +- tests/qemu-iotests/031 | 4 +- tests/qemu-iotests/032 | 4 +- tests/qemu-iotests/033 | 4 +- tests/qemu-iotests/034 | 4 +- tests/qemu-iotests/035 | 4 +- tests/qemu-iotests/036 | 4 +- tests/qemu-iotests/037 | 4 +- tests/qemu-iotests/038 | 4 +- tests/qemu-iotests/039 | 4 +- tests/qemu-iotests/042 | 4 +- tests/qemu-iotests/043 | 4 +- tests/qemu-iotests/046 | 4 +- tests/qemu-iotests/047 | 4 +- tests/qemu-iotests/048 | 2 +- tests/qemu-iotests/049 | 4 +- tests/qemu-iotests/050 | 4 +- tests/qemu-iotests/051 | 4 +- tests/qemu-iotests/052 | 4 +- tests/qemu-iotests/053 | 4 +- tests/qemu-iotests/054 | 4 +- tests/qemu-iotests/058 | 4 +- tests/qemu-iotests/059 | 4 +- tests/qemu-iotests/061 | 4 +- tests/qemu-iotests/062 | 4 +- tests/qemu-iotests/063 | 4 +- tests/qemu-iotests/064 | 4 +- tests/qemu-iotests/067 | 4 +- tests/qemu-iotests/070 | 4 +- tests/qemu-iotests/073 | 4 +- tests/qemu-iotests/074 | 2 +- tests/qemu-iotests/075 | 4 +- tests/qemu-iotests/076 | 4 +- tests/qemu-iotests/077 | 4 +- tests/qemu-iotests/078 | 4 +- tests/qemu-iotests/079 | 4 +- tests/qemu-iotests/080 | 4 +- tests/qemu-iotests/081 | 4 +- tests/qemu-iotests/082 | 4 +- tests/qemu-iotests/083 | 4 +- tests/qemu-iotests/084 | 4 +- tests/qemu-iotests/085 | 4 +- tests/qemu-iotests/086 | 4 +- tests/qemu-iotests/087 | 4 +- tests/qemu-iotests/088 | 4 +- tests/qemu-iotests/091 | 4 +- tests/qemu-iotests/092 | 4 +- tests/qemu-iotests/095 | 4 +- tests/qemu-iotests/101 | 4 +- tests/qemu-iotests/104 | 4 +- tests/qemu-iotests/105 | 4 +- tests/qemu-iotests/116 | 4 +- tests/qemu-iotests/128 | 4 +- tests/qemu-iotests/131 | 4 +- tests/qemu-iotests/133 | 4 +- tests/qemu-iotests/134 | 4 +- tests/qemu-iotests/135 | 4 +- tests/qemu-iotests/142 | 4 +- tests/qemu-iotests/144 | 4 +- tests/qemu-iotests/145 | 4 +- tests/qemu-iotests/146 | 4 +- tests/qemu-iotests/154 | 4 +- tests/qemu-iotests/158 | 4 +- tests/qemu-iotests/171 | 4 +- tests/qemu-iotests/172 | 4 +- tests/qemu-iotests/173 | 4 +- tests/qemu-iotests/174 | 4 +- tests/qemu-iotests/175 | 4 +- tests/qemu-iotests/177 | 4 +- tests/qemu-iotests/178 | 4 +- tests/qemu-iotests/181 | 4 +- tests/qemu-iotests/183 | 4 +- tests/qemu-iotests/184 | 4 +- tests/qemu-iotests/185 | 4 +- tests/qemu-iotests/186 | 4 +- tests/qemu-iotests/187 | 4 +- tests/qemu-iotests/188 | 4 +- tests/qemu-iotests/189 | 4 +- tests/qemu-iotests/190 | 4 +- tests/qemu-iotests/191 | 4 +- tests/qemu-iotests/192 | 4 +- tests/qemu-iotests/195 | 4 +- tests/qemu-iotests/198 | 4 +- tests/qemu-iotests/200 | 4 +- tests/qemu-iotests/201 | 2 +- tests/qemu-iotests/204 | 4 +- tests/qemu-iotests/226 | 4 +- tests/qemu-iotests/231 | 4 +- tests/qemu-iotests/check | 62 +++++++++++++++---------------- tests/qemu-iotests/common.config | 6 +-- tests/qemu-iotests/common.pattern | 4 +- tests/qemu-iotests/common.rc | 2 +- 118 files changed, 265 insertions(+), 265 deletions(-) diff --git a/tests/qemu-iotests/001 b/tests/qemu-iotests/001 index ffd14e2ce9..3fcea0e6d2 100755 --- a/tests/qemu-iotests/001 +++ b/tests/qemu-iotests/001 @@ -21,10 +21,10 @@ # creator owner=3Dhch@lst.de =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() diff --git a/tests/qemu-iotests/002 b/tests/qemu-iotests/002 index d4f8e91b91..42976b8ad5 100755 --- a/tests/qemu-iotests/002 +++ b/tests/qemu-iotests/002 @@ -21,10 +21,10 @@ # creator owner=3Dhch@lst.de =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() diff --git a/tests/qemu-iotests/003 b/tests/qemu-iotests/003 index 19889b9fcd..104c3a286a 100755 --- a/tests/qemu-iotests/003 +++ b/tests/qemu-iotests/003 @@ -21,10 +21,10 @@ # creator owner=3Dhch@lst.de =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() diff --git a/tests/qemu-iotests/004 b/tests/qemu-iotests/004 index 6f2aa3d9a2..2c8942d4fc 100755 --- a/tests/qemu-iotests/004 +++ b/tests/qemu-iotests/004 @@ -21,10 +21,10 @@ # creator owner=3Dhch@lst.de =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005 index 444737751f..2d26736e03 100755 --- a/tests/qemu-iotests/005 +++ b/tests/qemu-iotests/005 @@ -24,10 +24,10 @@ # creator owner=3Dhch@lst.de =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() diff --git a/tests/qemu-iotests/007 b/tests/qemu-iotests/007 index fa543eeb7d..94343eba41 100755 --- a/tests/qemu-iotests/007 +++ b/tests/qemu-iotests/007 @@ -21,10 +21,10 @@ # creator owner=3Dkwolf@redhat.com =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() @@ -50,7 +50,7 @@ echo echo "creating image" _make_test_img 1M =20 -for i in `seq 1 10`; do +for i in $(seq 1 10); do echo "savevm $i" $QEMU -nographic -hda "$TEST_IMG" -serial none -monitor stdio >/dev/nu= ll 2>&1 <. =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 status=3D1 # failure is the default! diff --git a/tests/qemu-iotests/204 b/tests/qemu-iotests/204 index feb69d2ada..14be73bb76 100755 --- a/tests/qemu-iotests/204 +++ b/tests/qemu-iotests/204 @@ -21,10 +21,10 @@ # creator owner=3Deblake@redhat.com =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() diff --git a/tests/qemu-iotests/226 b/tests/qemu-iotests/226 index 8ec3e612dd..2a26ad0e38 100755 --- a/tests/qemu-iotests/226 +++ b/tests/qemu-iotests/226 @@ -22,10 +22,10 @@ # creator owner=3Djsnow@redhat.com =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() diff --git a/tests/qemu-iotests/231 b/tests/qemu-iotests/231 index 3e283708b4..7edc0cfee6 100755 --- a/tests/qemu-iotests/231 +++ b/tests/qemu-iotests/231 @@ -23,10 +23,10 @@ # creator owner=3Djcody@redhat.com =20 -seq=3D`basename $0` +seq=3D$(basename $0) echo "QA output created by $seq" =20 -here=3D`pwd` +here=3D$(pwd) status=3D1 # failure is the default! =20 _cleanup() diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index aa94c6c7ea..8d9eff972a 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 @@ -99,7 +99,7 @@ set_prog_path() } =20 if [ -z "$TEST_DIR" ]; then - TEST_DIR=3D`pwd`/scratch + TEST_DIR=3D$(pwd)/scratch fi =20 if [ ! -e "$TEST_DIR" ]; then @@ -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 102aa6878a..b4e08bd8ca 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -21,11 +21,11 @@ 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` +export PWD=3D$(pwd) =20 # make sure we have a standard umask umask 022 diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.= pattern index 34f4a8dc9b..e30fe6a069 100644 --- a/tests/qemu-iotests/common.pattern +++ b/tests/qemu-iotests/common.pattern @@ -22,7 +22,7 @@ function do_is_allocated() { local step=3D$3 local count=3D$4 =20 - for i in `seq 1 $count`; do + for i in $(seq 1 $count); do echo alloc $(( start + (i - 1) * step )) $size done } @@ -40,7 +40,7 @@ function do_io() { local pattern=3D$6 =20 echo =3D=3D=3D IO: pattern $pattern >&2 - for i in `seq 1 $count`; do + for i in $(seq 1 $count); do echo $op -P $pattern $(( start + (i - 1) * step )) $size done } diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 44bee16a5e..41d91be54a 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -160,7 +160,7 @@ fi ORIG_TEST_IMG=3D"$TEST_IMG" =20 if [ -z "$TEST_DIR" ]; then - TEST_DIR=3D`pwd`/scratch + TEST_DIR=3D$(pwd)/scratch fi =20 QEMU_TEST_DIR=3D"${TEST_DIR}" --=20 2.17.1