Skip to content

Commit 718ae18

Browse files
authored
Merge pull request #360 from smuppand/UDE
shellcheck: fix trap-only cleanup false positives in kernel stress and userdata tests
2 parents b4c8b39 + 38aaded commit 718ae18

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

  • Runner/suites/Kernel

Runner/suites/Kernel/Baseport/UserDataEncryption/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ MOUNT_DIR=""
5858
FS_PATH=""
5959
key_id=""
6060
KEY_FILE=""
61-
61+
# shellcheck disable=SC2317 # cleanup is invoked via trap
6262
cleanup() {
6363

6464
if [ -n "${MOUNT_DIR:-}" ] && [ "${MOUNT_DIR:-}" != "/" ] && [ -d "${MOUNT_DIR:-}" ]; then

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)