Skip to content

Commit cc047db

Browse files
committed
shellcheck: fix read usage in result_parse and annotate intentional splitting
Use read -r for .res file and line parsing in Runner/utils/result_parse.sh to address SC2162. Also add a targeted SC2086 annotation for the intentional whitespace splitting used to parse testcase name and result fields from each line, without changing the existing result parsing behavior. Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
1 parent 6982767 commit cc047db

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

Runner/utils/result_parse.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
#!/bin/sh
2-
32
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
4-
# SPDX-License-Identifier: BSD-3-Clauseecho "Current working directory is $PWD"
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
echo "Current working directory is $PWD"
55

6-
find . -type f -name "*.res" 2>/dev/null | while IFS= read res_file; do
6+
find . -type f -name "*.res" 2>/dev/null | while IFS= read -r res_file; do
77
echo "$res_file"
88
if [ -f "$res_file" ]; then
9-
while IFS= read line; do
9+
while IFS= read -r line; do
1010
# Skip empty lines
1111
[ -z "$line" ] && continue
12-
13-
# Split line into words
12+
13+
# Split line into whitespace-separated fields
14+
# shellcheck disable=SC2086
1415
set -- $line
1516
tc_name=$1
1617
result=$2
18+
1719
# Report each test case result to LAVA
1820
if [ -n "$tc_name" ] && [ -n "$result" ]; then
19-
if [ "$result" = "FAIL" ]; then
21+
if [ "$result" = "FAIL" ]; then
2022
exit 1
2123
fi
2224
else

0 commit comments

Comments
 (0)