From 39b2fd90fa757a47ce7606ba1537e63a3cab28c0 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 | 14 +++++ .../Multimedia/CDSP/fastrpc_test/run.sh | 4 ++ Runner/utils/lib_fastrpc.sh | 35 ++++++++++++ 5 files changed, 119 insertions(+), 24 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 365c2ad7..59d9fe7a 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 38d49af3..3053b096 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 6045868f..6a517c3e 100644 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md @@ -7,6 +7,11 @@ offloading work to all supported DSP domains (ADSP, MDSP, SDSP, CDSP, CDSP1, GDS 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: - Uses `fastrpc-healthcheck` when available to discover online DSPs, FastRPC support, signed and unsigned PD support, firmware information, and DSP library paths. The reported DMA-BUF system @@ -97,6 +102,7 @@ Env: FASTRPC_EXTRA_FLAGS Extra flags appended (space-separated). FASTRPC_HEALTHCHECK_BIN Optional path to fastrpc-healthcheck. ALLOW_BIN_FASTRPC=1 Permit using /bin/fastrpc_test when --bin-dir=/bin. + QRTR_LOOKUP_TIMEOUT= Bound optional QRTR diagnostics (default: 10). ``` ### Quick start @@ -109,6 +115,12 @@ Env: ./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 @@ -215,6 +227,8 @@ package gap remains visible until a matching payload is provisioned. Other domai - **Per-iteration logs**: `logs_fastrpc_test_/__iter.out` (+ `.rc`, `.env`, `.cmd`) - **Kernel evidence on failure**: one shared `logs_fastrpc_test_/kernel/` snapshot is captured through `scan_dmesg_errors` after the invocation matrix. +- **Optional QRTR evidence**: `logs_fastrpc_test_/qrtr_topology.log` when QRTR and + `qrtr-lookup` are available. - **Summary result file**: `fastrpc_test.res` (`PASS` / `FAIL` / `SKIP`) - **Verbose mode**: adds environment, library resolution, and timing details diff --git a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh index d668ebce..b6f2cbd2 100755 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh @@ -59,6 +59,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 # Print the supported FastRPC test CLI, environment overrides, and selection policy. @@ -103,6 +104,7 @@ Env: FASTRPC_EXTRA_FLAGS Extra flags appended (space-separated). FASTRPC_HEALTHCHECK_BIN Optional path to fastrpc-healthcheck. 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. @@ -334,6 +336,8 @@ fi log_info "Evidence directory: $test_path/$LOG_ROOT" +fastrpc_capture_qrtr_evidence "$LOG_ROOT" + # Prepare the image-provided DSP artifacts before healthcheck records capability. # This is idempotent and remains a clean no-op when no source is available. ensure_usr_lib_dsp_symlinks diff --git a/Runner/utils/lib_fastrpc.sh b/Runner/utils/lib_fastrpc.sh index fe952939..1e09a6fa 100755 --- a/Runner/utils/lib_fastrpc.sh +++ b/Runner/utils/lib_fastrpc.sh @@ -613,6 +613,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 -------------------- # log_debug MESSAGE...