Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/
Date: Mon, 21 Nov 2016 21:53:00 +0100	[thread overview]
Message-ID: <20161121205300.28375-1-petr.vorel@gmail.com> (raw)

Fixed also for scripts with bash shebang

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
v2: using test -z comparator (portability)
---
 testcases/commands/fileutils/mv/mv_tests.sh                    |  2 +-
 testcases/kernel/controllers/cgroup/cgroup_regression_test.sh  |  2 +-
 testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh     |  6 +++---
 testcases/kernel/controllers/cpuset/cpuset_regression_test.sh  |  2 +-
 testcases/kernel/fs/acl/tacl_xattr.sh                          | 10 +++++-----
 .../ext4-inode-version/ext4_get_inode_version.sh               |  2 +-
 .../ext4-journal-checksum/ext4_journal_checksum.sh             |  4 ++--
 .../ext4-uninit-groups/ext4_uninit_groups_test.sh              |  2 +-
 testcases/realtime/func/periodic_cpu_load/mixed_load.sh        |  2 +-
 9 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/testcases/commands/fileutils/mv/mv_tests.sh b/testcases/commands/fileutils/mv/mv_tests.sh
index 66f4056..7b5ef46 100755
--- a/testcases/commands/fileutils/mv/mv_tests.sh
+++ b/testcases/commands/fileutils/mv/mv_tests.sh
@@ -169,7 +169,7 @@ test02()
 			       "backup file2."
 	fi
 
-	if [ "$MD5_old" == "$MD5_backup" -a -f "tmpfile2~" ]; then
+	if [ "$MD5_old" = "$MD5_backup" -a -f "tmpfile2~" ]; then
 		tst_resm TPASS "Test #2: mv -b success"
 	else
 		tst_resm TFAIL "Test #2: mv -b failed"
diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
index abd780f..5856726 100755
--- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
+++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
@@ -277,7 +277,7 @@ test_5()
 
 	mkdir cgroup/0
 	# Otherwise we can't attach task
-	if [ "$subsys1" == cpuset -o "$subsys2" == cpuset ]; then
+	if [ "$subsys1" = cpuset -o "$subsys2" = cpuset ]; then
 		echo 0 > cgroup/0/cpuset.cpus 2> /dev/null
 		echo 0 > cgroup/0/cpuset.mems 2> /dev/null
 	fi
diff --git a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
index 13e2938..2c8dfd3 100755
--- a/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
+++ b/testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh
@@ -34,7 +34,7 @@ exist_subsystem()
     local subsystem="$1"
     local exist=`grep -w $subsystem /proc/cgroups | cut -f1`
 
-    if [ "$exist" = "" ]; then
+    if [ -z "$exist" ]; then
         tst_brkm TCONF "Subsystem $subsystem not supported"
     fi
 }
@@ -68,7 +68,7 @@ create_subgroup()
 
     # cpuset.cpus and cpuset.mems must be initialized with suitable value
     # before any pids are attached
-    if [ "$subsystem" == "cpuset" ]; then
+    if [ "$subsystem" = "cpuset" ]; then
         if [ -e "$mount_point/cpus" ]; then
             ROD cat "$mount_point/cpus" \> "$path/cpus"
             ROD cat "$mount_point/mems" \> "$path/mems"
@@ -95,7 +95,7 @@ setup()
 
     mount_point=`grep -w $subsystem /proc/mounts | cut -f 2 | cut -d " " -f2`
 
-    if [ "$mount_point" == "" ]; then
+    if [ -z "$mount_point" ]; then
         try_umount=1
         mount_point="/dev/cgroup"
 	tst_resm TINFO "Subsystem $subsystem is not mounted, mounting it at $mount_point"
diff --git a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
index 0c7b6cf..5a8083f 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
@@ -96,7 +96,7 @@ cleanup()
 		     ${root_cpuset_dir}/${cpu_exclusive}
 	fi
 
-	if [ "${mount_flag}" == "1" ]; then
+	if [ "${mount_flag}" = "1" ]; then
 		umount ${root_cpuset_dir}
 		if [ $? -ne 0 ]; then
 			tst_resm TWARN "'umount ${root_cpuset_dir}' failed"
diff --git a/testcases/kernel/fs/acl/tacl_xattr.sh b/testcases/kernel/fs/acl/tacl_xattr.sh
index b42b665..039bd17 100755
--- a/testcases/kernel/fs/acl/tacl_xattr.sh
+++ b/testcases/kernel/fs/acl/tacl_xattr.sh
@@ -667,11 +667,11 @@ USER_PERMISSION=`echo $CONTENT | awk '{print \$10}'`
 GROUP_PERMISSION=`echo $CONTENT | awk '{print \$12}'`
 OTHER_PERMISSION=`echo $CONTENT | awk '{print \$15}'`
 
-if [ $USER_PERMISSION == "user::rwx" ]
+if [ $USER_PERMISSION = "user::rwx" ]
 then
-	if [ $GROUP_PERMISSION == "group::rwx" ]
+	if [ $GROUP_PERMISSION = "group::rwx" ]
 	then
-		if [ $OTHER_PERMISSION == "other::rwx" ]
+		if [ $OTHER_PERMISSION = "other::rwx" ]
 		then
 			echo ""
 			echo "SUCCESS: Chmod with ACL_USER_OBJ ACL_GROUP_OBJ and ACL_OTHER are correct"
@@ -702,9 +702,9 @@ CONTENT=`getfacl tacl/mount-ext2/shared/team1/newfile2`
 ITEM_OWNER=`echo $CONTENT | awk '{print \$6}'`
 ITEM_GROUP=`echo $CONTENT | awk '{print \$9}'`
 
-if [ $ITEM_OWNER == "tacluser2" ]
+if [ $ITEM_OWNER = "tacluser2" ]
 then
-	if [ $ITEM_GROUP == "tacluser2" ]
+	if [ $ITEM_GROUP = "tacluser2" ]
 	then
 		echo ""
 		echo "SUCCESS: Chown correct"
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh b/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh
index d45d6d3..5c89b23 100755
--- a/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh
+++ b/testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh
@@ -33,7 +33,7 @@ inode_version=`echo $inode_version | sed 's/://'`
 
 inode_version=$(( $inode_version ))
 
-if [ "$2" == "1" ]; then
+if [ "$2" = "1" ]; then
 	exit $inode_version
 else
 	echo $inode_version
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh b/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh
index c776fc9..87eb90b 100755
--- a/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh
+++ b/testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh
@@ -40,12 +40,12 @@ ext4_test_journal_checksum()
 	local checksum=
 	local async_commit=
 
-	if [ "$3" == "" ]; then
+	if [ -z "$3" ]; then
 		checksum="No use"
 	else
 		checksum="Used"
 	fi
-	if [ "$4" == "" ]; then
+	if [ -z "$4" ]; then
 		async_commit="No use"
 	else
 		async_commit="Used"
diff --git a/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh b/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh
index c8de206..4db846a 100755
--- a/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh
+++ b/testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh
@@ -72,7 +72,7 @@ ext4_test_uninit_groups()
 		return
 	fi
 
-	if [ $3 == "no_flex_bg" ]; then
+	if [ "$3" = "no_flex_bg" ]; then
 		flag=""
 	else
 		flag=$3
diff --git a/testcases/realtime/func/periodic_cpu_load/mixed_load.sh b/testcases/realtime/func/periodic_cpu_load/mixed_load.sh
index 931d18f..3623427 100644
--- a/testcases/realtime/func/periodic_cpu_load/mixed_load.sh
+++ b/testcases/realtime/func/periodic_cpu_load/mixed_load.sh
@@ -124,7 +124,7 @@ function pass_criteria() {
 # Parse args
 JVM_ARG=""
 JVM_STATUS="Disabled"
-if [ "$1" == "-j" ]; then
+if [ "$1" = "-j" ]; then
     JVM_ARG="-j"
     JVM_STATUS="Enabled"
 fi
-- 
2.10.2


             reply	other threads:[~2016-11-21 20:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 20:53 Petr Vorel [this message]
2016-11-22 14:28 ` [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/ Cyril Hrubis
2016-11-22 16:52   ` Petr Vorel
2016-11-23  9:21     ` Cyril Hrubis
2016-11-23  9:32     ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161121205300.28375-1-petr.vorel@gmail.com \
    --to=petr.vorel@gmail.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox