From 9269faf40717a1a62cee99f1a80cccc73da2c9cd Mon Sep 17 00:00:00 2001 From: Vamsee Narapareddi Date: Sat, 31 May 2025 01:35:17 +0530 Subject: [PATCH] Fix for WPSS Remoteproc test This commit will fix the wpss remoteproc test issue. Added the proper framework support in the test script Signed-off-by: Vamsee Narapareddi --- .../baseport/wpss_remoteproc/run.sh | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/Runner/suites/Kernel/FunctionalArea/baseport/wpss_remoteproc/run.sh b/Runner/suites/Kernel/FunctionalArea/baseport/wpss_remoteproc/run.sh index ae37cc45..624564be 100755 --- a/Runner/suites/Kernel/FunctionalArea/baseport/wpss_remoteproc/run.sh +++ b/Runner/suites/Kernel/FunctionalArea/baseport/wpss_remoteproc/run.sh @@ -3,6 +3,32 @@ # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. # SPDX-License-Identifier: BSD-3-Clause-Clear +# Robustly find and source init_env +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +INIT_ENV="" +SEARCH="$SCRIPT_DIR" +while [ "$SEARCH" != "/" ]; do + if [ -f "$SEARCH/init_env" ]; then + INIT_ENV="$SEARCH/init_env" + break + fi + SEARCH=$(dirname "$SEARCH") +done + +if [ -z "$INIT_ENV" ]; then + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 + exit 1 +fi + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# Always source functestlib.sh, using $TOOLS exported by init_env +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + TESTNAME="wpss_remoteproc" test_path=$(find_test_case_by_name "$TESTNAME") cd "$test_path" || exit 1 @@ -27,7 +53,7 @@ remoteproc_path="/sys/class/remoteproc/remoteproc${remoteproc_number}" state1=$(cat ${remoteproc_path}/state) if [ "$state1" != "running" ]; then log_fail "$TESTNAME : Test Failed" - echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res + echo "$TESTNAME FAIL" > "$res_file" exit 1 fi @@ -38,7 +64,7 @@ echo stop > ${remoteproc_path}/state state3=$(cat ${remoteproc_path}/state) if [ "$state3" != "offline" ]; then log_fail "wpss stop failed" - echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res + echo "$TESTNAME FAIL" > "$res_file" exit 1 else log_pass "wpss stop successful"