* [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/
@ 2016-11-21 20:53 Petr Vorel
2016-11-22 14:28 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2016-11-21 20:53 UTC (permalink / raw)
To: ltp
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/
2016-11-21 20:53 [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/ Petr Vorel
@ 2016-11-22 14:28 ` Cyril Hrubis
2016-11-22 16:52 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2016-11-22 14:28 UTC (permalink / raw)
To: ltp
Hi!
I've dropped the part that fixed mv_test.sh since that test was
rewritten by the big patchset I've just commited and pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/
2016-11-22 14:28 ` Cyril Hrubis
@ 2016-11-22 16:52 ` Petr Vorel
2016-11-23 9:21 ` Cyril Hrubis
2016-11-23 9:32 ` Cyril Hrubis
0 siblings, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2016-11-22 16:52 UTC (permalink / raw)
To: ltp
Hi Cyril,
> Hi!
> I've dropped the part that fixed mv_test.sh since that test was
> rewritten by the big patchset I've just commited and pushed, thanks.
Thanks! I hoped not to clash with your work, sorry! There are still some bashisms left,
are you planning any big rewrite, so I should wait for fixing them?
BTW there is a file pushed with my commit
testcases/kernel/controllers/memcg/functional/memcg_getpagesize, IMHO it shouldn't
(it was removed in 5e65d837ee4e3390c885db1d2eb340c80c2b6c36).
OT: testcases/kernel/controllers/memcg/README seems to be outdated.
Kind regards,
Petr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20161122/f33295fa/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/
2016-11-22 16:52 ` Petr Vorel
@ 2016-11-23 9:21 ` Cyril Hrubis
2016-11-23 9:32 ` Cyril Hrubis
1 sibling, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2016-11-23 9:21 UTC (permalink / raw)
To: ltp
Hi!
> > I've dropped the part that fixed mv_test.sh since that test was
> > rewritten by the big patchset I've just commited and pushed, thanks.
> Thanks! I hoped not to clash with your work, sorry! There are still some bashisms left,
> are you planning any big rewrite, so I should wait for fixing them?
Nah, that happens all the time. That is one of the joys of developing on
larger project.
> BTW there is a file pushed with my commit
> testcases/kernel/controllers/memcg/functional/memcg_getpagesize, IMHO it shouldn't
> (it was removed in 5e65d837ee4e3390c885db1d2eb340c80c2b6c36).
Grr, my bad, I will get rid of it.
> OT: testcases/kernel/controllers/memcg/README seems to be outdated.
I guess that it's just another candidate for deletion, since there is
not much useful information left.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/
2016-11-22 16:52 ` Petr Vorel
2016-11-23 9:21 ` Cyril Hrubis
@ 2016-11-23 9:32 ` Cyril Hrubis
1 sibling, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2016-11-23 9:32 UTC (permalink / raw)
To: ltp
Hi!
> Thanks! I hoped not to clash with your work, sorry! There are still some bashisms left,
> are you planning any big rewrite, so I should wait for fixing them?
And go ahead with fixing things, I've merged my changes, I do not have
anything stashed for shell tests at this point nor I plan working on
them for a week or two.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-23 9:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-21 20:53 [LTP] [PATCH v2 1/1] testcases: bashisms: s/==/=/ Petr Vorel
2016-11-22 14:28 ` Cyril Hrubis
2016-11-22 16:52 ` Petr Vorel
2016-11-23 9:21 ` Cyril Hrubis
2016-11-23 9:32 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.