@@ -107,7 +107,8 @@ case "$DURATION" in
107
107
esac
108
108
109
109
if [[ -n " $_help " ]]; then
110
- printf " $usage " " $( basename $0 ) "
110
+ # shellcheck disable=SC2059
111
+ printf " $usage " " $( basename " $0 " ) "
111
112
exit " $_err "
112
113
fi
113
114
@@ -151,7 +152,7 @@ on_int() {
151
152
printf ' Interrupting all components\n'
152
153
trap ' ' SIGINT # avoid interrupting ourself
153
154
for i in $PIDS ; do # intentionally unquoted
154
- if [[ -n " RECORD" ]]; then
155
+ if [[ -n " $ RECORD" ]]; then
155
156
kill -SIGINT -- " -$i "
156
157
else
157
158
kill -SIGINT -- " $i "
@@ -178,7 +179,7 @@ on_int() {
178
179
if [[ -x " $( which flamegraph.pl) " && -x " $( which stackcollapse-perf.pl) " && -n " $( find " $TESTDIR " -maxdepth 1 -name ' *.perf' -print -quit) " ]]; then
179
180
printf ' Generating Flamegraphs\n'
180
181
for i in " $TESTDIR " /* .perf; do
181
- waitpid -t 5 -e $( lsof -Qt " $i " ) & > /dev/null
182
+ waitpid -t 5 -e " $( lsof -Qt " $i " ) " & > /dev/null
182
183
perf script -i " $i " | stackcollapse-perf.pl > " ${i/ .perf/ .folded} "
183
184
flamegraph.pl " ${i/ .perf/ .folded} " > " ${i/ .perf/ .svg} "
184
185
rm -- " ${i/ .perf/ .folded} "
@@ -194,7 +195,7 @@ on_int() {
194
195
195
196
printf ' Terminating any remaining processes\n'
196
197
for i in $PIDS ; do # intentionally unquoted
197
- if [[ -n " RECORD" ]]; then
198
+ if [[ -n " $ RECORD" ]]; then
198
199
kill -SIGTERM -- " -$i "
199
200
else
200
201
kill -SIGTERM -- " $i "
@@ -253,15 +254,15 @@ run() {
253
254
COMP=
254
255
case " $RECORD " in
255
256
perf)
256
- $@ & > " $PROC_LOG " &
257
+ " $@ " & > " $PROC_LOG " &
257
258
COMP=" $! "
258
259
perf record -F 99 -a -g -o " $PNAME " .perf -p " $COMP " & > " $PERF_LOG " &
259
260
PERFS=" $PERFS $! " ;;
260
261
debug)
261
262
${DBG} " $@ " & > " $PROC_LOG " &
262
263
COMP=" $! " ;;
263
264
* )
264
- $@ & > " $PROC_LOG " &
265
+ " $@ " & > " $PROC_LOG " &
265
266
COMP=" $! " ;;
266
267
esac
267
268
@@ -287,9 +288,9 @@ seed() {
287
288
if test ! -e " $SEEDDIR " /" $preseed_id " ; then
288
289
printf ' Creating %s\n' " $preseed_id "
289
290
mkdir -p -- " $SEEDDIR " /" $preseed_id "
290
- pushd " $SEEDDIR " /" $preseed_id " & > /dev/null
291
+ pushd " $SEEDDIR " /" $preseed_id " & > /dev/null || exit
291
292
PID=$( PNAME=seeder BLOCK=1 run " $( getpath seeder) " " $CFG " )
292
- popd & > /dev/null
293
+ popd & > /dev/null || exit
293
294
fi
294
295
295
296
printf ' Using %s as seed\n' " $preseed_id "
@@ -320,25 +321,27 @@ launch() {
320
321
for node in $( seq 0 $(( "$raft " - 1 )) ) ; do
321
322
export PNAME=" $1 ${id} _$node "
322
323
PID=$( run " $( getpath " $1 " ) " " $CFG " " $id " " $node " )
324
+ # shellcheck disable=SC2013
323
325
for ep in $( awk -F' [":]' " /$PNAME .*endpoint/ { print \$ 3 }" " $CFG " ) ; do
324
326
" $RT " /scripts/wait-for-it.sh -q -t 5 -h localhost -p " $ep "
325
327
done
326
328
printf ' Launched logical %s %d, replica %d [PID: %d]\n' " $1 " " $id " " $node " " $PID "
327
- if [[ -n " RECORD" ]]; then
328
- PIDS=" $PIDS $( getpgid $PID ) "
329
+ if [[ -n " $ RECORD" ]]; then
330
+ PIDS=" $PIDS $( getpgid " $PID " ) "
329
331
else
330
332
PIDS=" $PIDS $PID "
331
333
fi
332
334
done
333
335
else
334
336
export PNAME=" $1 ${id} "
335
337
PID=$( run " $( getpath " $1 " ) " " $CFG " " $id " )
338
+ # shellcheck disable=SC2013
336
339
for ep in $( awk -F' [":]' " /$PNAME .*endpoint/ { print \$ 3 }" " $CFG " ) ; do
337
340
" $RT " /scripts/wait-for-it.sh -q -t 5 -h localhost -p " $ep "
338
341
done
339
342
printf ' Launched %s %d [PID: %d]\n' " $1 " " $id " " $PID "
340
- if [[ -n " RECORD" ]]; then
341
- PIDS=" $PIDS $( getpgid $PID ) "
343
+ if [[ -n " $ RECORD" ]]; then
344
+ PIDS=" $PIDS $( getpgid " $PID " ) "
342
345
else
343
346
PIDS=" $PIDS $PID "
344
347
fi
0 commit comments