Skip to content

Commit 38aaded

Browse files
committed
shellcheck: fix cpu counting and trap-only cleanup warning in Stressapptest
Update Runner/suites/Kernel/Stress/Stressapptest/run.sh to: - replace the CPU_COUNT calculation with a shellcheck-clean form that preserves the intended counting of space-separated ONLINE_CPUS - add a targeted SC2317 annotation for the cleanup function invoked only through trap This is a mechanical cleanup and does not change the intended stressapptest flow. Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
1 parent f56fdd6 commit 38aaded

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • Runner/suites/Kernel/Stress/Stressapptest

Runner/suites/Kernel/Stress/Stressapptest/run.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,9 @@ detect_online_cpus() {
182182
fi
183183
ONLINE_CPUS=$(expand_list "$ONLINE_STR")
184184
[ -n "$ONLINE_CPUS" ] || ONLINE_CPUS="0"
185-
CPU_COUNT=$(printf "%s\n" $ONLINE_CPUS | wc -l | tr -d ' ')
185+
CPU_COUNT=$(printf '%s\n' "$ONLINE_CPUS" | awk '{c += NF} END {print c + 0}')
186186
}
187187
detect_online_cpus
188-
189188
# Return online NUMA nodes as CSV (e.g. "0,1")
190189
nodes_online() {
191190
if [ -r /sys/devices/system/node/online ]; then
@@ -407,7 +406,7 @@ if [ "$AUTO_DISK" -eq 1 ] && [ -z "$USER_f" ]; then
407406
log_warn "Auto-disk requested but 'df' not available; skipping"
408407
fi
409408
fi
410-
409+
# shellcheck disable=SC2317 # cleanup is invoked via trap
411410
cleanup_auto_bits() {
412411
[ -n "$LISTENER_PID" ] && kill "$LISTENER_PID" 2>/dev/null
413412
[ -n "$TMPF" ] && rm -f "$TMPF" 2>/dev/null

0 commit comments

Comments
 (0)