Skip to content

Commit 0b87838

Browse files
author
Jeevanandan Sandan
committed
feat: added qrtr-lookup test
Signed-off-by: Jeevanandan Sandan <sandanka@qti.qualcomm.com>
1 parent e74eec8 commit 0b87838

3 files changed

Lines changed: 23 additions & 37 deletions

File tree

Runner/suites/Kernel/Baseport/IPC/qrtr_lookup_validation/qrtr_lookup_validation.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ metadata:
66
- linux
77
scope:
88
- functional
9+
params:
10+
REMOTE_PROC: "adsp"
911
run:
1012
steps:
1113
- REPO_PATH=$PWD
1214
- cd Runner/suites/Kernel/Baseport/IPC/qrtr_lookup_validation
13-
- ./run.sh -t adsp || true
14-
- $REPO_PATH/Runner/utils/send-to-lava.sh qrtr_lookup_validation.res || true
15+
- ./run.sh -t "$REMOTE_PROC"
16+
- $REPO_PATH/Runner/utils/send-to-lava.sh qrtr_lookup_validation.res

Runner/suites/Kernel/Baseport/IPC/qrtr_lookup_validation/run.sh

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# run.sh - Verification for qrtr-lookup service
33

44
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
5-
# SPDX-License-Identifier: BSD-3-Clause-Clear
5+
# SPDX-License-Identifier: BSD-3-Clause
66

77
# Robustly find and source init_env
88
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
@@ -25,18 +25,23 @@ fi
2525
if [ -z "$__INIT_ENV_LOADED" ]; then
2626
# shellcheck disable=SC1090
2727
. "$INIT_ENV"
28+
export __INIT_ENV_LOADED=1
2829
fi
2930

3031
# Always source functestlib.sh
3132
# shellcheck disable=SC1090,SC1091
3233
. "$TOOLS/functestlib.sh"
3334

3435
TESTNAME="qrtr_lookup_validation"
35-
export RESULT_FILE="${PWD}/${TESTNAME}.res"
36+
test_path=$(find_test_case_by_name "$TESTNAME")
37+
cd "$test_path" || exit 1
38+
res_file="./$TESTNAME.res"
3639

3740
log_info "--------------------------------------------------"
3841
log_info "------------- Starting $TESTNAME Test ------------"
3942

43+
check_dependencies qrtr-lookup
44+
4045
# --- Argument Parsing ---
4146
TARGET_NAME=""
4247
INSTANCE_ID=""
@@ -47,7 +52,7 @@ while getopts "t:i:" opt; do
4752
i) INSTANCE_ID=$OPTARG ;;
4853
\?)
4954
log_fail "Invalid option: -$OPTARG"
50-
echo "$TESTNAME FAIL" > "$RESULT_FILE"
55+
echo "$TESTNAME FAIL" > "$res_file"
5156
exit 0
5257
;;
5358
esac
@@ -61,19 +66,7 @@ if [ -n "$TARGET_NAME" ]; then
6166
log_info "Mapped target '$TARGET_NAME' to Instance ID $INSTANCE_ID"
6267
else
6368
log_fail "Unknown target name '$TARGET_NAME'"
64-
echo "$TESTNAME FAIL" > "$RESULT_FILE"
65-
exit 0
66-
fi
67-
fi
68-
69-
# Check Binary
70-
bin="qrtr-lookup"
71-
if ! command -v "$bin" >/dev/null 2>&1; then
72-
if [ -f "/usr/bin/$bin" ]; then
73-
export PATH="$PATH:/usr/bin"
74-
else
75-
log_skip "'qrtr-lookup' binary not found"
76-
echo "$TESTNAME SKIP" > "$RESULT_FILE"
69+
echo "$TESTNAME FAIL" > "$res_file"
7770
exit 0
7871
fi
7972
fi
@@ -87,10 +80,10 @@ if [ -n "$INSTANCE_ID" ]; then
8780
if qrtr_id_exists "$INSTANCE_ID"; then
8881
scan_dmesg_errors "qrtr" "$PWD"
8982
log_pass "Found service for ID $INSTANCE_ID"
90-
echo "$TESTNAME PASS" > "$RESULT_FILE"
83+
echo "$TESTNAME PASS" > "$res_file"
9184
else
9285
log_fail "Instance ID $INSTANCE_ID not found in qrtr-lookup output."
93-
echo "$TESTNAME FAIL" > "$RESULT_FILE"
86+
echo "$TESTNAME FAIL" > "$res_file"
9487
fi
9588

9689
else
@@ -111,10 +104,10 @@ else
111104
# Pass if at least one is found
112105
scan_dmesg_errors "qrtr" "$PWD"
113106
log_pass "Found active qrtr-lookup test services"
114-
echo "$TESTNAME PASS" > "$RESULT_FILE"
107+
echo "$TESTNAME PASS" > "$res_file"
115108
else
116109
log_fail "No 'Test service' lines found in qrtr-lookup output."
117-
echo "$TESTNAME FAIL" > "$RESULT_FILE"
110+
echo "$TESTNAME FAIL" > "$res_file"
118111
fi
119112
fi
120113

Runner/utils/functestlib.sh

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4559,27 +4559,18 @@ get_pid() {
45594559
return 1
45604560
}
45614561

4562-
# Returns count of "Test service" lines
4563-
get_qrtr_test_service_count() {
4564-
if ! command -v qrtr-lookup >/dev/null 2>&1; then
4565-
echo "0"
4566-
return
4567-
fi
4568-
qrtr-lookup | grep -F -c 'Test service'
4569-
}
4570-
45714562
# Check if a specific Node ID (column 3) exists
45724563
qrtr_id_exists() {
4573-
target="$1"
4574-
if ! command -v qrtr-lookup >/dev/null 2>&1; then
4575-
return 1
4576-
fi
4577-
qrtr-lookup | awk -v target="$target" '$3 == target { found=1; exit } END { if(!found) exit 1 }'
4564+
target=$1
4565+
qrtr-lookup 2>/dev/null | awk -v target="$target" '
4566+
NR > 1 && $3 ~ /^[0-9]+$/ && $3 == target { found = 1; exit }
4567+
END { exit(found ? 0 : 1) }
4568+
'
45784569
}
45794570

45804571
# Map human-readable names to IDs
45814572
get_qrtr_id_from_name() {
4582-
key=$(echo "$1" | tr '[:upper:]' '[:lower:]')
4573+
key=$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')
45834574
case "$key" in
45844575
"adsp" | "adsp-root") echo "32" ;;
45854576
"adsp-audiopd" | "audio") echo "33" ;;

0 commit comments

Comments
 (0)