From 9e35bdff4d055cd9c2a832a1a6c3a75f5e430f9b Mon Sep 17 00:00:00 2001 From: Srikanth Muppandam Date: Fri, 4 Sep 2026 22:51:36 +0530 Subject: [PATCH] qrtr: share topology diagnostics across suites Add bounded QRTR topology evidence to RMTFS service validation and FastRPC diagnostics through shared helpers. Keep runtime applicability separate from installed build artifacts and expose configurable timeouts with useful defaults. Signed-off-by: Srikanth Muppandam --- .../RMTFS_QMI_Service_Validation/README.md | 37 ++++++++++++- .../RMTFS_QMI_Service_Validation/run.sh | 53 +++++++++++-------- .../CDSP/fastrpc_test/fastrpc_test_README.md | 27 ++++++++-- .../Multimedia/CDSP/fastrpc_test/run.sh | 21 ++++++-- Runner/utils/lib_fastrpc.sh | 35 ++++++++++++ 5 files changed, 140 insertions(+), 33 deletions(-) diff --git a/Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation/README.md b/Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation/README.md index 365c2ad73..59d9fe7a3 100644 --- a/Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation/README.md +++ b/Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation/README.md @@ -10,8 +10,15 @@ Uses `qrtr-lookup` to validate the service published by public - version: `1` - instance: `0` +The lookup uses the shared bounded QRTR topology helper. The same retained +inventory and service-matching contract can be reused by FastRPC diagnostics +and focused PD Mapper, TQFTP, and time-service validation without duplicating +QRTR parsing or introducing unbounded waits. + The values can be overridden with `RMTFS_QMI_SERVICE`, `RMTFS_QMI_VERSION`, and -`RMTFS_QMI_INSTANCE` for a documented downstream implementation. +`RMTFS_QMI_INSTANCE` for a documented downstream implementation. The bounded +lookup defaults to ten seconds and can be adjusted with +`QRTR_LOOKUP_TIMEOUT`. On an applicable mainline platform, the suite temporarily loads `rmtfs_mem` and starts the image-provided service when necessary. Failure to start the @@ -23,3 +30,31 @@ diagnostic. Module and service state are restored after the lookup. cd Runner ./run-test.sh RMTFS_QMI_Service_Validation ``` + +Run the suite directly on the target when investigating the service: + +```sh +cd Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation +./run.sh +``` + +Without overrides, this validates service `14`, version `1`, instance `0`, +using a ten-second bounded QRTR lookup. The effective values are printed at +startup. + +Optionally override the default bounded lookup timeout: + +```sh +QRTR_LOOKUP_TIMEOUT=20 ./run.sh +``` + +Check the result and retained QRTR topology: + +```sh +cat RMTFS_QMI_Service_Validation.res +test -r qrtr_lookup_rmtfs.log && cat qrtr_lookup_rmtfs.log +``` + +An applicable RMTFS platform fails when the bounded query is broken or the +expected `14 1 0` service row is absent. A platform without runtime RMTFS +evidence, or an image without optional `qrtr-lookup`, is reported as SKIP. diff --git a/Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation/run.sh b/Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation/run.sh index 38d49af3c..3053b0960 100755 --- a/Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation/run.sh +++ b/Runner/suites/Kernel/Baseport/Storage/RMTFS_QMI_Service_Validation/run.sh @@ -43,6 +43,7 @@ RES_FILE="$SCRIPT_DIR/$TESTNAME.res" SERVICE_ID="${RMTFS_QMI_SERVICE:-14}" SERVICE_VERSION="${RMTFS_QMI_VERSION:-1}" SERVICE_INSTANCE="${RMTFS_QMI_INSTANCE:-0}" +QRTR_LOOKUP_TIMEOUT="${QRTR_LOOKUP_TIMEOUT:-10}" rm -f "$RES_FILE" # shellcheck disable=SC2317 @@ -70,6 +71,13 @@ finish_result() { trap cleanup_on_exit 0 trap 'exit 1' 1 2 15 +OS_ID=$(pkg_detect_os_id 2>/dev/null || echo unknown) +RUN_LOG="$SCRIPT_DIR/qrtr_lookup_rmtfs.log" +rm -f "$RUN_LOG" +log_info "Starting $TESTNAME on OS=$OS_ID" +log_info "Configuration: RMTFS_QMI_SERVICE=$SERVICE_ID RMTFS_QMI_VERSION=$SERVICE_VERSION RMTFS_QMI_INSTANCE=$SERVICE_INSTANCE QRTR_LOOKUP_TIMEOUT=${QRTR_LOOKUP_TIMEOUT}s" +log_info "Validation target: public linux-msm/rmtfs service=$SERVICE_ID version=$SERVICE_VERSION instance=$SERVICE_INSTANCE" + RMTFS_RUNTIME_DIR="$SCRIPT_DIR/rmtfs_runtime" rmtfs_runtime_prepare "$RMTFS_RUNTIME_DIR" PREPARE_RC=$? @@ -102,32 +110,31 @@ if ! rmtfs_start_service_if_available || \ finish_result FAIL fi -if ! command -v qrtr-lookup >/dev/null 2>&1; then - log_skip "$TESTNAME SKIP: qrtr-lookup is not installed" - finish_result SKIP -fi - -OS_ID=$(pkg_detect_os_id 2>/dev/null || echo unknown) -RUN_LOG="$SCRIPT_DIR/qrtr_lookup_rmtfs.log" -rm -f "$RUN_LOG" "$RES_FILE" -log_info "Starting $TESTNAME on OS=$OS_ID" -log_info "Expecting public linux-msm/rmtfs registration: service=$SERVICE_ID version=$SERVICE_VERSION instance=$SERVICE_INSTANCE" +log_info "Validating public linux-msm/rmtfs registration: service=$SERVICE_ID version=$SERVICE_VERSION instance=$SERVICE_INSTANCE" -qrtr-lookup "$SERVICE_ID" > "$RUN_LOG" 2>&1 +qrtr_capture_topology "$RUN_LOG" "$QRTR_LOOKUP_TIMEOUT" LOOKUP_RC=$? -while IFS= read -r line; do - if [ -n "$line" ]; then - log_info "[qrtr-lookup] $line" - fi -done < "$RUN_LOG" - -if [ "$LOOKUP_RC" -ne 0 ]; then - log_fail "$TESTNAME FAIL: qrtr-lookup returned $LOOKUP_RC" - finish_result FAIL -fi -if awk -v service="$SERVICE_ID" -v version="$SERVICE_VERSION" -v instance="$SERVICE_INSTANCE" \ - 'NR > 1 && $1 == service && $2 == version && $3 == instance { found=1 } END { exit !found }' "$RUN_LOG"; then +case "$LOOKUP_RC" in + 0) + log_file_with_label "qrtr-lookup" "$RUN_LOG" + ;; + 2) + log_skip "$TESTNAME SKIP: QRTR runtime or qrtr-lookup is unavailable" + finish_result SKIP + ;; + *) + log_file_with_label "qrtr-lookup" "$RUN_LOG" + log_fail "$TESTNAME FAIL: bounded QRTR topology query failed" + finish_result FAIL + ;; +esac + +if qrtr_topology_has_service \ + "$RUN_LOG" \ + "$SERVICE_ID" \ + "$SERVICE_VERSION" \ + "$SERVICE_INSTANCE"; then log_pass "$TESTNAME PASS: RMTFS QMI service registration found" finish_result PASS fi diff --git a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md index 85f22b00f..5f15cbafe 100644 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md @@ -5,6 +5,11 @@ The **fastrpc_test** runner validates FastRPC (Fast Remote Procedure Call) on Qualcomm targets, offloading work to DSP domains (e.g., **CDSP**). It wraps the public [fastrpc test application](https://github.com/quic/fastrpc) with **robust logging, parameter control, and CI-friendly output**. +When QRTR and `qrtr-lookup` are available, the suite captures one bounded QRTR +service-topology snapshot with its normal artifacts. This remains diagnostic +evidence and does not make QRTR a prerequisite for FastRPC transports on other +platforms. `QRTR_LOOKUP_TIMEOUT` optionally overrides the ten-second default. + Supported capabilities: - Auto-detect architecture from SoC ID. - Multiple iterations and optional timeouts. @@ -54,14 +59,17 @@ Options: --assets-dir Directory that CONTAINS 'linux/' (info only; we run from the binary dir) --user-pd Use '-U 1' (user/unsigned PD). Default is '-U 0'. --repeat Number of repetitions (default: 1) - --timeout Timeout for each run (no timeout if omitted) + --timeout Timeout for each run (default: 60) --verbose Extra logging for CI debugging --help Show this help Env: - FASTRPC_USER_PD=0|1 Sets PD (-U value). CLI --user-pd overrides to 1. + FASTRPC_UNSIGNED_PD=0|1 Sets PD (-U value). CLI --unsigned-pd overrides to 1. + FASTRPC_REPEAT= Number of repetitions (default: 1). + FASTRPC_TEST_TIMEOUT= Per-run timeout (default: 60). FASTRPC_EXTRA_FLAGS Extra flags appended to the command. ALLOW_BIN_FASTRPC=1 Permit using /bin/fastrpc_test (otherwise refused). + QRTR_LOOKUP_TIMEOUT= Bound optional QRTR diagnostics (default: 10). The test executes FROM the assets directory so 'fastrpc_test' can find deps. ``` @@ -73,12 +81,20 @@ The test executes FROM the assets directory so 'fastrpc_test' can find deps. ./run.sh --repeat 3 --timeout 60 ``` +To override the default bounded QRTR diagnostic window: + +```sh +QRTR_LOOKUP_TIMEOUT=20 ./run.sh --repeat 1 --timeout 60 +``` + ### Common scenarios ```bash # Default expects /usr/bin/fastrpc_test and /usr/bin/linux ./run.sh +# Effective defaults: repeat=1, per-run timeout=60s, QRTR lookup timeout=10s + Common scenarios # 1) Use a custom binary directory (we will cd there and run ./fastrpc_test) @@ -87,7 +103,7 @@ Common scenarios # 2) Opt into user/unsigned PD (-U 1) ./run.sh --user-pd # or via env -FASTRPC_USER_PD=1 ./run.sh +FASTRPC_UNSIGNED_PD=1 ./run.sh # 3) Add extra flags (kept intact; -U is appended last as '-U 0/1') FASTRPC_EXTRA_FLAGS="-d 3" ./run.sh @@ -110,7 +126,7 @@ Use ADSP and user PD: From env (CI): -FASTRPC_DOMAIN=2 FASTRPC_USER_PD=1 ./run.sh +FASTRPC_DOMAIN=2 FASTRPC_UNSIGNED_PD=1 ./run.sh # => SDSP with -U 1 ``` @@ -142,6 +158,9 @@ FASTRPC_DOMAIN=2 FASTRPC_USER_PD=1 ./run.sh - Session create errors with -U 1: If you opt into user/unsigned PD and see 0x80000416, confirm your image includes unsigned shells/policies (or revert to the default -U 0). - Per-iteration logs: `logs_fastrpc_test_/iterN.out` (+ `iterN.rc`) - Summary result file: `fastrpc_test.res` (`PASS` / `FAIL`) +- Optional QRTR evidence: `logs_fastrpc_test_/qrtr_topology.log` +- Failure-only kernel evidence: `logs_fastrpc_test_/dmesg_snapshot.log` + and `dmesg_errors.log` - Verbose mode: adds environment, resolutions, and timing details - Graceful fallbacks when `stdbuf`, `script`, or `timeout` are missing - Silent scan (no directory spam) during auto-detection diff --git a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh index d39789957..1fb120582 100755 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh @@ -51,8 +51,8 @@ if [ -f "$TOOLS/lib_pkg_provider.sh" ]; then fi # Defaults -REPEAT=1 -TIMEOUT="" +REPEAT="${FASTRPC_REPEAT:-1}" +TIMEOUT="${FASTRPC_TEST_TIMEOUT:-60}" ARCH="" BIN_DIR="" # directory that CONTAINS fastrpc_test ASSETS_DIR="" # kept for compatibility/logging (not used by new layout) @@ -62,6 +62,7 @@ CLI_DOMAIN="" CLI_DOMAIN_NAME="" DOMAIN_MODE="all-supported" # Default: test all supported domains PD_MODE="both" # Default: test both PDs where supported +QRTR_LOOKUP_TIMEOUT="${QRTR_LOOKUP_TIMEOUT:-10}" usage() { cat < Select PD mode(s) to run (default: both) --unsigned-pd Use '-U 1' (user/unsigned PD). Overrides --pd-mode for compatibility --repeat Number of repetitions (default: 1) - --timeout Timeout for each run (no timeout if omitted) + --timeout Timeout for each run (default: 60) --verbose Extra logging for CI debugging --help Show this help @@ -98,8 +99,11 @@ Env: FASTRPC_DOMAIN=0|1|2|3|4|5|6 Sets domain; CLI --domain/--domain-name wins. FASTRPC_DOMAIN_NAME=adsp|... Named domain; CLI wins. FASTRPC_UNSIGNED_PD=0|1 Sets PD (-U value). CLI --unsigned-pd overrides to 1. + FASTRPC_REPEAT= Number of repetitions (default: 1). + FASTRPC_TEST_TIMEOUT= Per-run timeout (default: 60). FASTRPC_EXTRA_FLAGS Extra flags appended (space-separated). ALLOW_BIN_FASTRPC=1 Permit using /bin/fastrpc_test when --bin-dir=/bin. + QRTR_LOOKUP_TIMEOUT= Bound optional QRTR diagnostics (default: 10). Notes: - Script *cd*s into the binary directory and launches ./fastrpc_test. @@ -184,6 +188,7 @@ log_info "---------------------------------------------------------------------- log_info "-------------------Starting $TESTNAME Testcase----------------------------" log_info "Kernel: $(uname -a 2>/dev/null || echo N/A)" log_info "Date(UTC): $(date -u 2>/dev/null || echo N/A)" +log_info "Configuration: repeat=$REPEAT execution_timeout=${TIMEOUT:-none} QRTR_LOOKUP_TIMEOUT=${QRTR_LOOKUP_TIMEOUT}s" log_soc_info SOC_MACHINE="$(tr -s ' ' < /sys/devices/soc0/machine 2>/dev/null | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" @@ -314,6 +319,8 @@ TS="$(date +%Y%m%d-%H%M%S)" LOG_ROOT="./logs_${TESTNAME}_${TS}" mkdir -p "$LOG_ROOT" || { log_error "Cannot create $LOG_ROOT"; echo "$TESTNAME : FAIL" >"$RESULT_FILE"; exit 0; } +fastrpc_capture_qrtr_evidence "$LOG_ROOT" + tmo_label="none"; [ -n "$TIMEOUT" ] && tmo_label="${TIMEOUT}s" log_info "Repeats: $REPEAT | Timeout: $tmo_label | Buffering: $buf_label" @@ -359,7 +366,6 @@ for DOMAIN in $DOMAINS_TO_TEST; do iter_rc="$LOG_ROOT/${iter_tag}.rc" iter_cmd="$LOG_ROOT/${iter_tag}.cmd" iter_env="$LOG_ROOT/${iter_tag}.env" - iter_dmesg="$LOG_ROOT/${iter_tag}.dmesg" iso_now="$(date -u +%Y-%m-%dT%H:%M:%SZ)" set -- -d "$DOMAIN" -t linux @@ -415,7 +421,6 @@ for DOMAIN in $DOMAINS_TO_TEST; do if [ "$rc" -ne 0 ]; then log_fail "$iter_tag: fastrpc_test exited $rc" - dmesg | tail -n 300 > "$iter_dmesg" 2>/dev/null log_dsp_remoteproc_status fi @@ -456,6 +461,12 @@ for DOMAIN in $DOMAINS_TO_TEST; do done done +if [ "$PASS_COUNT" -ne "$TOTAL_COUNT" ]; then + scan_dmesg_errors \ + "$LOG_ROOT" \ + 'fastrpc|remoteproc|qcom.*(adsp|cdsp|sdsp)|adsp|cdsp|sdsp' || true +fi + # -------------------- Finalize -------------------------------- # Build detailed summary table from tracked results log_info "==========================================================================" diff --git a/Runner/utils/lib_fastrpc.sh b/Runner/utils/lib_fastrpc.sh index dc4700192..c616075ba 100755 --- a/Runner/utils/lib_fastrpc.sh +++ b/Runner/utils/lib_fastrpc.sh @@ -221,6 +221,41 @@ fastrpc_setup_runtime_layout() { [ -n "${SDSP_LIBRARY_PATH:-}" ] && log_info "SDSP_LIBRARY_PATH=${SDSP_LIBRARY_PATH}" } +# fastrpc_capture_qrtr_evidence +# Capture optional QRTR service topology alongside FastRPC artifacts without +# making QRTR a prerequisite for platforms whose FastRPC transport differs. +fastrpc_capture_qrtr_evidence() { + fcqe_result_dir="${1:-}" + fcqe_topology="$fcqe_result_dir/qrtr_topology.log" + + [ -n "$fcqe_result_dir" ] || return 3 + + if ! command -v qrtr_capture_topology >/dev/null 2>&1; then + log_info "QRTR topology helper is unavailable, continuing FastRPC validation" + return 0 + fi + + log_info "FastRPC QRTR diagnostics: capturing bounded service topology timeout=${QRTR_LOOKUP_TIMEOUT:-10}s artifact=$fcqe_topology" + qrtr_capture_topology "$fcqe_topology" "${QRTR_LOOKUP_TIMEOUT:-10}" + fcqe_status=$? + + case "$fcqe_status" in + 0) + log_info "Captured QRTR service topology for FastRPC diagnostics" + log_file_with_label "qrtr-lookup" "$fcqe_topology" + ;; + 2) + log_info "QRTR runtime or qrtr-lookup is unavailable, continuing FastRPC validation" + ;; + *) + log_warn "QRTR runtime is present but its bounded topology query failed, continuing the independent FastRPC test" + log_file_with_label "qrtr-lookup" "$fcqe_topology" + ;; + esac + + return 0 +} + # -------------------- FastRPC test orchestration helpers -------------------- # shellcheck disable=SC2317