|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. |
| 4 | +# SPDX-License-Identifier: BSD-3-Clause-Clear |
| 5 | + |
| 6 | +# Robustly find and source init_env |
| 7 | +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" |
| 8 | +INIT_ENV="" |
| 9 | +SEARCH="$SCRIPT_DIR" |
| 10 | +while [ "$SEARCH" != "/" ]; do |
| 11 | + if [ -f "$SEARCH/init_env" ]; then |
| 12 | + INIT_ENV="$SEARCH/init_env" |
| 13 | + break |
| 14 | + fi |
| 15 | + SEARCH=$(dirname "$SEARCH") |
| 16 | +done |
| 17 | + |
| 18 | +if [ -z "$INIT_ENV" ]; then |
| 19 | + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 |
| 20 | + exit 1 |
| 21 | +fi |
| 22 | + |
| 23 | +if [ -z "$__INIT_ENV_LOADED" ]; then |
| 24 | + # shellcheck disable=SC1090 |
| 25 | + . "$INIT_ENV" |
| 26 | +fi |
| 27 | + |
| 28 | +# shellcheck disable=SC1090,SC1091 |
| 29 | +. "$TOOLS/functestlib.sh" |
| 30 | + |
| 31 | +TESTNAME="gdsp_remoteproc" |
| 32 | +test_path=$(find_test_case_by_name "$TESTNAME") |
| 33 | +cd "$test_path" || exit 1 |
| 34 | + |
| 35 | +res_file="./$TESTNAME.res" |
| 36 | +LOG_FILE="./$TESTNAME.log" |
| 37 | + |
| 38 | +exec > >(tee -a "$LOG_FILE") 2>&1 |
| 39 | + |
| 40 | +log_info "-----------------------------------------------------------------------------------------" |
| 41 | +log_info "-------------------Starting $TESTNAME Testcase----------------------------" |
| 42 | +log_info "=== Test Initialization ===" |
| 43 | + |
| 44 | +for gdsp_firmware in gpdsp0 gpdsp1; do |
| 45 | + log_info "Processing $gdsp_firmware" |
| 46 | + |
| 47 | + if validate_remoteproc_running "$gdsp_firmware" "$LOG_FILE"; then |
| 48 | + log_pass "$gdsp_firmware remoteproc validated as running" |
| 49 | + echo "$TESTNAME PASS" > "$res_file" |
| 50 | + else |
| 51 | + log_fail "$gdsp_firmware remoteproc failed validation" |
| 52 | + echo "$TESTNAME FAIL" > "$res_file" |
| 53 | + fi |
| 54 | + |
| 55 | + # At this point we are sure: path exists and is in running state |
| 56 | + rproc_path=$(get_remoteproc_path_by_firmware "$gdsp_firmware") |
| 57 | + |
| 58 | + if ! stop_remoteproc "$rproc_path"; then |
| 59 | + log_fail "$gdsp_firmware stop failed" |
| 60 | + echo "$TESTNAME FAIL" > "$res_file" |
| 61 | + exit 1 |
| 62 | + else |
| 63 | + log_pass "$gdsp_firmware stop successful" |
| 64 | + fi |
| 65 | + |
| 66 | + log_info "Restarting $gdsp_firmware" |
| 67 | + if ! start_remoteproc "$rproc_path"; then |
| 68 | + log_fail "$gdsp_firmware start failed" |
| 69 | + echo "$TESTNAME FAIL" > "$res_file" |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | + |
| 73 | + log_pass "$gdsp_firmware PASS" |
| 74 | +done |
| 75 | + |
| 76 | +echo "$TESTNAME PASS" > "$res_file" |
| 77 | +log_info "-------------------Completed $TESTNAME Testcase----------------------------" |
| 78 | +exit 0 |
0 commit comments