-
Notifications
You must be signed in to change notification settings - Fork 43
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,28 @@ 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 test libraries are installed | ||
| # and 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 not found (no libadsprpc/libcdsprpc/libsdsprpc)" | ||
| echo "$TESTNAME : SKIP" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ -z "${FASTRPC_RESOLVED_SKEL_PATH:-}" ]; then | ||
|
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. This gate relies on FASTRPC_RESOLVED_SKEL_PATH, which currently accepts existing v75 or v68 directories without verifying the required skeleton files. It also false-SKIPs future layouts such as a new architecture-version directory. Discover directories containing usable skeleton artifacts, or model the required skeleton variants in the domain capability metadata. Do not treat an empty version directory as a valid artifact set. |
||
| log_skip "$TESTNAME SKIP - FastRPC DSP skeleton directory not found (no v75 or v68 under base)" | ||
| echo "$TESTNAME : SKIP" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ -z "${FASTRPC_RESOLVED_LIB_TEST_DIR:-}" ]; then | ||
| log_skip "$TESTNAME SKIP - FastRPC test libraries not found (no libcalculator/libhap_example/libmultithreading)" | ||
| 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,47 +258,52 @@ 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"*) | ||
|
anankulk marked this conversation as resolved.
|
||
| 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 | ||
| # -------------------- Validate FastRPC endpoint availability -------------------- | ||
| # Skip per-domain endpoint check on QDA DRM kernels (no /dev/fastrpc-* nodes). | ||
| fastrpc_chardev_iface=0 | ||
| for _fastrpc_dev in /dev/fastrpc-*; do | ||
| [ -c "$_fastrpc_dev" ] && fastrpc_chardev_iface=1 && break | ||
| done | ||
| unset _fastrpc_dev | ||
| if [ "$fastrpc_chardev_iface" -eq 1 ]; then | ||
| log_info "FastRPC interface: character device (/dev/fastrpc-*)" | ||
| else | ||
| log_info "FastRPC interface: non-chardev (QDA DRM or similar); skipping endpoint filter" | ||
|
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 absence of every /dev/fastrpc-* node is treated as proof of a supported “QDA DRM or similar” interface, but no alternate FastRPC interface is positively detected or validated. A normal broken image with remoteproc entries but no FastRPC endpoint therefore bypasses endpoint validation and runs the full matrix. Explicit --domain selection also executes instead of producing the FAIL promised by the YAML. Add positive detection and validation for each supported non-character-device interface. If none is detected, preserve the existing policy: FAIL for an explicitly selected domain and SKIP for auto-discovered unavailable hardware. |
||
| fi | ||
|
|
||
| if [ "$soc_skip_gpdsp" -eq 1 ]; then | ||
| filtered="" | ||
| if [ "$fastrpc_chardev_iface" -eq 1 ]; then | ||
| # Explicit domain selection requires the endpoint present; auto-discovered | ||
| # missing endpoints are filtered out silently. | ||
| domain_selection_explicit=0 | ||
| { [ -n "$CLI_DOMAIN_NAME" ] || [ -n "$CLI_DOMAIN" ] || [ "$DOMAIN_MODE" = "single" ]; } \ | ||
| && domain_selection_explicit=1 | ||
|
|
||
| available_domains="" | ||
| 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 | ||
| dom_name="$(domain_to_name "$d")" | ||
| ep_label="$(domain_to_endpoint_label "$d")" | ||
| if fastrpc_domain_endpoint_available "$d"; then | ||
| available_domains="${available_domains:+$available_domains }$d" | ||
| log_debug "Endpoint available: /dev/fastrpc-${ep_label} (or -secure)" | ||
| else | ||
| log_warn "$dom_name: endpoint not present (checked /dev/fastrpc-${ep_label} and /dev/fastrpc-${ep_label}-secure); domain present in DT/remoteproc but not usable" | ||
| if [ "$domain_selection_explicit" -eq 1 ]; then | ||
| log_fail "$dom_name: explicitly selected endpoint not present (checked /dev/fastrpc-${ep_label} and /dev/fastrpc-${ep_label}-secure)" | ||
| log_dsp_remoteproc_status | ||
| echo "$TESTNAME : FAIL" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
| fi | ||
| done | ||
| DOMAINS_TO_TEST="$filtered" | ||
| fi | ||
|
|
||
| if [ -z "$DOMAINS_TO_TEST" ]; then | ||
| log_skip "$TESTNAME SKIP - no supported domains remain after SoC filter ($SOC_MACHINE)" | ||
| echo "$TESTNAME : SKIP" >"$RESULT_FILE" | ||
| exit 0 | ||
| if [ -z "$available_domains" ]; then | ||
| log_dsp_remoteproc_status | ||
| log_skip "$TESTNAME SKIP - no FastRPC endpoint devices found" | ||
| echo "$TESTNAME : SKIP" >"$RESULT_FILE" | ||
| exit 0 | ||
| fi | ||
|
|
||
| DOMAINS_TO_TEST="$available_domains" | ||
| fi | ||
|
|
||
| log_info "Domain mode: $DOMAIN_MODE" | ||
|
|
@@ -328,6 +354,16 @@ RESULTS_TRACKER="" | |
|
|
||
| for DOMAIN in $DOMAINS_TO_TEST; do | ||
| dom_name="$(domain_to_name "$DOMAIN")" | ||
|
|
||
| # Defensive re-check; the pre-filter above should have caught this. | ||
| if [ "$fastrpc_chardev_iface" -eq 1 ]; then | ||
| if ! fastrpc_domain_endpoint_available "$DOMAIN"; then | ||
| _ep="$(domain_to_endpoint_label "$DOMAIN")" | ||
| log_info "Skipping $dom_name: endpoint not present (checked /dev/fastrpc-${_ep} and /dev/fastrpc-${_ep}-secure)" | ||
| continue | ||
| fi | ||
| fi | ||
|
|
||
| PD_VALUES="$(effective_pds_for_domain "$DOMAIN")" | ||
|
|
||
| if [ -z "$PD_VALUES" ]; then | ||
|
|
@@ -433,15 +469,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,44 @@ 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 | ||
|
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. This returns success after finding any one of libadsprpc, libcdsprpc, or libsdsprpc. The suite can consequently schedule a domain whose required runtime library is missing and convert an expected missing-capability SKIP into an expensive runtime failure. Build a complete artifact inventory and validate the library requirements of every selected domain, or require the complete set if fastrpc_test always exercises all of them. Log the exact missing artifacts. |
||
| 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 known FastRPC test library (libcalculator, libhap_example, | ||
| # or libmultithreading). Matches both unversioned (.so) and versioned (.so.N) | ||
| # forms so Debian runtime-only installs are detected correctly. | ||
| fastrpc_first_dir_with_testlib() { | ||
|
anankulk marked this conversation as resolved.
|
||
| candidate_dirs="$1" | ||
| for candidate_dir in $candidate_dirs; do | ||
| [ -d "$candidate_dir" ] || continue | ||
| for lib in libcalculator libhap_example libmultithreading; do | ||
|
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 same partial-success problem exists for test libraries: finding one library allows execution even if other tests require libcalculator, libhap_example, or libmultithreading. Validate the exact library set used by the selected test mode. Return the missing names so the runner can classify the domain cleanly instead of discovering the problem after starting fastrpc_test. |
||
| 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 | ||
| } | ||
|
|
||
| fastrpc_detect_multiarch_triplet() { | ||
| triplet="" | ||
|
|
||
|
|
@@ -148,8 +186,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 +300,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 | ||
|
|
@@ -323,6 +351,30 @@ domain_to_name() { | |
| esac | ||
| } | ||
|
|
||
| # Maps a domain number to the DT binding label used by the FastRPC driver | ||
| # when naming /dev/fastrpc-<label>. GPDSP domains use the DT label gdsp0/gdsp1, | ||
| # not the presentation names gpdsp0/gpdsp1. | ||
| domain_to_endpoint_label() { | ||
|
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. This endpoint mapping introduces another independently maintained domain switch. Domain IDs and aliases are now duplicated across name_to_domain(), domain_to_name(), domain_to_endpoint_label(), discover_supported_domains(), domain validation, and domain_supported_pds(). Adding domain 7 requires coordinated edits in several places and can silently produce inconsistent capability decisions. Define one domain capability table containing ID, aliases, firmware labels, endpoint label, supported PDs, required artifacts, and interface types, then have discovery and scheduling consume that table. |
||
| case "$1" in | ||
| 0) echo "adsp" ;; | ||
| 1) echo "mdsp" ;; | ||
| 2) echo "sdsp" ;; | ||
| 3) echo "cdsp" ;; | ||
| 4) echo "cdsp1" ;; | ||
| 5) echo "gdsp0" ;; | ||
| 6) echo "gdsp1" ;; | ||
| *) echo "" ;; | ||
| esac | ||
| } | ||
|
|
||
| # Returns 0 if a usable FastRPC character device exists for the given domain. | ||
| # Checks both /dev/fastrpc-<label> and /dev/fastrpc-<label>-secure. | ||
| fastrpc_domain_endpoint_available() { | ||
| _label="$(domain_to_endpoint_label "$1")" | ||
| [ -n "$_label" ] || return 1 | ||
| [ -c "/dev/fastrpc-${_label}" ] || [ -c "/dev/fastrpc-${_label}-secure" ] | ||
| } | ||
|
|
||
| append_unique() { | ||
| current="$1" | ||
| new="$2" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.