Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
CORTX-30753: Codacy code cleanup(#1608)
Browse files Browse the repository at this point in the history
This patch fixes some of the codacy warnings.
Warning fixed: "SC2006: Use $(...) notation instead of legacy backticked `...`".

Signed-off-by: alfhad <fahadshah2411@gmail.com>
  • Loading branch information
alfhad committed Aug 23, 2022
1 parent 0cd7e68 commit 883c27e
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 65 deletions.
10 changes: 5 additions & 5 deletions m0t1fs/linux_kernel/st/m0t1fs_poolmach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#


. `dirname "$0"`/common.sh
. `dirname "$0"`/m0t1fs_common_inc.sh
. `dirname "$0"`/m0t1fs_client_inc.sh
. `dirname "$0"`/m0t1fs_server_inc.sh
. $(dirname $0)/common.sh
. $(dirname $0)/m0t1fs_common_inc.sh
. $(dirname $0)/m0t1fs_client_inc.sh
. $(dirname $0)/m0t1fs_server_inc.sh

pool_mach_test()
{
Expand Down Expand Up @@ -125,7 +125,7 @@ main()
{
sandbox_init

NODE_UUID=`uuidgen`
NODE_UUID=$(uuidgen)
local multiple_pools=0
motr_service start $multiple_pools
if [ $? -ne "0" ]
Expand Down
14 changes: 7 additions & 7 deletions m0t1fs/linux_kernel/st/m0t1fs_rconfc_fail_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#


. `dirname "$0"`/common.sh
. `dirname "$0"`/m0t1fs_common_inc.sh
. `dirname "$0"`/m0t1fs_client_inc.sh
. `dirname "$0"`/m0t1fs_server_inc.sh
. `dirname "$0"`/m0t1fs_sns_common_inc.sh
. $(dirname "$0")/common.sh
. $(dirname "$0")/m0t1fs_common_inc.sh
. $(dirname "$0")/m0t1fs_client_inc.sh
. $(dirname "$0")/m0t1fs_server_inc.sh
. $(dirname "$0")/m0t1fs_sns_common_inc.sh

. "$M0_SRC_DIR"/utils/functions # opcode

Expand Down Expand Up @@ -98,7 +98,7 @@ rconfc_fatal_test()
local file_base="$MOTR_M0T1FS_MOUNT_DIR/0:1"
local bs=8192
local count=150
local LNET_NID=`lctl list_nids | head -1`
local LNET_NID=$(lctl list_nids | head -1)
local FAKE_HA_EP=$LNET_NID:12345:34:1
local RM_EP=$LNET_NID:12345:33:100
local CLIENT_EP=$LNET_NID:12345:34:1001
Expand Down Expand Up @@ -132,7 +132,7 @@ rconfc_fatal_test()

main()
{
NODE_UUID=`uuidgen`
NODE_UUID=$(uuidgen)
local rc

echo "*********************************************************"
Expand Down
12 changes: 6 additions & 6 deletions m0t1fs/linux_kernel/st/m0t1fs_restart_motr_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ set +e
## CAUTION: This path will be removed by superuser.
SANDBOX_DIR=${SANDBOX_DIR:-/var/motr/sandbox.restart_motr_service}

. `dirname "$0"`/common.sh
. `dirname "$0"`/m0t1fs_common_inc.sh
. `dirname "$0"`/m0t1fs_client_inc.sh
. `dirname "$0"`/m0t1fs_server_inc.sh
. `dirname "$0"`/m0t1fs_sns_common_inc.sh
. $(dirname "$0")/common.sh
. $(dirname "$0")/m0t1fs_common_inc.sh
. $(dirname "$0")/m0t1fs_client_inc.sh
. $(dirname "$0")/m0t1fs_server_inc.sh
. $(dirname "$0")/m0t1fs_sns_common_inc.sh

rcancel_sandbox="$MOTR_M0T1FS_TEST_DIR/rcancel_sandbox"
source_file="$rcancel_sandbox/rcancel_source"
Expand All @@ -47,7 +47,7 @@ rcancel_motr_service_start()

main()
{
NODE_UUID=`uuidgen`
NODE_UUID=$(uuidgen)
local rc

sandbox_init
Expand Down
14 changes: 7 additions & 7 deletions m0t1fs/linux_kernel/st/m0t1fs_rlock_revoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#


. `dirname "$0"`/common.sh
. `dirname "$0"`/m0t1fs_common_inc.sh
. `dirname "$0"`/m0t1fs_client_inc.sh
. `dirname "$0"`/m0t1fs_server_inc.sh
. `dirname "$0"`/m0t1fs_sns_common_inc.sh
. $(dirname "$0")/common.sh
. $(dirname "$0")/m0t1fs_common_inc.sh
. $(dirname "$0")/m0t1fs_client_inc.sh
. $(dirname "$0")/m0t1fs_server_inc.sh
. $(dirname "$0")/m0t1fs_sns_common_inc.sh

. "$M0_SRC_DIR"/utils/functions # opcode

Expand Down Expand Up @@ -94,7 +94,7 @@ revoke_post()

revoke_read_lock()
{
local lnet_nid=`sudo lctl list_nids | head -1`
local lnet_nid=$(sudo lctl list_nids | head -1)
local s_endpoint="$lnet_nid:12345:33:100"
local c_endpoint="$lnet_nid:12345:30:*"
local delay=${1:-5}
Expand Down Expand Up @@ -155,7 +155,7 @@ revoke_test()

main()
{
NODE_UUID=`uuidgen`
NODE_UUID=$(uuidgen)
local rc
local EXECUTOR

Expand Down
36 changes: 18 additions & 18 deletions m0t1fs/linux_kernel/st/m0t1fs_rpc_cancel_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#


. `dirname $0`/common.sh
. `dirname $0`/m0t1fs_common_inc.sh
. `dirname $0`/m0t1fs_client_inc.sh
. `dirname $0`/m0t1fs_server_inc.sh
. `dirname $0`/m0t1fs_sns_common_inc.sh
. $(dirname $0)/common.sh
. $(dirname $0)/m0t1fs_common_inc.sh
. $(dirname $0)/m0t1fs_client_inc.sh
. $(dirname $0)/m0t1fs_server_inc.sh
. $(dirname $0)/m0t1fs_sns_common_inc.sh

. $M0_SRC_DIR/utils/functions # opcode

Expand Down Expand Up @@ -146,7 +146,7 @@ rcancel_post()

rcancel_change_controller_state()
{
local lnet_nid=`sudo lctl list_nids | head -1`
local lnet_nid=$(sudo lctl list_nids | head -1)
local s_endpoint="$lnet_nid:12345:33:1"
local c_endpoint="$lnet_nid:$M0HAM_CLI_EP"
local dev_fid=$1
Expand Down Expand Up @@ -299,18 +299,18 @@ rcancel_cancel_during_write_test()
# It is to verify that some RPC items were indeed canceled through
# RPC session cancelation. Some items are going to get canceled
# while attempting to be posted after session cancelation.
num=`grep -n "dd: " $MOTR_TEST_LOGFILE | grep "writing" | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "dd: " $MOTR_TEST_LOGFILE | grep "writing" | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' ')
echo "dd write processes canceled : $num"
if [ $num -eq 0 ]; then
echo "Failed: No dd writing operation was canceled"
unmount_and_clean
return 1
fi

num=`grep -n "dd: closing" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "dd: closing" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' ')
echo "dd closing processes canceled : $num"

num=`grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$wt_write_file_base" | wc -l | cut -f1 -d' ')
echo "ls processes canceled : $num"
if [ $num -gt 0 ] && [ $rcancel_md_redundancy > 1 ]; then
echo "Failed: ls was canceled inspite-of having rcancel_md_redundancy ($rcancel_md_redundancy) > 1"
Expand Down Expand Up @@ -471,15 +471,15 @@ rcancel_cancel_during_read_test()
# to verify that RPC session was indeed canceled.
# Many of those read ops fail with the error "Input/output error"
# while a few fail with the error "Operation canceled"
num=`grep -n "dd: " $MOTR_TEST_LOGFILE | grep "reading" | egrep 'Operation canceled|Input\/output error' | grep "$rt_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "dd: " $MOTR_TEST_LOGFILE | grep "reading" | egrep 'Operation canceled|Input\/output error' | grep "$rt_file_base" | wc -l | cut -f1 -d' ')
echo "dd read processes canceled : $num"
if [ $num -eq 0 ]; then
echo "Failed: No dd reading operation was canceled"
unmount_and_clean
return 1
fi

num=`grep -n "dd: closing" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "dd: closing" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' ')
echo "dd closing processes canceled : $num"

# Test ls with canceled session
Expand All @@ -488,7 +488,7 @@ rcancel_cancel_during_read_test()
ls -l "$rt_read_file_base"$i
echo "ls_rc: $?"
done
num=`grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "ls: cannot access" $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$rt_read_file_base" | wc -l | cut -f1 -d' ')
echo "ls processes canceled : $num"
if [ $num -gt 0 ] && [ $rcancel_md_redundancy > 1 ]; then
echo "Failed: ls was canceled inspite-of having rcancel_md_redundancy ($rcancel_md_redundancy) > 1"
Expand Down Expand Up @@ -585,7 +585,7 @@ rcancel_cancel_during_create_test()

# Verify that some create operations were indeed canceled due to
# RPC session cancelation.
num=`grep -n "touch: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$ct_create_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "touch: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$ct_create_file_base" | wc -l | cut -f1 -d' ')
echo "create processes canceled : $num"
if [ $num -eq 0 ]; then
echo "Failed: No create operation was canceled"
Expand Down Expand Up @@ -679,7 +679,7 @@ rcancel_cancel_during_delete_test()

# Verify that some delete operations were indeed canceled due to
# RPC session cancelation.
num=`grep -n "rm: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$delete_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "rm: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$delete_file_base" | wc -l | cut -f1 -d' ')
echo "delete processes canceled : $num"
if [ $num -eq 0 ]; then
echo "Failed: No delete operation was canceled"
Expand Down Expand Up @@ -761,7 +761,7 @@ rcancel_cancel_during_setfattr_ops_test()

# Verify that some setfattr operations were indeed canceled due to
# RPC session cancelation.
num=`grep -n "setfattr: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$setfattr_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "setfattr: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$setfattr_file_base" | wc -l | cut -f1 -d' ')
echo "setfattr processes canceled : $num"
if [ $num -eq 0 ]; then
echo "Failed: No setfattr operation was canceled"
Expand Down Expand Up @@ -841,7 +841,7 @@ rcancel_cancel_during_getfattr_ops_test()

# Verify that some getfattr operations were indeed canceled due to
# RPC session cancelation.
num=`grep -n "getfattr: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$getfattr_file_base" | wc -l | cut -f1 -d' '`
num=$(grep -n "getfattr: " $MOTR_TEST_LOGFILE | grep "Operation canceled" | grep "$getfattr_file_base" | wc -l | cut -f1 -d' ')
echo "getfattr processes canceled : $num"
if [ $num -eq 0 ]; then
if [ $rcancel_md_redundancy -eq $RCANCEL_MD_REDUNDANCY_1 ]; then
Expand Down Expand Up @@ -934,7 +934,7 @@ rcancel_test_cases()
echo "TC.8.End: Session cancel with concurrent getfattr ops"
echo "======================================================="

num=`grep -n "Connection timed out" $MOTR_TEST_LOGFILE | wc -l | cut -f1 -d' '`
num=$(grep -n "Connection timed out" $MOTR_TEST_LOGFILE | wc -l | cut -f1 -d' ')
echo "Connection timed out : $num"
if [ $num -gt 0 ]; then
echo "Failed: Connection timed out error has occurred"
Expand Down Expand Up @@ -974,7 +974,7 @@ rcancel_test()

main()
{
NODE_UUID=`uuidgen`
NODE_UUID=$(uuidgen)
local rc

echo "*********************************************************"
Expand Down
10 changes: 5 additions & 5 deletions m0t1fs/linux_kernel/st/m0t1fs_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

usage()
{
echo "Usage: `basename $0` <start|stop> [server_nid]"
echo "Usage: $(basename $0) <start|stop> [server_nid]"
echo "Please provide the server endpoint address you want to use."
echo "e.g. 192.168.172.130@tcp"
echo "If you want to use the default nid registered for lnet, then do"
echo "`basename $0` start default"
echo "$(basename $0) start default"
}

if [ $# -lt 1 ]
Expand All @@ -39,9 +39,9 @@ if [ "x$1" = "x-h" ]; then
exit 0
fi

. `dirname $0`/common.sh
. `dirname $0`/m0t1fs_common_inc.sh
. `dirname $0`/m0t1fs_server_inc.sh
. $(dirname $0)/common.sh
. $(dirname $0)/m0t1fs_common_inc.sh
. $(dirname $0)/m0t1fs_server_inc.sh

main()
{
Expand Down
2 changes: 1 addition & 1 deletion m0t1fs/linux_kernel/st/m0t1fs_server_inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mkiosloopdevs()
cat > disks.conf << EOF
Device:
- id: $ADEV_ID
filename: `pwd`/$ADEV_ID$adisk
filename: $(pwd)/$ADEV_ID$adisk
EOF

dev_end=$(($DDEV_ID + $nr_devs))
Expand Down
8 changes: 4 additions & 4 deletions m0t1fs/linux_kernel/st/m0t1fs_sns_common_inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ wait_for_sns_repair_or_rebalance_not_4()
repair_status="$M0_SRC_DIR/sns/cm/st/m0repair -O $op -t 0 -C ${lnet_nid}:${SNS_QUIESCE_CLI_EP} $ios_eps_not_4"

echo $repair_status
status=`eval $repair_status`
status=$(eval $repair_status)
rc=$?
if [ $rc != 0 ]; then
echo "SNS Repair status query failed"
Expand All @@ -290,7 +290,7 @@ wait_for_sns_repair_or_rebalance()
sleep 5
repair_status="$M0_SRC_DIR/sns/cm/st/m0repair -O $op -t 0 -C ${lnet_nid}:${SNS_QUIESCE_CLI_EP} $ios_eps"
echo $repair_status
status=`eval $repair_status`
status=$(eval $repair_status)
rc=$?
if [ $rc != 0 ]; then
echo "SNS Repair status query failed"
Expand All @@ -301,7 +301,7 @@ wait_for_sns_repair_or_rebalance()
break;
done

op=`echo $status | grep status=3`
op=$(echo $status | grep status=3)
[[ ! -z "$op" ]] && return 1

return 0
Expand Down Expand Up @@ -442,7 +442,7 @@ kill_ios4_ioservice()
{
echo "finding ios4 ..."
echo pgrep -fn ${prog_exec}.+${IOSEP[3]}
ios4_pid=`pgrep -fn ${prog_exec}.+${IOSEP[3]}`
ios4_pid=$(pgrep -fn ${prog_exec}.+${IOSEP[3]})
echo === pid of ios4: $ios4_pid ===
kill -KILL $ios4_pid >/dev/null 2>&1
echo "finding ios4 again..."
Expand Down
12 changes: 6 additions & 6 deletions m0t1fs/linux_kernel/st/m0t1fs_sns_repair_1f.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#


. `dirname $0`/common.sh
. `dirname $0`/m0t1fs_common_inc.sh
. `dirname $0`/m0t1fs_client_inc.sh
. `dirname $0`/m0t1fs_server_inc.sh
. `dirname $0`/m0t1fs_sns_common_inc.sh
. $(dirname $0)/common.sh
. $(dirname $0)/m0t1fs_common_inc.sh
. $(dirname $0)/m0t1fs_client_inc.sh
. $(dirname $0)/m0t1fs_server_inc.sh
. $(dirname $0)/m0t1fs_sns_common_inc.sh

###################################################
# SNS repair is only supported in COPYTOOL mode,
Expand Down Expand Up @@ -169,7 +169,7 @@ main()

sandbox_init

NODE_UUID=`uuidgen`
NODE_UUID=$(uuidgen)
local multiple_pools=0
motr_service start $multiple_pools $stride $N $K $S $P || {
echo "Failed to start Motr Service."
Expand Down
12 changes: 6 additions & 6 deletions m0t1fs/linux_kernel/st/m0t1fs_sns_repair_1k_1f.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#


. `dirname $0`/common.sh
. `dirname $0`/m0t1fs_common_inc.sh
. `dirname $0`/m0t1fs_client_inc.sh
. `dirname $0`/m0t1fs_server_inc.sh
. `dirname $0`/m0t1fs_sns_common_inc.sh
. $(dirname $0)/common.sh
. $(dirname $0)/m0t1fs_common_inc.sh
. $(dirname $0)/m0t1fs_client_inc.sh
. $(dirname $0)/m0t1fs_server_inc.sh
. $(dirname $0)/m0t1fs_sns_common_inc.sh

###################################################
# SNS repair is only supported in COPYTOOL mode,
Expand Down Expand Up @@ -109,7 +109,7 @@ main()

sandbox_init

NODE_UUID=`uuidgen`
NODE_UUID=$(uuidgen)
local multiple_pools=0
motr_service start $multiple_pools $stride $N $K $S $P || {
echo "Failed to start Motr Service."
Expand Down

0 comments on commit 883c27e

Please sign in to comment.