beautysh: re-format
beautysh is enabled in the openbmc-build-scripts on Bash/Zsh/POSIX-sh
files to have a consistent formatting. Re-run the formatter on the
whole repository.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I584c76da2eb35af2177a97d5cd4b882f9881fb80
diff --git a/tools/convert_ip_to_dummy b/tools/convert_ip_to_dummy
index 79f0f25..880518e 100755
--- a/tools/convert_ip_to_dummy
+++ b/tools/convert_ip_to_dummy
@@ -14,15 +14,15 @@
# Validate arguments.
if [ -z "${ip_addr}" ] ; then
- echo "**ERROR** You must provide an IP address as the first positional" \
- "parameter." >&2
- exit 1
+ echo "**ERROR** You must provide an IP address as the first positional" \
+ "parameter." >&2
+ exit 1
fi
if [ -z "${file_path}" ] ; then
- echo "**ERROR** You must provide a file path as the second positional" \
- "parameter." >&2
- exit 1
+ echo "**ERROR** You must provide a file path as the second positional" \
+ "parameter." >&2
+ exit 1
fi
ip_addr_regex=`echo ${ip_addr} | sed 's/\(\.\)/\\\./g'`
diff --git a/tools/generate_test_document b/tools/generate_test_document
index 23ea10a..eda7b9b 100755
--- a/tools/generate_test_document
+++ b/tools/generate_test_document
@@ -7,88 +7,88 @@
# test_case_doc_file_path The test case document file path to be stored.
-function get_parms {
+function get_parms() {
- # Get program parms.
+ # Get program parms.
- test_dir_path="${1}" ; shift
- test_case_doc_file_path="${1}" ; shift
+ test_dir_path="${1}" ; shift
+ test_case_doc_file_path="${1}" ; shift
- return 0
-
-}
-
-
-function validate_parms {
-
- # Validate program parameters.
-
- num_parms="${1}" ; shift
-
- (( ${num_parms} == 0 )) && return 0
-
- if [ -z "${test_dir_path}" ] ; then
- echo "**ERROR** You must provide test directory as the first positional" \
- "parameter." >&2
- return 1
- fi
-
- if [ -z "${test_case_doc_file_path}" ] ; then
- echo "**ERROR** You must provide file path as the second positional" \
- "parameter." >&2
- return 1
- fi
-
- return 0
-
-}
-
-
-function generate_all_test_document {
-
- # Generate all test case documents
-
- local ret_code=0
- python -m robot.testdoc tests testsdirectoryTCdocs.html || ret_code=1
- python -m robot.testdoc extended extendeddirectoryTCdocs.html || ret_code=1
- python -m robot.testdoc gui guidirectoryTCdocs.html || ret_code=1
- python -m robot.testdoc systest systestdirectoryTCdocs.html || ret_code=1
- python -m robot.testdoc xcat xcatdirectoryTCdocs.html || ret_code=1
- python -m robot.testdoc mnfg mnfgdirectoryTCdocs.html || ret_code=1
- python -m robot.testdoc tools toolsdirectoryTCdocs.html || ret_code=1
- python -m robot.testdoc ./openpower/ras rasdirectoryTCdocs.html || ret_code=1
- python -m robot.testdoc ./openpower/secureboot securebootdirectoryTCdocs.html\
- || ret_code=1
- python -m robot.testdoc network networkdirectoryTCdocs.html ||\
- ret_code=1
-
- return ${ret_code}
-}
-
-
-function main_function {
-
- get_parms "$@" || return 1
-
- validate_parms $# || return 1
-
- if (( ${num_parms} == 0 )) ; then
- generate_all_test_document || return 1
return 0
- fi
- echo ${test_dir_path} ${test_case_doc_file_path}
- python -m robot.testdoc ${test_dir_path} ${test_case_doc_file_path}\
- || return 1
+}
- return 0
+
+function validate_parms() {
+
+ # Validate program parameters.
+
+ num_parms="${1}" ; shift
+
+ (( ${num_parms} == 0 )) && return 0
+
+ if [ -z "${test_dir_path}" ] ; then
+ echo "**ERROR** You must provide test directory as the first positional" \
+ "parameter." >&2
+ return 1
+ fi
+
+ if [ -z "${test_case_doc_file_path}" ] ; then
+ echo "**ERROR** You must provide file path as the second positional" \
+ "parameter." >&2
+ return 1
+ fi
+
+ return 0
+
+}
+
+
+function generate_all_test_document() {
+
+ # Generate all test case documents
+
+ local ret_code=0
+ python -m robot.testdoc tests testsdirectoryTCdocs.html || ret_code=1
+ python -m robot.testdoc extended extendeddirectoryTCdocs.html || ret_code=1
+ python -m robot.testdoc gui guidirectoryTCdocs.html || ret_code=1
+ python -m robot.testdoc systest systestdirectoryTCdocs.html || ret_code=1
+ python -m robot.testdoc xcat xcatdirectoryTCdocs.html || ret_code=1
+ python -m robot.testdoc mnfg mnfgdirectoryTCdocs.html || ret_code=1
+ python -m robot.testdoc tools toolsdirectoryTCdocs.html || ret_code=1
+ python -m robot.testdoc ./openpower/ras rasdirectoryTCdocs.html || ret_code=1
+ python -m robot.testdoc ./openpower/secureboot securebootdirectoryTCdocs.html\
+ || ret_code=1
+ python -m robot.testdoc network networkdirectoryTCdocs.html ||\
+ ret_code=1
+
+ return ${ret_code}
+}
+
+
+function main_function() {
+
+ get_parms "$@" || return 1
+
+ validate_parms $# || return 1
+
+ if (( ${num_parms} == 0 )) ; then
+ generate_all_test_document || return 1
+ return 0
+ fi
+
+ echo ${test_dir_path} ${test_case_doc_file_path}
+ python -m robot.testdoc ${test_dir_path} ${test_case_doc_file_path}\
+ || return 1
+
+ return 0
}
# Main
- main_function "${@}"
- rc="${?}"
- exit "${rc}"
+main_function "${@}"
+rc="${?}"
+exit "${rc}"
diff --git a/tools/ras/probe_cpus.sh b/tools/ras/probe_cpus.sh
index a1fa03c..16a4e5a 100755
--- a/tools/ras/probe_cpus.sh
+++ b/tools/ras/probe_cpus.sh
@@ -9,37 +9,37 @@
function usage()
{
- echo "This script runs on HOST OS and gives core-id"
- echo "corresponding to the chip-id."
- echo "usage:"
- echo " $0 [cpu] [-L]"
- echo
- echo "option:"
- echo " [cpu]"
- echo " Logical cpu id."
- echo " -L"
- echo " Show processor layout."
- echo " -h"
- echo " Show this help."
- exit 1
+ echo "This script runs on HOST OS and gives core-id"
+ echo "corresponding to the chip-id."
+ echo "usage:"
+ echo " $0 [cpu] [-L]"
+ echo
+ echo "option:"
+ echo " [cpu]"
+ echo " Logical cpu id."
+ echo " -L"
+ echo " Show processor layout."
+ echo " -h"
+ echo " Show this help."
+ exit 1
}
function parse_args()
{
- while getopts "hL" OPTION
- do
+ while getopts "hL" OPTION
+ do
case $OPTION in
- L)
- SHOW_LAYOUT=1
- ;;
- *)
- usage
- exit 1
- ;;
+ L)
+ SHOW_LAYOUT=1
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
esac
- done
+ done
- CPU=${!OPTIND}
+ CPU=${!OPTIND}
}
parse_args $*
@@ -60,20 +60,20 @@
for cpu_file in $(find $CPU_SYS_DIR -name "cpu[0-9]*")
do
- cpu=$(basename $cpu_file | tr -dc '0-9')
- [ -n "$cpu" ] && NR_CPUS=$(expr $NR_CPUS + 1)
+ cpu=$(basename $cpu_file | tr -dc '0-9')
+ [ -n "$cpu" ] && NR_CPUS=$(expr $NR_CPUS + 1)
- CPU_VALID[$cpu]=0
- [ -n "$CPU" ] && [ $cpu != $CPU ] && continue
- [ ! -e $cpu_file/pir ] && continue
+ CPU_VALID[$cpu]=0
+ [ -n "$CPU" ] && [ $cpu != $CPU ] && continue
+ [ ! -e $cpu_file/pir ] && continue
- CPU_VALID[$cpu]=1
+ CPU_VALID[$cpu]=1
- CPU_FILE[$cpu]=$cpu_file
- pir=$(cat $cpu_file/pir)
- CPU_PIR[$cpu]=$pir
- CORE_ID[$cpu]=$(perl -e '{ printf("%d", (0x'$pir' >> 2) & 0x3f); }')
- CHIP_ID[$cpu]=$(perl -e '{ printf("%x", (0x'$pir' >> 8) & 0x7f); }')
+ CPU_FILE[$cpu]=$cpu_file
+ pir=$(cat $cpu_file/pir)
+ CPU_PIR[$cpu]=$pir
+ CORE_ID[$cpu]=$(perl -e '{ printf("%d", (0x'$pir' >> 2) & 0x3f); }')
+ CHIP_ID[$cpu]=$(perl -e '{ printf("%x", (0x'$pir' >> 8) & 0x7f); }')
done
i=0
@@ -85,41 +85,41 @@
CPU_LIST=" "
while [ $i -lt $NR_CPUS ]
do
- [ ${CPU_VALID[$i]} -eq 0 ] && i=$(expr $i + 1) && continue
+ [ ${CPU_VALID[$i]} -eq 0 ] && i=$(expr $i + 1) && continue
- [ "$chip_id" != "${CHIP_ID[$i]}" ] && core_id=-1 && prev_eq_id=-1 && prev_ex_id=-1
- chip_id=${CHIP_ID[$i]}
- if [ "$core_id" != ${CORE_ID[$i]} ]
- then
- if [ $num_threads -ne 0 ]; then
- echo "THREADS: $num_threads CPUs: $CPU_LIST"
- CPU_LIST=" "
- fi
- CPU_LIST="$CPU_LIST$i "
- echo -n "CHIP ID: ${CHIP_ID[$i]} "
- echo -n "CORE ID: ${CORE_ID[$i]} "
- CHIP_CORES[$chip_id]="${CHIP_CORES[$chip_id]},${CORE_ID[$i]}"
- CORE_MATRIX[$chip_id,${CORE_ID[$i]}]=1
- eq_id=$(perl -e '{ printf("%d", (('${CORE_ID[$i]}' & 0x1c) >> 2)); }')
- if [ $eq_id != $prev_eq_id ]
- then
- CHIP_EQ[$chip_id]="${CHIP_EQ[$chip_id]},$eq_id"
- prev_eq_id=$eq_id
- fi
- ex_id=$(perl -e '{ printf("%d", (('${CORE_ID[$i]}') >> 1)); }')
- if [ $ex_id != $prev_ex_id ]
- then
- CHIP_EX[$chip_id]="${CHIP_EX[$chip_id]},$ex_id"
- prev_ex_id=$ex_id
- fi
- num_threads=1
- else
- CPU_LIST="$CPU_LIST$i "
- num_threads=$(expr $num_threads + 1)
+ [ "$chip_id" != "${CHIP_ID[$i]}" ] && core_id=-1 && prev_eq_id=-1 && prev_ex_id=-1
+ chip_id=${CHIP_ID[$i]}
+ if [ "$core_id" != ${CORE_ID[$i]} ]
+ then
+ if [ $num_threads -ne 0 ]; then
+ echo "THREADS: $num_threads CPUs: $CPU_LIST"
+ CPU_LIST=" "
fi
- core_id=${CORE_ID[$i]}
+ CPU_LIST="$CPU_LIST$i "
+ echo -n "CHIP ID: ${CHIP_ID[$i]} "
+ echo -n "CORE ID: ${CORE_ID[$i]} "
+ CHIP_CORES[$chip_id]="${CHIP_CORES[$chip_id]},${CORE_ID[$i]}"
+ CORE_MATRIX[$chip_id,${CORE_ID[$i]}]=1
+ eq_id=$(perl -e '{ printf("%d", (('${CORE_ID[$i]}' & 0x1c) >> 2)); }')
+ if [ $eq_id != $prev_eq_id ]
+ then
+ CHIP_EQ[$chip_id]="${CHIP_EQ[$chip_id]},$eq_id"
+ prev_eq_id=$eq_id
+ fi
+ ex_id=$(perl -e '{ printf("%d", (('${CORE_ID[$i]}') >> 1)); }')
+ if [ $ex_id != $prev_ex_id ]
+ then
+ CHIP_EX[$chip_id]="${CHIP_EX[$chip_id]},$ex_id"
+ prev_ex_id=$ex_id
+ fi
+ num_threads=1
+ else
+ CPU_LIST="$CPU_LIST$i "
+ num_threads=$(expr $num_threads + 1)
+ fi
+ core_id=${CORE_ID[$i]}
- i=$(expr $i + 1)
+ i=$(expr $i + 1)
done
echo "THREADS: $num_threads CPUs: $CPU_LIST"
@@ -127,13 +127,13 @@
echo "-----------------------------"
for chip_id in ${!CHIP_CORES[@]}
do
- echo "p[$chip_id]"
- CHIP_CORES[$chip_id]="$(echo ${CHIP_CORES[$chip_id]} | cut -c 2-)"
- CHIP_EQ[$chip_id]="$(echo ${CHIP_EQ[$chip_id]} | cut -c 2-)"
- CHIP_EX[$chip_id]="$(echo ${CHIP_EX[$chip_id]} | cut -c 2-)"
- echo " eq[${CHIP_EQ[$chip_id]}]"
- echo " ex[${CHIP_EX[$chip_id]}]"
- echo " c[${CHIP_CORES[$chip_id]}]"
+ echo "p[$chip_id]"
+ CHIP_CORES[$chip_id]="$(echo ${CHIP_CORES[$chip_id]} | cut -c 2-)"
+ CHIP_EQ[$chip_id]="$(echo ${CHIP_EQ[$chip_id]} | cut -c 2-)"
+ CHIP_EX[$chip_id]="$(echo ${CHIP_EX[$chip_id]} | cut -c 2-)"
+ echo " eq[${CHIP_EQ[$chip_id]}]"
+ echo " ex[${CHIP_EX[$chip_id]}]"
+ echo " c[${CHIP_CORES[$chip_id]}]"
done
echo "-----------------------------"
@@ -144,59 +144,59 @@
function print_header()
{
- local _row_=$1
+ local _row_=$1
- for q in 0 2 4
- do
- quad=$(perl -e '{ printf("%02d", ('$q' + '$_row_')); }')
- echo -n " +---EQ$quad----+ "
- done
- echo
+ for q in 0 2 4
+ do
+ quad=$(perl -e '{ printf("%02d", ('$q' + '$_row_')); }')
+ echo -n " +---EQ$quad----+ "
+ done
+ echo
}
function print_core_info()
{
- local _row_=$1
- local _cpos_=$2 # Core position
+ local _row_=$1
+ local _cpos_=$2 # Core position
- for q in 0 2 4
- do
- quad=$(perl -e '{ printf("%02d", ('$q' + '$_row_')); }')
- core_id=$(perl -e '{ printf("%d", ('$_cpos_' + ('$quad' * 4))); }')
- core_id_str=$(perl -e '{ printf("%-2d", ('$_cpos_' + ('$quad' * 4))); }')
- ex=$(perl -e '{ printf("%-2d", ('$core_id' >> 1)); }')
- if [ -n "${CORE_MATRIX[$chip_id,$core_id]}" ]
- then
- echo -n " |EX-$ex C$core_id_str|"
- else
- echo -n " | |"
- fi
- done
- echo
- if [ $_cpos_ -eq 3 ]
+ for q in 0 2 4
+ do
+ quad=$(perl -e '{ printf("%02d", ('$q' + '$_row_')); }')
+ core_id=$(perl -e '{ printf("%d", ('$_cpos_' + ('$quad' * 4))); }')
+ core_id_str=$(perl -e '{ printf("%-2d", ('$_cpos_' + ('$quad' * 4))); }')
+ ex=$(perl -e '{ printf("%-2d", ('$core_id' >> 1)); }')
+ if [ -n "${CORE_MATRIX[$chip_id,$core_id]}" ]
then
- echo " +-----------+ +-----------+ +-----------+"
+ echo -n " |EX-$ex C$core_id_str|"
else
- echo " + - - - - - + + - - - - - + + - - - - - +"
+ echo -n " | |"
fi
+ done
+ echo
+ if [ $_cpos_ -eq 3 ]
+ then
+ echo " +-----------+ +-----------+ +-----------+"
+ else
+ echo " + - - - - - + + - - - - - + + - - - - - +"
+ fi
}
echo
echo "----------Processor Layout-------------------"
for chip_id in ${!CHIP_CORES[@]}
do
- echo "p[$chip_id]"
+ echo "p[$chip_id]"
- for row in 0 1
+ for row in 0 1
+ do
+ print_header $row
+ for core_pos in 0 1 2 3
do
- print_header $row
- for core_pos in 0 1 2 3
- do
- print_core_info $row $core_pos
- done
- echo
-
+ print_core_info $row $core_pos
done
echo
+ done
+ echo
+
done
diff --git a/tools/ras/scom_addr_p9.sh b/tools/ras/scom_addr_p9.sh
index a7c5ff0..7325225 100755
--- a/tools/ras/scom_addr_p9.sh
+++ b/tools/ras/scom_addr_p9.sh
@@ -3,16 +3,16 @@
function usage()
{
- echo
- echo "This script runs on HOST OS and gives translated SCOM address."
- echo "usage: $0: <scom_addr> <core_id>"
- echo
- echo " <scom_addr>:"
- echo " SCOM address that needs translation (e.g. '10010800')."
- echo " <core_id>:"
- echo " Core id as obtained from probe_cpu.sh."
- echo " Should be between 0-23 (e.g. '0')."
- exit 1
+ echo
+ echo "This script runs on HOST OS and gives translated SCOM address."
+ echo "usage: $0: <scom_addr> <core_id>"
+ echo
+ echo " <scom_addr>:"
+ echo " SCOM address that needs translation (e.g. '10010800')."
+ echo " <core_id>:"
+ echo " Core id as obtained from probe_cpu.sh."
+ echo " Should be between 0-23 (e.g. '0')."
+ exit 1
}
[ $# -lt 2 ] && usage
diff --git a/tools/sensors_dbus_list.sh b/tools/sensors_dbus_list.sh
index 597edc1..6cab294 100755
--- a/tools/sensors_dbus_list.sh
+++ b/tools/sensors_dbus_list.sh
@@ -10,15 +10,15 @@
for dobj in $dbus_obj
do
- echo DBUS object:$dobj
- dbus_cmd_out=`busctl tree $dobj --list | grep /sensors/`
+ echo DBUS object:$dobj
+ dbus_cmd_out=`busctl tree $dobj --list | grep /sensors/`
- for i in $dbus_cmd_out
- do
- exist=`busctl introspect $dobj $i | grep yz.openbmc_project.Sensor.Value`
- if [ ! -z "$exist" ]; then
- cmd_value=` busctl get-property $dobj $i xyz.openbmc_project.Sensor.Value Value`
- echo $i Value=${cmd_value##*d}
- fi
- done
+ for i in $dbus_cmd_out
+ do
+ exist=`busctl introspect $dobj $i | grep yz.openbmc_project.Sensor.Value`
+ if [ ! -z "$exist" ]; then
+ cmd_value=` busctl get-property $dobj $i xyz.openbmc_project.Sensor.Value Value`
+ echo $i Value=${cmd_value##*d}
+ fi
+ done
done