From: Mr NeilBrown Date: Thu, 13 Aug 2020 05:16:24 +0000 (+1000) Subject: LU-13933 tests: remove some unnecessary back-slashes. X-Git-Tag: 2.14.52~115 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8ce1d41b9cacafe8d3833dc8578c6057fba2ef9a LU-13933 tests: remove some unnecessary back-slashes. Various scripts use "\ " where the "\" isn't needed. In an 'awk' pattern, using "\ " is wrong. In the arg to 'tr', there is no need to '\' a space. In shell code, <<" foo ">> is easier to read than <<\ foo\ >>. Also: In shell code <> can be <> if <> doesn't contain unquoted spaces. If value does contain quoted <<">>, the extra quotes make it hard to read. Signed-off-by: Mr NeilBrown Change-Id: I53d0522071016286b4ef9f576f4a4e46b1ba2d6d Reviewed-on: https://review.whamcloud.com/39750 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Andreas Dilger --- diff --git a/lustre/tests/sanity-sec.sh b/lustre/tests/sanity-sec.sh index 956a222..4655547 100755 --- a/lustre/tests/sanity-sec.sh +++ b/lustre/tests/sanity-sec.sh @@ -3220,7 +3220,7 @@ test_44() { dd if=$tmpfile of=$testfile bs=$pagesz count=2 oflag=direct || error "could not write to file with O_DIRECT (1)" - respage=$(vmtouch $testfile | awk '/Resident\ Pages:/ {print $3}') + respage=$(vmtouch $testfile | awk '/Resident Pages:/ {print $3}') [ "$respage" == "0/2" ] || error "write to enc file fell back to buffered IO" @@ -3229,7 +3229,7 @@ test_44() { dd if=$testfile of=$resfile bs=$pagesz count=2 iflag=direct || error "could not read from file with O_DIRECT (1)" - respage=$(vmtouch $testfile | awk '/Resident\ Pages:/ {print $3}') + respage=$(vmtouch $testfile | awk '/Resident Pages:/ {print $3}') [ "$respage" == "0/2" ] || error "read from enc file fell back to buffered IO" diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 737e16d..695d4ce 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1586,7 +1586,7 @@ test_27cb() { # Strip getstripe output to a space separated list of OSTs local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\ - awk '{print $1}' | tr '\n' '\ ' | sed -e 's/[[:space:]]*$//') + awk '{print $1}' | tr '\n' ' ' | sed -e 's/[[:space:]]*$//') [ "$getstripe_osts" = "${osts//,/ }" ] || error "stripes not on specified OSTs" @@ -1607,7 +1607,7 @@ test_27cc() { # Strip getstripe output to a space separated list of OSTs local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\ - awk '{print $1}' | tr '\n' '\ ' | sed -e 's/[[:space:]]*$//') + awk '{print $1}' | tr '\n' ' ' | sed -e 's/[[:space:]]*$//') [ "$getstripe_osts" = "${osts//,/ }" ] || error "stripes not on specified OSTs" @@ -1627,7 +1627,7 @@ test_27cd() { # Strip getstripe output to a space separated list of OSTs local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\ - awk '{print $1}' | tr '\n' '\ ' | sed -e 's/[[:space:]]*$//') + awk '{print $1}' | tr '\n' ' ' | sed -e 's/[[:space:]]*$//') [ "$getstripe_osts" = "${osts//,/ }" ] || error "stripes not on specified OSTs" @@ -1659,7 +1659,7 @@ test_27ce() { # Strip getstripe output to a space separated list of OSTs local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\ - awk '{print $1}' | tr '\n' '\ ' | sed -e 's/[[:space:]]*$//') + awk '{print $1}' | tr '\n' ' ' | sed -e 's/[[:space:]]*$//') [ "$getstripe_osts" = "${osts//,/ }" ] || error "stripes not on specified OSTs" @@ -6259,9 +6259,9 @@ test_newerXY_base() { if [ $y == "t" ]; then if [ $x == "b" ]; then - ref="\"$(do_facet mds1 date +"%Y-%m-%d\ %H:%M:%S")\"" + ref=\"$(do_facet mds1 date +"%Y-%m-%d\ %H:%M:%S")\" else - ref="\"$(date +"%Y-%m-%d %H:%M:%S")\"" + ref=\"$(date +"%Y-%m-%d %H:%M:%S")\" fi else ref=$DIR/$tfile.newer.$x$y @@ -6274,9 +6274,9 @@ test_newerXY_base() { sleep 2 if [ $y == "t" ]; then if [ $x == "b" ]; then - negref="\"$(do_facet mds1 date +"%Y-%m-%d\ %H:%M:%S")\"" + negref=\"$(do_facet mds1 date +"%Y-%m-%d\ %H:%M:%S")\" else - negref="\"$(date +"%Y-%m-%d %H:%M:%S")\"" + negref=\"$(date +"%Y-%m-%d %H:%M:%S")\" fi else negref=$DIR/$tfile.negnewer.$x$y diff --git a/lustre/tests/setup_kerberos.sh b/lustre/tests/setup_kerberos.sh index 91e1ec1..370c974 100755 --- a/lustre/tests/setup_kerberos.sh +++ b/lustre/tests/setup_kerberos.sh @@ -133,7 +133,7 @@ is_part_of() { return fi - if [[ " $list " == *\ $name\ * ]]; then + if [[ " $list " == *" $name "* ]]; then true else false diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 71d4aa3..c2e0daf 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -6796,7 +6796,7 @@ host_id() { # Description: # Returns list of ip addresses for each interface local_addr_list() { - ip addr | awk '/inet\ / {print $2}' | awk -F\/ '{print $1}' + ip addr | awk '/inet / {print $2}' | awk -F/ '{print $1}' } is_local_addr() {