testcases: bashisms: s/==/=/
PATCH v2 1/1 testcases: bashisms: s/==/=/
Fixed also for scripts with bash shebang
---
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(-)
testcases/commands/fileutils/mv/mv_tests.sh +1 -1
@@ -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"
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +1 -1
@@ -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
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +3 -3
@@ -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"
testcases/kernel/controllers/cpuset/cpuset_regression_test.sh +1 -1
@@ -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"
testcases/kernel/fs/acl/tacl_xattr.sh +5 -5
@@ -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"
testcases/kernel/fs/ext4-new-features/ext4-inode-version/ext4_get_inode_version.sh +1 -1
@@ -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
testcases/kernel/fs/ext4-new-features/ext4-journal-checksum/ext4_journal_checksum.sh +2 -2
@@ -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"
testcases/kernel/fs/ext4-new-features/ext4-uninit-groups/ext4_uninit_groups_test.sh +1 -1
@@ -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
testcases/realtime/func/periodic_cpu_load/mixed_load.sh +1 -1
@@ -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
Signature · 1 line
2.10.2
PATCH v2 1/1 testcases: bashisms: s/==/=/
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.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 1/1 testcases: bashisms: s/==/=/
Hi Cyril,
Quoted 3 lines
Hi!
I've dropped the part that fixedmv_test.shsince 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>
PATCH v2 1/1 testcases: bashisms: s/==/=/
Hi!
Quoted 4 lines
Quoted 2 lines
I've dropped the part that fixed
mv_test.shsince 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.
Quoted 3 lines
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.
Quoted 1 line
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.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 1/1 testcases: bashisms: s/==/=/
In reply to Petr VorelHi!
Quoted 2 lines
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.
Signature · 2 lines
Cyril Hrubis [email protected]