|
16 | 16 | ## no errors for aplay/arecord |
17 | 17 | ## |
18 | 18 |
|
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 |
20 | 21 |
|
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' |
22 | 23 | OPT_HAS_ARG['t']=1 OPT_VAL['t']="$TPLG" |
23 | 24 |
|
24 | 25 | OPT_NAME['m']='mode' OPT_DESC['m']='test mode' |
@@ -67,34 +68,34 @@ func_stop_start_pipeline() |
67 | 68 | sof-process-state.sh $cmd >/dev/null |
68 | 69 | if [ $? -ne 0 ]; then |
69 | 70 | "$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 |
71 | 72 | exit 1 |
72 | 73 | fi |
73 | 74 | dlogi "Stop/start count: $i" |
74 | 75 | # stop the pipeline |
75 | | - kill -SIGSTOP $pid |
| 76 | + kill -SIGSTOP "$pid" |
76 | 77 | sleep $interval |
77 | 78 | # start the pipeline |
78 | | - kill -SIGCONT $pid |
| 79 | + kill -SIGCONT "$pid" |
79 | 80 | sleep $interval |
80 | | - let i++ |
| 81 | + (( i++ )) |
81 | 82 | done |
82 | 83 | } |
83 | 84 |
|
84 | 85 | 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 ))) |
86 | 87 | 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) |
94 | 95 |
|
95 | 96 | dlogi "Testing: run stop/start test on PCM:$pcm,$pipeline_type. Interval time: $interval" |
96 | 97 | 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 & |
98 | 99 | pid=$! |
99 | 100 |
|
100 | 101 | # If the process is terminated too early, this is error case. |
|
105 | 106 | # 4. set params fails, etc |
106 | 107 | sleep 0.5 |
107 | 108 | if [[ ! -d /proc/$pid ]]; then |
108 | | - lsof $snd |
| 109 | + lsof "$snd" |
109 | 110 | die "$cmd process[$pid] is terminated too early" |
110 | 111 | fi |
111 | 112 |
|
112 | 113 | # do stop/start test |
113 | 114 | func_stop_start_pipeline |
114 | 115 | # kill aplay/arecord process |
115 | 116 | dlogc "kill process: kill -9 $pid" |
116 | | - kill -9 $pid && wait $pid 2>/dev/null |
| 117 | + kill -9 "$pid" && wait "$pid" 2>/dev/null |
117 | 118 | done |
118 | 119 |
|
119 | 120 | sof-kernel-log-check.sh "$KERNEL_CHECKPOINT" |
|
0 commit comments