-
Notifications
You must be signed in to change notification settings - Fork 42
fastrpc-test: Add runtime validation and remove SoC-based filtering #532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,7 +185,6 @@ 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_soc_info | ||
| SOC_MACHINE="$(tr -s ' ' < /sys/devices/soc0/machine 2>/dev/null | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" | ||
|
|
||
| # -------------------- Binary directory resolution ----------------- | ||
| if [ -n "$BIN_DIR" ]; then | ||
|
|
@@ -216,6 +215,22 @@ fi | |
| # -------------------- Runtime layout discovery -------------------- | ||
| fastrpc_setup_runtime_layout | ||
|
|
||
| # Gate on artifacts being present: a domain appearing in remoteproc/DT does not | ||
| # guarantee the FastRPC libraries, DSP skeletons, and endpoint device nodes are | ||
| # usable. Without them every invocation would fail rather than skip, which is | ||
| # the wrong signal. | ||
| if [ -z "${FASTRPC_RESOLVED_LIB_SYS_DIR:-}" ]; then | ||
| log_skip "$TESTNAME SKIP - FastRPC system library directory not found" | ||
| echo "$TESTNAME : SKIP" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ -z "${FASTRPC_RESOLVED_SKEL_PATH:-}" ]; then | ||
| log_skip "$TESTNAME SKIP - FastRPC DSP skeleton directory not found (no v75 or v68 under base)" | ||
| echo "$TESTNAME : SKIP" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
|
|
||
| log_info "Using binary: $RUN_BIN" | ||
| log_info "Run dir: $RUN_DIR (launching ./fastrpc_test)" | ||
| log_info "Binary details:" | ||
|
|
@@ -237,49 +252,41 @@ if [ -z "$DOMAINS_TO_TEST" ]; then | |
| exit 0 | ||
| fi | ||
|
|
||
| # -------------------- SoC-specific domain blacklist -------------------- | ||
| # QRB2210: FastRPC not supported - skip entire test | ||
| # QCS9075, QCS8275, QCS8300, QCS9100: GPDSP0 (domain 5) and GPDSP1 (domain 6) not supported currently | ||
| # SM8850: libhap_example HAP_mem DMA not supported - treat as known skip per invocation | ||
| # | ||
| # Do not skip Glymur CRD by SoC name. Newer Glymur/Debian images expose | ||
| # ADSP/CDSP remoteproc instances and FastRPC skeletons, so runtime discovery | ||
| # should decide whether the test can run. | ||
| soc_skip_all=0 | ||
| soc_skip_gpdsp=0 | ||
|
|
||
| case "$SOC_MACHINE" in | ||
| *QRB2210*|*"Glymur CRD"*) | ||
| soc_skip_all=1 | ||
| ;; | ||
| *QCS9075*|*QCS8275*|*QCS8300*|*QCS9100*) | ||
| soc_skip_gpdsp=1 | ||
| ;; | ||
| esac | ||
|
|
||
| if [ "$soc_skip_all" -eq 1 ]; then | ||
| log_skip "$TESTNAME SKIP - SoC $SOC_MACHINE does not support FastRPC" | ||
| echo "$TESTNAME : SKIP" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
| # -------------------- Validate FastRPC endpoint availability -------------------- | ||
| # Explicitly selected domains (--domain, --domain-name, single mode) must have | ||
| # their endpoint present; absence is a FAIL with remoteproc diagnostics. | ||
| # Auto-discovered domains without an endpoint are filtered out; if none remain | ||
| # the test SKIPs. | ||
| domain_selection_explicit=0 | ||
| { [ -n "$CLI_DOMAIN_NAME" ] || [ -n "$CLI_DOMAIN" ] || [ "$DOMAIN_MODE" = "single" ]; } \ | ||
| && domain_selection_explicit=1 | ||
|
|
||
| if [ "$soc_skip_gpdsp" -eq 1 ]; then | ||
| filtered="" | ||
| for d in $DOMAINS_TO_TEST; do | ||
| case "$d" in | ||
| 5|6) log_info "SoC $SOC_MACHINE: skipping $(domain_to_name "$d") (not supported)" ;; | ||
| *) filtered="${filtered:+$filtered }$d" ;; | ||
| esac | ||
| done | ||
| DOMAINS_TO_TEST="$filtered" | ||
| fi | ||
| available_domains="" | ||
| for d in $DOMAINS_TO_TEST; do | ||
| dom_name="$(domain_to_name "$d")" | ||
| fastrpc_dev="/dev/fastrpc-$(printf '%s' "$dom_name" | tr '[:upper:]' '[:lower:]')" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The FastRPC DT binding labels these domains gdsp0 and gdsp1, and the driver creates /dev/fastrpc-. As a result, valid GPDSP domains will be excluded from auto-discovery, while explicit --domain 5/6 runs fail before execution. domain_to_name 5/6 returns the presentation names GPDSP0/GPDSP1, but the FastRPC endpoint is named from the DT label, which is gdsp0/gdsp1. This check therefore probes /dev/fastrpc-gpdsp0 and filters valid GPDSP endpoints. Please add a separate domain-to-endpoint-label helper, mapping 5/6 to gdsp0/gdsp1, and use it for both endpoint checks. |
||
| if [ -c "$fastrpc_dev" ]; then | ||
| available_domains="${available_domains:+$available_domains }$d" | ||
| log_debug "Endpoint available: $fastrpc_dev" | ||
| else | ||
| log_debug "Endpoint not available: $fastrpc_dev" | ||
| if [ "$domain_selection_explicit" -eq 1 ]; then | ||
| log_fail "$dom_name: explicitly selected endpoint $fastrpc_dev not present" | ||
| log_dsp_remoteproc_status | ||
| echo "$TESTNAME : FAIL" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
| fi | ||
| done | ||
|
|
||
| if [ -z "$DOMAINS_TO_TEST" ]; then | ||
| log_skip "$TESTNAME SKIP - no supported domains remain after SoC filter ($SOC_MACHINE)" | ||
| if [ -z "$available_domains" ]; then | ||
|
anankulk marked this conversation as resolved.
|
||
| log_skip "$TESTNAME SKIP - no FastRPC endpoint devices found" | ||
| echo "$TESTNAME : SKIP" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
|
|
||
| DOMAINS_TO_TEST="$available_domains" | ||
|
|
||
| log_info "Domain mode: $DOMAIN_MODE" | ||
| log_info "Domains to test: $DOMAINS_TO_TEST" | ||
|
|
||
|
|
@@ -328,6 +335,15 @@ RESULTS_TRACKER="" | |
|
|
||
| for DOMAIN in $DOMAINS_TO_TEST; do | ||
| dom_name="$(domain_to_name "$DOMAIN")" | ||
|
|
||
| # Check that the FastRPC endpoint device node for this domain exists. | ||
| # remoteproc/DT presence does not guarantee the driver has created the node. | ||
| fastrpc_dev="/dev/fastrpc-$(printf '%s' "$dom_name" | tr '[:upper:]' '[:lower:]')" | ||
| if [ ! -c "$fastrpc_dev" ]; then | ||
| log_info "Skipping $dom_name: endpoint $fastrpc_dev not present" | ||
| continue | ||
| fi | ||
|
|
||
| PD_VALUES="$(effective_pds_for_domain "$DOMAIN")" | ||
|
|
||
| if [ -z "$PD_VALUES" ]; then | ||
|
|
@@ -433,15 +449,10 @@ for DOMAIN in $DOMAINS_TO_TEST; do | |
| fi | ||
|
|
||
| # Track invocation result immediately | ||
| # SM8850: libhap_example HAP_mem DMA handle not supported - treat as known skip | ||
| if [ "$rc" -eq 0 ] && [ -r "$iter_log" ] && grep -F -q -e "All tests completed successfully" -e "All applicable tests PASSED" "$iter_log"; then | ||
| PASS_COUNT=$((PASS_COUNT+1)) | ||
| combo_pass=$((combo_pass+1)) | ||
| log_pass "$iter_tag: success" | ||
| elif case "$SOC_MACHINE" in *SM8850*) true ;; *) false ;; esac && only_hap_example_failed "$iter_log"; then | ||
| PASS_COUNT=$((PASS_COUNT+1)) | ||
| combo_pass=$((combo_pass+1)) | ||
| log_pass "$iter_tag: success (libhap_example.so HAP_mem skipped on $SOC_MACHINE - DMA handle not supported)" | ||
| else | ||
| combo_fail=$((combo_fail+1)) | ||
| log_warn "$iter_tag: success pattern not found" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,41 @@ fastrpc_first_existing_word_dir() { | |
| return 1 | ||
| } | ||
|
|
||
| # Returns the first directory in the space-separated candidate_dirs list that | ||
| # contains at least one FastRPC system library (libadsprpc, libcdsprpc, or | ||
| # libsdsprpc). Generic directories like /usr/lib that exist without FastRPC | ||
| # installed are skipped. | ||
| fastrpc_first_dir_with_fastrpc_syslib() { | ||
| candidate_dirs="$1" | ||
| for candidate_dir in $candidate_dirs; do | ||
| [ -d "$candidate_dir" ] || continue | ||
| for lib in libadsprpc libcdsprpc libsdsprpc; do | ||
| if find "$candidate_dir" -maxdepth 1 -name "${lib}.so*" 2>/dev/null \ | ||
| | grep -qm1 .; then | ||
| printf '%s\n' "$candidate_dir" | ||
| return 0 | ||
| fi | ||
| done | ||
| done | ||
| return 1 | ||
| } | ||
|
|
||
| # Returns the first directory in the space-separated candidate_dirs list that | ||
| # contains at least one shared library (*.so or *.so.*). Avoids accepting | ||
| # generic directories that exist without any test artifacts installed. | ||
| fastrpc_first_dir_with_testlib() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. accepts any *.so in a candidate directory. The generic fallback /usr/lib almost always contains shared libraries, so the helper can report a “FastRPC test library dir” even when no FastRPC test artifact is present. search for the expected FastRPC test libraries, or do not present this as validation. |
||
| candidate_dirs="$1" | ||
| for candidate_dir in $candidate_dirs; do | ||
| [ -d "$candidate_dir" ] || continue | ||
| if find "$candidate_dir" -maxdepth 1 \( -name "*.so" -o -name "*.so.*" \) \ | ||
| 2>/dev/null | grep -qm1 .; then | ||
| printf '%s\n' "$candidate_dir" | ||
| return 0 | ||
| fi | ||
| done | ||
| return 1 | ||
| } | ||
|
|
||
| fastrpc_detect_multiarch_triplet() { | ||
| triplet="" | ||
|
|
||
|
|
@@ -148,8 +183,8 @@ fastrpc_discover_runtime_layout() { | |
| FASTRPC_LIB_TEST_DIRS_CHECKED="$(fastrpc_append_word_unique "$FASTRPC_LIB_TEST_DIRS_CHECKED" "/usr/lib/fastrpc_test")" | ||
| FASTRPC_SKEL_BASES_CHECKED="$(fastrpc_append_word_unique "$FASTRPC_SKEL_BASES_CHECKED" "/usr/share/fastrpc_test")" | ||
|
|
||
| FASTRPC_RESOLVED_LIB_SYS_DIR="$(fastrpc_first_existing_word_dir "$FASTRPC_LIB_SYS_DIRS_CHECKED" || true)" | ||
| FASTRPC_RESOLVED_LIB_TEST_DIR="$(fastrpc_first_existing_word_dir "$FASTRPC_LIB_TEST_DIRS_CHECKED" || true)" | ||
| FASTRPC_RESOLVED_LIB_SYS_DIR="$(fastrpc_first_dir_with_fastrpc_syslib "$FASTRPC_LIB_SYS_DIRS_CHECKED" || true)" | ||
| FASTRPC_RESOLVED_LIB_TEST_DIR="$(fastrpc_first_dir_with_testlib "$FASTRPC_LIB_TEST_DIRS_CHECKED" || true)" | ||
| FASTRPC_RESOLVED_SKEL_BASE="$(fastrpc_first_existing_word_dir "$FASTRPC_SKEL_BASES_CHECKED" || true)" | ||
|
|
||
| FASTRPC_RESOLVED_SKEL_PATH="" | ||
|
|
@@ -262,16 +297,6 @@ extract_test_summary_counts() { | |
| printf '%s:%s:%s:%s\n' "$total" "$passed" "$failed" "$skipped" | ||
| } | ||
|
|
||
| # Returns true if the only failing subtest is libhap_example.so. | ||
| # Used to treat HAP_mem DMA failures as known-skip on affected SoCs. | ||
| only_hap_example_failed() { | ||
| log_file="$1" | ||
|
|
||
| [ -r "$log_file" ] || return 1 | ||
| grep -F -q "[FAIL]" "$log_file" || return 1 | ||
| ! grep -F "[FAIL]" "$log_file" | grep -q -v "libhap_example.so" | ||
| } | ||
|
|
||
| log_dsp_remoteproc_status() { | ||
| fw_list="adsp mdsp sdsp cdsp cdsp0 cdsp1 gdsp0 gdsp1 gpdsp0 gpdsp1" | ||
| any=0 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QRB2210 and Glymur now reach generic discovery, but discover_supported_domains() checks remoteproc/DT presence—not whether the corresponding FastRPC endpoint, libraries, and skeletons are usable. Runtime-layout discovery merely warns when artifacts are absent.