Skip to content

Commit 072188d

Browse files
ulfalizerandrewboie
authored andcommitted
bsim_bt: run_parallel.sh: Use lowercase for internal vars
This makes it possible to tell at a glance which variables are internal to the script and which ones are parameters to it, which is very helpful. This convention is pretty common. See e.g. Google's shell style guide at https://google.github.io/styleguide/shell.xml#Naming_Conventions, and https://github.com/icy/bash-coding-style#naming-and-styles. It's older than those though. Signed-off-by: Ulf Magnusson <[email protected]>
1 parent 9446554 commit 072188d

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

tests/bluetooth/bsim_bt/run_parallel.sh

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
set -u
88

9-
START=$SECONDS
9+
start=$SECONDS
1010

1111
function display_help(){
1212
echo "run_parallel.sh [-help] [options]"
@@ -31,25 +31,25 @@ i=0
3131
SEARCH_PATH="${SEARCH_PATH:-`pwd`}"
3232

3333
#All the testcases we want to run:
34-
ALL_CASES=`find ${SEARCH_PATH} -name "*.sh" | \
34+
all_cases=`find ${SEARCH_PATH} -name "*.sh" | \
3535
grep -Ev "(/_|run_parallel|compile.sh)"`
3636
#we dont run ourselves
3737

3838
RESULTS_FILE="${RESULTS_FILE:-`pwd`/../RunResults.xml}"
39-
TMP_RES_FILE=tmp.xml
39+
tmp_res_file=tmp.xml
4040

41-
ALL_CASES_A=( $ALL_CASES )
42-
N_CASES=$((${#ALL_CASES_A[@]}))
41+
all_cases_a=( $all_cases )
42+
n_cases=$((${#all_cases_a[@]}))
4343
touch ${RESULTS_FILE}
44-
echo "Attempting to run ${N_CASES} cases (logging to \
44+
echo "Attempting to run ${n_cases} cases (logging to \
4545
`realpath ${RESULTS_FILE}`)"
4646

47-
chmod +x $ALL_CASES
47+
chmod +x $all_cases
4848

4949
export CLEAN_XML="sed -E -e 's/&/\&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g' \
5050
-e 's/\"/&quot;/g'"
5151

52-
echo -n "" > $TMP_RES_FILE
52+
echo -n "" > $tmp_res_file
5353

5454
if [ `command -v parallel` ]; then
5555
parallel '
@@ -69,31 +69,31 @@ if [ `command -v parallel` ]; then
6969
rm {#}.log ;
7070
echo "</testcase>";
7171
fi;
72-
' ::: $ALL_CASES >> $TMP_RES_FILE ; err=$?
72+
' ::: $all_cases >> $tmp_res_file ; err=$?
7373
else #fallback in case parallel is not installed
74-
for CASE in $ALL_CASES; do
75-
echo "<testcase name=\"$CASE\" time=\"0\">" >> $TMP_RES_FILE
76-
$CASE $@ &> $i.log
74+
for case in $all_cases; do
75+
echo "<testcase name=\"$case\" time=\"0\">" >> $tmp_res_file
76+
$case $@ &> $i.log
7777
if [ $? -ne 0 ]; then
78-
echo -e "\e[91m$CASE FAILED\e[39m"
78+
echo -e "\e[91m$case FAILED\e[39m"
7979
cat $i.log
80-
echo "<failure message=\"failed\" type=\"failure\">" >> $TMP_RES_FILE
81-
cat $i.log | eval $CLEAN_XML >> $TMP_RES_FILE
82-
echo "</failure>" >> $TMP_RES_FILE
80+
echo "<failure message=\"failed\" type=\"failure\">" >> $tmp_res_file
81+
cat $i.log | eval $CLEAN_XML >> $tmp_res_file
82+
echo "</failure>" >> $tmp_res_file
8383
let "err++"
8484
else
85-
echo -e "$CASE PASSED"
85+
echo -e "$case PASSED"
8686
fi;
87-
echo "</testcase>" >> $TMP_RES_FILE
87+
echo "</testcase>" >> $tmp_res_file
8888
rm $i.log
8989
let i=i+1
9090
done
9191
fi
92-
echo -e "</testsuite>\n</testsuites>\n" >> $TMP_RES_FILE
93-
dur=$(($SECONDS - $START))
92+
echo -e "</testsuite>\n</testsuites>\n" >> $tmp_res_file
93+
dur=$(($SECONDS - $start))
9494
echo -e "<testsuites>\n<testsuite errors=\"0\" failures=\"$err\"\
95-
name=\"bsim_bt tests\" skip=\"0\" tests=\"$N_CASES\" time=\"$dur\">" \
96-
| cat - $TMP_RES_FILE > $RESULTS_FILE
97-
rm $TMP_RES_FILE
95+
name=\"bsim_bt tests\" skip=\"0\" tests=\"$n_cases\" time=\"$dur\">" \
96+
| cat - $tmp_res_file > $RESULTS_FILE
97+
rm $tmp_res_file
9898

9999
exit $err

0 commit comments

Comments
 (0)