Skip to content

Commit 368408f

Browse files
fredoh9marc-hb
authored andcommitted
check-signal-stop-start.sh: fix shellcheck errors
Fixed shellcheck error, no function changed. Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
1 parent 2337a77 commit 368408f

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

test-case/check-signal-stop-start.sh

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
## no errors for aplay/arecord
1717
##
1818

19-
source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh
19+
# shellcheck source=case-lib/lib.sh
20+
source "$(dirname "${BASH_SOURCE[0]}")"/../case-lib/lib.sh
2021

21-
OPT_NAME['t']='tplg' OPT_DESC['t']='tplg file, default value is env TPLG: $TPLG'
22+
OPT_NAME['t']='tplg' OPT_DESC['t']='tplg file, default value is env TPLG'
2223
OPT_HAS_ARG['t']=1 OPT_VAL['t']="$TPLG"
2324

2425
OPT_NAME['m']='mode' OPT_DESC['m']='test mode'
@@ -67,34 +68,34 @@ func_stop_start_pipeline()
6768
sof-process-state.sh $cmd >/dev/null
6869
if [ $? -ne 0 ]; then
6970
"$cmd process is in an abnormal status"
70-
kill -9 $pid && wait $pid 2>/dev/null
71+
kill -9 "$pid" && wait "$pid" 2>/dev/null
7172
exit 1
7273
fi
7374
dlogi "Stop/start count: $i"
7475
# stop the pipeline
75-
kill -SIGSTOP $pid
76+
kill -SIGSTOP "$pid"
7677
sleep $interval
7778
# start the pipeline
78-
kill -SIGCONT $pid
79+
kill -SIGCONT "$pid"
7980
sleep $interval
80-
let i++
81+
(( i++ ))
8182
done
8283
}
8384

8485
func_pipeline_export "$tplg" "type:$test_mode"
85-
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
86+
for idx in $(seq 0 $(( "$PIPELINE_COUNT" - 1 )))
8687
do
87-
channel=$(func_pipeline_parse_value $idx channel)
88-
rate=$(func_pipeline_parse_value $idx rate)
89-
fmt=$(func_pipeline_parse_value $idx fmt)
90-
dev=$(func_pipeline_parse_value $idx dev)
91-
pcm=$(func_pipeline_parse_value $idx pcm)
92-
pipeline_type=$(func_pipeline_parse_value $idx "type")
93-
snd=$(func_pipeline_parse_value $idx snd)
88+
channel=$(func_pipeline_parse_value "$idx" channel)
89+
rate=$(func_pipeline_parse_value "$idx" rate)
90+
fmt=$(func_pipeline_parse_value "$idx" fmt)
91+
dev=$(func_pipeline_parse_value "$idx" dev)
92+
pcm=$(func_pipeline_parse_value "$idx" pcm)
93+
pipeline_type=$(func_pipeline_parse_value "$idx" "type")
94+
snd=$(func_pipeline_parse_value "$idx" snd)
9495

9596
dlogi "Testing: run stop/start test on PCM:$pcm,$pipeline_type. Interval time: $interval"
9697
dlogc "$cmd -D$dev -r $rate -c $channel -f $fmt $dummy_file -q &"
97-
$cmd -D$dev -r $rate -c $channel -f $fmt $dummy_file -q &
98+
$cmd -D"$dev" -r "$rate" -c "$channel" -f "$fmt" $dummy_file -q &
9899
pid=$!
99100

100101
# If the process is terminated too early, this is error case.
@@ -105,15 +106,15 @@ do
105106
# 4. set params fails, etc
106107
sleep 0.5
107108
if [[ ! -d /proc/$pid ]]; then
108-
lsof $snd
109+
lsof "$snd"
109110
die "$cmd process[$pid] is terminated too early"
110111
fi
111112

112113
# do stop/start test
113114
func_stop_start_pipeline
114115
# kill aplay/arecord process
115116
dlogc "kill process: kill -9 $pid"
116-
kill -9 $pid && wait $pid 2>/dev/null
117+
kill -9 "$pid" && wait "$pid" 2>/dev/null
117118
done
118119

119120
sof-kernel-log-check.sh "$KERNEL_CHECKPOINT"

0 commit comments

Comments
 (0)