Whamcloud - gitweb
LU-13933 tests: remove some unnecessary back-slashes. 50/39750/6
authorMr NeilBrown <neilb@suse.de>
Thu, 13 Aug 2020 05:16:24 +0000 (15:16 +1000)
committerOleg Drokin <green@whamcloud.com>
Wed, 28 Apr 2021 02:10:42 +0000 (02:10 +0000)
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 <<name="value">> can be <<name=value>> if <<value>>
doesn't contain unquoted spaces.  If value does contain quoted <<">>,
the extra quotes make it hard to read.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I53d0522071016286b4ef9f576f4a4e46b1ba2d6d
Reviewed-on: https://review.whamcloud.com/39750
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/sanity-sec.sh
lustre/tests/sanity.sh
lustre/tests/setup_kerberos.sh
lustre/tests/test-framework.sh

index 956a222..4655547 100755 (executable)
@@ -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"
 
index 737e16d..695d4ce 100755 (executable)
@@ -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
index 91e1ec1..370c974 100755 (executable)
@@ -133,7 +133,7 @@ is_part_of() {
         return
     fi
 
-    if [[ " $list " == *\ $name\ * ]]; then
+    if [[ " $list " == *" $name "* ]]; then
         true
     else
         false
index 71d4aa3..c2e0daf 100755 (executable)
@@ -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() {