fix shellcheck error

pull/13397/head
xsmq 4 years ago
parent d1592cee9e
commit bf6da44f84

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,11 +14,11 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
if [ $# != 2 -a $# != 3 ] if [ $# != 2 ] && [ $# != 3 ]
then then
echo "Usage: sh run_distribute_train.sh [MINDRECORD_FILE] [RANK_TABLE] [PRETRAINED_BACKBONE]" echo "Usage: sh run_distribute_train.sh [MINDRECORD_FILE] [RANK_TABLE] [PRETRAINED_BACKBONE]"
echo " or: sh run_distribute_train.sh [MINDRECORD_FILE] [RANK_TABLE]" echo " or: sh run_distribute_train.sh [MINDRECORD_FILE] [RANK_TABLE]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -32,7 +32,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,7 +17,7 @@
if [ $# != 3 ] if [ $# != 3 ]
then then
echo "Usage: sh run_eval.sh [MINDRECORD_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_eval.sh [MINDRECORD_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -31,7 +31,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,7 +17,7 @@
if [ $# != 3 ] if [ $# != 3 ]
then then
echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -31,7 +31,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,11 +14,11 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
if [ $# != 2 -a $# != 3 ] if [ $# != 2 ] && [ $# != 3 ]
then then
echo "Usage: sh run_standalone_train.sh [MINDRECORD_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_standalone_train.sh [MINDRECORD_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
echo " or: sh run_standalone_train.sh [MINDRECORD_FILE] [USE_DEVICE_ID]" echo " or: sh run_standalone_train.sh [MINDRECORD_FILE] [USE_DEVICE_ID]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -32,7 +32,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,11 +14,11 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
if [ $# != 2 -a $# != 3 ] if [ $# != 2 ] && [ $# != 3 ]
then then
echo "Usage: sh run_distribute_train.sh [TRAIN_LABEL_FILE] [RANK_TABLE] [PRETRAINED_BACKBONE]" echo "Usage: sh run_distribute_train.sh [TRAIN_LABEL_FILE] [RANK_TABLE] [PRETRAINED_BACKBONE]"
echo " or: sh run_distribute_train.sh [TRAIN_LABEL_FILE] [RANK_TABLE]" echo " or: sh run_distribute_train.sh [TRAIN_LABEL_FILE] [RANK_TABLE]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -32,7 +32,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,7 +17,7 @@
if [ $# != 3 ] if [ $# != 3 ]
then then
echo "Usage: sh run_eval.sh [EVAL_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_eval.sh [EVAL_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -31,7 +31,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,7 +17,7 @@
if [ $# != 3 ] if [ $# != 3 ]
then then
echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -31,7 +31,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,11 +14,11 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
if [ $# != 2 -a $# != 3 ] if [ $# != 2 ] && [ $# != 3 ]
then then
echo "Usage: sh run_standalone_train.sh [TRAIN_LABEL_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_standalone_train.sh [TRAIN_LABEL_FILE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
echo " or: sh run_standalone_train.sh [TRAIN_LABEL_FILE] [USE_DEVICE_ID]" echo " or: sh run_standalone_train.sh [TRAIN_LABEL_FILE] [USE_DEVICE_ID]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -32,7 +32,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
if [ $# != 2 -a $# != 3 ] if [ $# != 2 ] && [ $# != 3 ]
then then
echo "Usage: sh run_distribute_train.sh [DATA_DIR] [RANK_TABLE] [PRETRAINED_BACKBONE]" echo "Usage: sh run_distribute_train.sh [DATA_DIR] [RANK_TABLE] [PRETRAINED_BACKBONE]"
echo " or: sh run_distribute_train.sh [DATA_DIR] [RANK_TABLE]" echo " or: sh run_distribute_train.sh [DATA_DIR] [RANK_TABLE]"
@ -32,7 +32,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH
@ -85,4 +85,4 @@ do
--pretrained=$PRETRAINED_BACKBONE > train.log 2>&1 & --pretrained=$PRETRAINED_BACKBONE > train.log 2>&1 &
done done
echo 'running' echo 'running'

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,7 +17,7 @@
if [ $# != 3 ] if [ $# != 3 ]
then then
echo "Usage: sh run_eval.sh [EVAL_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_eval.sh [EVAL_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -31,7 +31,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-201 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,7 +17,7 @@
if [ $# != 3 ] if [ $# != 3 ]
then then
echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_export.sh [BATCH_SIZE] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
exit 1 exit 1
fi fi
get_real_path(){ get_real_path(){
@ -31,7 +31,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd # Copyright 2020-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
if [ $# != 2 -a $# != 3 ] if [ $# != 2 ] && [ $# != 3 ]
then then
echo "Usage: sh run_standalone_train.sh [DATA_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]" echo "Usage: sh run_standalone_train.sh [DATA_DIR] [USE_DEVICE_ID] [PRETRAINED_BACKBONE]"
echo " or: sh run_standalone_train.sh [DATA_DIR] [USE_DEVICE_ID]" echo " or: sh run_standalone_train.sh [DATA_DIR] [USE_DEVICE_ID]"
@ -32,7 +32,7 @@ get_real_path(){
current_exec_path=$(pwd) current_exec_path=$(pwd)
echo ${current_exec_path} echo ${current_exec_path}
dirname_path=$(dirname $(pwd)) dirname_path=$(dirname "$(pwd)")
echo ${dirname_path} echo ${dirname_path}
export PYTHONPATH=${dirname_path}:$PYTHONPATH export PYTHONPATH=${dirname_path}:$PYTHONPATH

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2019 Huawei Technologies Co., Ltd # Copyright 2019-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
set -e set -e
CURRPATH=$(cd $(dirname $0); pwd) CURRPATH=$(cd "$(dirname $0)"; pwd)
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
if [ $1 == "python" ]; then if [ $1 == "python" ]; then

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2019 Huawei Technologies Co., Ltd # Copyright 2019-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
# ============================================================================ # ============================================================================
# This script is the driver of the individual test scenarios # This script is the driver of the individual test scenarios
CURRPATH=$(cd $(dirname $0); pwd) CURRPATH=$(cd "$(dirname $0)"; pwd)
echo "----------------------------------------------" echo "----------------------------------------------"
echo "Invalid syntax and cache_admin failure testing" echo "Invalid syntax and cache_admin failure testing"

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2019 Huawei Technologies Co., Ltd # Copyright 2019-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -18,9 +18,9 @@
# test scenarios for cache op testing. # test scenarios for cache op testing.
# Set any path variables here # Set any path variables here
CURRPATH=$(cd $(dirname $0); pwd) CURRPATH=$(cd "$(dirname $0)"; pwd)
TESTPATH=$(cd ${CURRPATH}/../dataset; pwd) TESTPATH=$(cd "${CURRPATH}/../dataset"; pwd)
PROJECT_PATH=$(cd ${CURRPATH}/../../../..; pwd) PROJECT_PATH=$(cd "${CURRPATH}/../../../../"; pwd)
if [ "x${BUILD_PATH}" == "x" ]; then if [ "x${BUILD_PATH}" == "x" ]; then
BUILD_PATH=${PROJECT_PATH}/build BUILD_PATH=${PROJECT_PATH}/build
@ -64,7 +64,7 @@ MsgOk()
################################################################################# #################################################################################
# Function: MsgFail # # Function: MsgFail #
# Description: Display intput msg with a red format for a failure # # Description: Display input msg with a red format for a failure #
################################################################################# #################################################################################
MsgFail() MsgFail()
{ {
@ -154,11 +154,11 @@ CacheAdminCmd()
fi fi
result=$(${cmd} 2>&1) result=$(${cmd} 2>&1)
rc=$? rc=$?
if [ ${expect_fail} -eq 0 -a ${rc} -ne 0 ]; then if [ "${expect_fail}" -eq 0 ] && [ "${rc}" -ne 0 ]; then
MsgFail "FAILED" MsgFail "FAILED"
MsgError "cache_admin command failure!" "${rc}" "${result}" MsgError "cache_admin command failure!" "${rc}" "${result}"
return 1 return 1
elif [ ${expect_fail} -eq 1 -a ${rc} -eq 0 ]; then elif [ "${expect_fail}" -eq 1 ] && [ "${rc}" -eq 0 ]; then
MsgFail "FAILED" MsgFail "FAILED"
MsgError "Expected failure but got success!" "${rc}" "${result}" MsgError "Expected failure but got success!" "${rc}" "${result}"
return 1 return 1

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright 2019 Huawei Technologies Co., Ltd # Copyright 2019-2021 Huawei Technologies Co., Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
# ============================================================================ # ============================================================================
CURRPATH=$(cd $(dirname $0); pwd) CURRPATH=$(cd "$(dirname $0)"; pwd)
PROJECT_PATH=${CURRPATH}/../.. PROJECT_PATH=${CURRPATH}/../..
if [ $BUILD_PATH ];then if [ $BUILD_PATH ];then
echo "BUILD_PATH = $BUILD_PATH" echo "BUILD_PATH = $BUILD_PATH"

Loading…
Cancel
Save