diff --git a/.github/workflows/qcom-preflight-checks.yml b/.github/workflows/qcom-preflight-checks.yml index d070f0a1..9fd343c0 100644 --- a/.github/workflows/qcom-preflight-checks.yml +++ b/.github/workflows/qcom-preflight-checks.yml @@ -11,14 +11,13 @@ permissions: security-events: write jobs: - qcom-preflight-checks: - uses: qualcomm/qcom-reusable-workflows/.github/workflows/qcom-preflight-checks-reusable-workflow.yml@v1.1.4 + preflight: + name: Run QC Preflight Checks + uses: qualcomm/qcom-reusable-workflows/.github/workflows/reusable-qcom-preflight-checks-orchestrator.yml@v2 with: - # βœ… Preflight Checkers - repolinter: true # default: true - semgrep: true # default: true - copyright-license-detector: true # default: true - pr-check-emails: true # default: true - dependency-review: true # default: true - secrets: - SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} + enable-semgrep-scan: true + enable-dependency-review: true + enable-repolinter-check: true + enable-copyright-license-check: true + enable-commit-email-check: true + enable-commit-msg-check: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 60ed027b..af684eb0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,5 @@ # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # πŸ› οΈ Contributing to qcom-linux-testkit Thank you for considering contributing to the **qcom-linux-testkit** project! Your contributions help improve the quality and functionality of our test suite. Please follow the guidelines below to ensure a smooth contribution process. @@ -78,8 +77,7 @@ Runner/ ```sh #!/bin/sh -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause #Source init_env and functestlib.sh SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" @@ -160,8 +158,7 @@ Ensure that all new files include the appropriate license header: ```sh #!/bin/sh -# SPDX-License-Identifier: BSD-3-Clause-Clear -``` +# SPDX-License-Identifier: BSD-3-Clause``` --- diff --git a/LICENSE b/LICENSE index b01fe3f3..d1b96d88 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,3 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear +SPDX-License-Identifier: BSD-3-Clause \ No newline at end of file diff --git a/README.md b/README.md index 20bf5e24..a84fd828 100644 --- a/README.md +++ b/README.md @@ -111,5 +111,4 @@ These tests can be used as CI jobs in: ``` Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear -``` +SPDX-License-Identifier: BSD-3-Clause``` diff --git a/Runner/init_env b/Runner/init_env index b49a59a4..c4d64bbf 100755 --- a/Runner/init_env +++ b/Runner/init_env @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Idempotency guard: only initialize ONCE per shell session [ -n "$__INIT_ENV_LOADED" ] && return __INIT_ENV_LOADED=1 diff --git a/Runner/run-test.sh b/Runner/run-test.sh index f675fd3f..80503dfe 100755 --- a/Runner/run-test.sh +++ b/Runner/run-test.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Resolve the real path of this script SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" diff --git a/Runner/suites/Connectivity/Bluetooth/BT_FW_KMD_Service/run.sh b/Runner/suites/Connectivity/Bluetooth/BT_FW_KMD_Service/run.sh index 23758583..4d7f6eaf 100755 --- a/Runner/suites/Connectivity/Bluetooth/BT_FW_KMD_Service/run.sh +++ b/Runner/suites/Connectivity/Bluetooth/BT_FW_KMD_Service/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # BT_FW_KMD_Service - Bluetooth FW + KMD + service + controller infra validation # Non-expect version, using lib_bluetooth.sh helpers. @@ -210,7 +209,18 @@ else fi log_info "=== bluetoothctl list (controllers) ===" -bluetoothctl list 2>/dev/null || true + +out="$(bluetoothctl list 2>/dev/null | sanitize_bt_output || true)" +if printf '%s\n' "$out" | grep -qi '^[[:space:]]*Controller[[:space:]]'; then + # Non-interactive worked print what we got + printf '%s\n' "$out" +else + # Non-interactive printed no controllers β†’ retry using interactive method + log_warn "bluetoothctl list returned no controllers in non-interactive mode, retrying interactive list." + + log_info "=== bluetoothctl list (controllers) ===" + btctl_script "list" "quit" | sanitize_bt_output || true +fi log_info "=== lsmod (subset: BT stack) ===" lsmod 2>/dev/null | grep -E '^(bluetooth|hci_uart|btqca|btbcm|rfkill|cfg80211)\b' || true diff --git a/Runner/suites/Connectivity/Bluetooth/BT_ON_OFF/run.sh b/Runner/suites/Connectivity/Bluetooth/BT_ON_OFF/run.sh index ae62a1c9..daac39aa 100755 --- a/Runner/suites/Connectivity/Bluetooth/BT_ON_OFF/run.sh +++ b/Runner/suites/Connectivity/Bluetooth/BT_ON_OFF/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# BT_ON_OFF - Basic Bluetooth power toggle validation (non-expect version) +# SPDX-License-Identifier: BSD-3-Clause# BT_ON_OFF - Basic Bluetooth power toggle validation (non-expect version) # Robustly find and source init_env SCRIPT_DIR="$( @@ -103,7 +102,7 @@ elif findhcisysfs >/dev/null 2>&1; then else ADAPTER="" fi - + if [ -n "$ADAPTER" ]; then log_info "Using adapter: $ADAPTER" else @@ -112,8 +111,13 @@ else exit 0 fi +# --- NEW: warn/diag if non-interactive "bluetoothctl list" is empty (non-fatal) --- +btwarniflistempty "$ADAPTER" || true + # Ensure controller is visible to bluetoothctl (try public-addr if needed) if ! bt_ensure_controller_visible "$ADAPTER"; then + # --- NEW: print diagnostics before skipping --- + btloghcidiag "$ADAPTER" log_warn "SKIP β€” no controller visible to bluetoothctl (HCI RAW/DOWN or attach incomplete)." echo "$TESTNAME SKIP" > "$res_file" exit 0 @@ -155,6 +159,9 @@ after_on="$(btgetpower "$ADAPTER" 2>/dev/null || true)" [ -z "$after_on" ] && after_on="unknown" if [ "$after_on" = "yes" ]; then + # --- NEW: post-check (covers your "list is empty after run" symptom) --- + btwarniflistempty "$ADAPTER" || true + log_pass "Post-ON verification: Powered=yes (as expected)." echo "$TESTNAME PASS" > "$res_file" exit 0 diff --git a/Runner/suites/Connectivity/Bluetooth/BT_SCAN/run.sh b/Runner/suites/Connectivity/Bluetooth/BT_SCAN/run.sh index b0f4ab72..45aaa0de 100755 --- a/Runner/suites/Connectivity/Bluetooth/BT_SCAN/run.sh +++ b/Runner/suites/Connectivity/Bluetooth/BT_SCAN/run.sh @@ -1,7 +1,8 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear +# SPDX-License-Identifier: BSD-3-Clause# # BT_SCAN – Bluetooth scanning validation (non-expect version) + # ---------- Repo env + helpers ---------- SCRIPT_DIR="$( cd "$(dirname "$0")" || exit 1 @@ -69,9 +70,12 @@ rm -f "$res_file" log_info "------------------------------------------------------------" log_info "Starting $TESTNAME Testcase" -log_info "Checking dependency: bluetoothctl" +log_info "Checking dependencies: bluetoothctl pgrep" -check_dependencies bluetoothctl pgrep +if ! check_dependencies bluetoothctl pgrep; then + echo "$TESTNAME SKIP" > "$res_file" + exit 0 +fi # ----------------------------- # 1. Ensure bluetoothd is running @@ -168,10 +172,12 @@ log_info "Discovering state after scan ON window: $dstate_on" # ----------------------------- # 7. Get devices list after scan ON +# - Try non-interactive bluetoothctl first +# - If empty/flaky, fallback to btctl_script "devices" "quit" # ----------------------------- devices_out="$( - bluetoothctl devices 2>/dev/null \ - | sanitize_bt_output + bt_list_devices_raw 2>/dev/null \ + | grep '^Device ' || true )" if [ -n "$TARGET_MAC" ]; then @@ -205,31 +211,17 @@ fi # ----------------------------- log_info "Testing scan OFF..." if ! bt_set_scan off "$ADAPTER"; then - log_warn "bt_set_scan(off) returned non-zero continuing with Discovering check." + # bt_set_scan(off) can be flaky on minimal images; rely on poll helper + log_warn "bt_set_scan(off) returned non-zero; continuing with scan-off polling." fi -SCAN_OFF_OK=0 -ITER=10 -i=1 -while [ "$i" -le "$ITER" ]; do - dstate_off="$(bt_get_discovering 2>/dev/null || true)" - [ -z "$dstate_off" ] && dstate_off="unknown" - - log_info "Discovering state during scan OFF wait (iteration $i/$ITER): $dstate_off" - - if [ "$dstate_off" = "no" ]; then - SCAN_OFF_OK=1 - break - fi - - sleep 2 - i=$((i + 1)) -done - -if [ "$SCAN_OFF_OK" -eq 1 ]; then - log_pass "Discovering=no observed after scan OFF polling." +# Use lib helper to avoid repetitive log spam and handle 'unknown' cleanly. +if bt_scan_poll_off 10 1; then + # On minimal/ramdisk images bt_scan_poll_off may treat persistent 'unknown' as non-fatal. + log_pass "Scan OFF cleanup completed." else - log_warn "Discovering did not transition to 'no' after scan OFF window." + # If you keep bt_scan_poll_off strict, this may still warn; not a test failure. + log_warn "Scan OFF cleanup did not confirm Discovering=no (non-fatal)." fi echo "$TESTNAME PASS" > "$res_file" diff --git a/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR/BT_SCAN_PAIR_README.md b/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR/BT_SCAN_PAIR_README.md index b9cbffa5..2af63bb2 100644 --- a/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR/BT_SCAN_PAIR_README.md +++ b/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR/BT_SCAN_PAIR_README.md @@ -121,5 +121,4 @@ When a whitelist is specified (CLI or `BT_WHITELIST_ENV`), only devices whose MA ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -Β© Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-ClauseΒ© Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR/run.sh b/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR/run.sh index 3093e62c..0b1cc7f9 100755 --- a/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR/run.sh +++ b/Runner/suites/Connectivity/Bluetooth/BT_SCAN_PAIR/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Connectivity/Ethernet/README.md b/Runner/suites/Connectivity/Ethernet/README.md index af3a4345..0bb19cc0 100644 --- a/Runner/suites/Connectivity/Ethernet/README.md +++ b/Runner/suites/Connectivity/Ethernet/README.md @@ -1,6 +1,5 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause # Ethernet Validation Test ## Overview diff --git a/Runner/suites/Connectivity/Ethernet/run.sh b/Runner/suites/Connectivity/Ethernet/run.sh index 6e25d557..b34db7b0 100755 --- a/Runner/suites/Connectivity/Ethernet/run.sh +++ b/Runner/suites/Connectivity/Ethernet/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Connectivity/WiFi/WiFi_Dynamic_IP/README_WiFi_Connectivity.md b/Runner/suites/Connectivity/WiFi/WiFi_Dynamic_IP/README_WiFi_Connectivity.md index 96c53a5b..7b84cd89 100644 --- a/Runner/suites/Connectivity/WiFi/WiFi_Dynamic_IP/README_WiFi_Connectivity.md +++ b/Runner/suites/Connectivity/WiFi/WiFi_Dynamic_IP/README_WiFi_Connectivity.md @@ -1,6 +1,5 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause # WiFi Connectivity Validation ## πŸ“‹ Overview diff --git a/Runner/suites/Connectivity/WiFi/WiFi_Dynamic_IP/run.sh b/Runner/suites/Connectivity/WiFi/WiFi_Dynamic_IP/run.sh index ddafbc4f..c08b54b8 100755 --- a/Runner/suites/Connectivity/WiFi/WiFi_Dynamic_IP/run.sh +++ b/Runner/suites/Connectivity/WiFi/WiFi_Dynamic_IP/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Connectivity/WiFi/WiFi_Firmware_Driver/run.sh b/Runner/suites/Connectivity/WiFi/WiFi_Firmware_Driver/run.sh index 06c69a0c..720db3e7 100755 --- a/Runner/suites/Connectivity/WiFi/WiFi_Firmware_Driver/run.sh +++ b/Runner/suites/Connectivity/WiFi/WiFi_Firmware_Driver/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Connectivity/WiFi/WiFi_Manual_IP/run.sh b/Runner/suites/Connectivity/WiFi/WiFi_Manual_IP/run.sh index b8f3484f..f4c58dc8 100755 --- a/Runner/suites/Connectivity/WiFi/WiFi_Manual_IP/run.sh +++ b/Runner/suites/Connectivity/WiFi/WiFi_Manual_IP/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Connectivity/WiFi/WiFi_OnOff/run.sh b/Runner/suites/Connectivity/WiFi/WiFi_OnOff/run.sh index 84110348..335312b4 100755 --- a/Runner/suites/Connectivity/WiFi/WiFi_OnOff/run.sh +++ b/Runner/suites/Connectivity/WiFi/WiFi_OnOff/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/BWMON/run.sh b/Runner/suites/Kernel/Baseport/BWMON/run.sh index 7b52c58a..f0b77e13 100755 --- a/Runner/suites/Kernel/Baseport/BWMON/run.sh +++ b/Runner/suites/Kernel/Baseport/BWMON/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/Buses/run.sh b/Runner/suites/Kernel/Baseport/Buses/run.sh index e2bb8f0d..bb810093 100755 --- a/Runner/suites/Kernel/Baseport/Buses/run.sh +++ b/Runner/suites/Kernel/Baseport/Buses/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Robustly find and source init_env +# SPDX-License-Identifier: BSD-3-Clause# Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" SEARCH="$SCRIPT_DIR" diff --git a/Runner/suites/Kernel/Baseport/CPUFreq_Validation/README_CPUFreq_Validation.md b/Runner/suites/Kernel/Baseport/CPUFreq_Validation/README_CPUFreq_Validation.md index 82aec8ae..01a39be3 100644 --- a/Runner/suites/Kernel/Baseport/CPUFreq_Validation/README_CPUFreq_Validation.md +++ b/Runner/suites/Kernel/Baseport/CPUFreq_Validation/README_CPUFreq_Validation.md @@ -67,6 +67,5 @@ Runner/suites/Kernel/FunctionalArea/baseport/CPUFreq_Validation/run.sh ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -(c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause(c) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Kernel/Baseport/CPUFreq_Validation/run.sh b/Runner/suites/Kernel/Baseport/CPUFreq_Validation/run.sh index 270aa108..03ea2754 100755 --- a/Runner/suites/Kernel/Baseport/CPUFreq_Validation/run.sh +++ b/Runner/suites/Kernel/Baseport/CPUFreq_Validation/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/GIC/run.sh b/Runner/suites/Kernel/Baseport/GIC/run.sh index edccadd9..56fb4074 100755 --- a/Runner/suites/Kernel/Baseport/GIC/run.sh +++ b/Runner/suites/Kernel/Baseport/GIC/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/IPA/run.sh b/Runner/suites/Kernel/Baseport/IPA/run.sh index d4d2634b..a7764125 100755 --- a/Runner/suites/Kernel/Baseport/IPA/run.sh +++ b/Runner/suites/Kernel/Baseport/IPA/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Test for IPA driver: skip if CONFIG_QCOM_IPA not enabled, then # builtin vs module, verify /dev/ipa, functional sysfs & dmesg checks. diff --git a/Runner/suites/Kernel/Baseport/IPCC/run.sh b/Runner/suites/Kernel/Baseport/IPCC/run.sh index 36bcf00c..3edd8643 100755 --- a/Runner/suites/Kernel/Baseport/IPCC/run.sh +++ b/Runner/suites/Kernel/Baseport/IPCC/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/Interrupts/run.sh b/Runner/suites/Kernel/Baseport/Interrupts/run.sh index 4e7cf1bd..936c7e18 100755 --- a/Runner/suites/Kernel/Baseport/Interrupts/run.sh +++ b/Runner/suites/Kernel/Baseport/Interrupts/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/Kernel_Selftests/README.md b/Runner/suites/Kernel/Baseport/Kernel_Selftests/README.md index b92c6235..14e31bb7 100644 --- a/Runner/suites/Kernel/Baseport/Kernel_Selftests/README.md +++ b/Runner/suites/Kernel/Baseport/Kernel_Selftests/README.md @@ -90,5 +90,4 @@ or from a higher-level testkit runner: ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-ClauseCopyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Kernel/Baseport/Kernel_Selftests/run.sh b/Runner/suites/Kernel/Baseport/Kernel_Selftests/run.sh index 688a4648..559adf3a 100755 --- a/Runner/suites/Kernel/Baseport/Kernel_Selftests/run.sh +++ b/Runner/suites/Kernel/Baseport/Kernel_Selftests/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/MEMLAT/run.sh b/Runner/suites/Kernel/Baseport/MEMLAT/run.sh index 727fa445..58e4c25d 100755 --- a/Runner/suites/Kernel/Baseport/MEMLAT/run.sh +++ b/Runner/suites/Kernel/Baseport/MEMLAT/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/PCIe/README.md b/Runner/suites/Kernel/Baseport/PCIe/README.md index ebb974a4..437316d9 100644 --- a/Runner/suites/Kernel/Baseport/PCIe/README.md +++ b/Runner/suites/Kernel/Baseport/PCIe/README.md @@ -1,7 +1,6 @@ # PCIe Validation Test Β© Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear -## Overview +SPDX-License-Identifier: BSD-3-Clause## Overview This test case validates the PCIe interface on the target device by checking for the presence of key PCIe attributes using the `lspci -vvv` command. It ensures that the PCIe subsystem is correctly enumerated and functional ### The test checks for: - Presence of **Device Tree Node** diff --git a/Runner/suites/Kernel/Baseport/PCIe/run.sh b/Runner/suites/Kernel/Baseport/PCIe/run.sh index 629d9f26..19585c72 100755 --- a/Runner/suites/Kernel/Baseport/PCIe/run.sh +++ b/Runner/suites/Kernel/Baseport/PCIe/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/Probe_Failure_Check/Probe_Failure_Check_README.md b/Runner/suites/Kernel/Baseport/Probe_Failure_Check/Probe_Failure_Check_README.md index d0b9d8be..afaa1151 100644 --- a/Runner/suites/Kernel/Baseport/Probe_Failure_Check/Probe_Failure_Check_README.md +++ b/Runner/suites/Kernel/Baseport/Probe_Failure_Check/Probe_Failure_Check_README.md @@ -55,4 +55,4 @@ The script is tested with `shellcheck` and disables SC2039 and SC1091 where sour ## License Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear +SPDX-License-Identifier: BSD-3-Clause \ No newline at end of file diff --git a/Runner/suites/Kernel/Baseport/Probe_Failure_Check/run.sh b/Runner/suites/Kernel/Baseport/Probe_Failure_Check/run.sh index 83ad42cd..5339f7b3 100755 --- a/Runner/suites/Kernel/Baseport/Probe_Failure_Check/run.sh +++ b/Runner/suites/Kernel/Baseport/Probe_Failure_Check/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Probe failure / deferred probe detector using kernel logs + devices_deferred +# SPDX-License-Identifier: BSD-3-Clause# Probe failure / deferred probe detector using kernel logs + devices_deferred # ---------- Repo env + helpers ---------- SCRIPT_DIR="$( diff --git a/Runner/suites/Kernel/Baseport/RMNET/run.sh b/Runner/suites/Kernel/Baseport/RMNET/run.sh index 3d9a413a..40ed2a0d 100755 --- a/Runner/suites/Kernel/Baseport/RMNET/run.sh +++ b/Runner/suites/Kernel/Baseport/RMNET/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Test for RMNET driver: skip if CONFIG_RMNET not enabled, then # builtin vs module, verify /dev/rmnet, functional sysfs & dmesg checks. diff --git a/Runner/suites/Kernel/Baseport/Reboot_health_check/run.sh b/Runner/suites/Kernel/Baseport/Reboot_health_check/run.sh index c0ac1fdc..031908e6 100755 --- a/Runner/suites/Kernel/Baseport/Reboot_health_check/run.sh +++ b/Runner/suites/Kernel/Baseport/Reboot_health_check/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/Reboot_health_check/setup_systemd.sh b/Runner/suites/Kernel/Baseport/Reboot_health_check/setup_systemd.sh index 7dba05da..65254350 100755 --- a/Runner/suites/Kernel/Baseport/Reboot_health_check/setup_systemd.sh +++ b/Runner/suites/Kernel/Baseport/Reboot_health_check/setup_systemd.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Import test suite definitions set -x chmod 777 -R /var/common/* diff --git a/Runner/suites/Kernel/Baseport/Storage/UFS_Validation/run.sh b/Runner/suites/Kernel/Baseport/Storage/UFS_Validation/run.sh index 168c5f68..9065271d 100755 --- a/Runner/suites/Kernel/Baseport/Storage/UFS_Validation/run.sh +++ b/Runner/suites/Kernel/Baseport/Storage/UFS_Validation/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/Storage/eMMC_Validation/run.sh b/Runner/suites/Kernel/Baseport/Storage/eMMC_Validation/run.sh index 8e4942c9..0ef729e9 100755 --- a/Runner/suites/Kernel/Baseport/Storage/eMMC_Validation/run.sh +++ b/Runner/suites/Kernel/Baseport/Storage/eMMC_Validation/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/Timer/run.sh b/Runner/suites/Kernel/Baseport/Timer/run.sh index 3e0e6712..7b67b9f7 100755 --- a/Runner/suites/Kernel/Baseport/Timer/run.sh +++ b/Runner/suites/Kernel/Baseport/Timer/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/USBHost/README.md b/Runner/suites/Kernel/Baseport/USBHost/README.md index aa5937d7..44ebf170 100644 --- a/Runner/suites/Kernel/Baseport/USBHost/README.md +++ b/Runner/suites/Kernel/Baseport/USBHost/README.md @@ -1,7 +1,6 @@ ``` Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear -``` +SPDX-License-Identifier: BSD-3-Clause``` # USB Host Mode Validation @@ -23,5 +22,4 @@ This shell script executes on the DUT (Device-Under-Test) and verifies enumerati ``` Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear -``` +SPDX-License-Identifier: BSD-3-Clause``` diff --git a/Runner/suites/Kernel/Baseport/USBHost/run.sh b/Runner/suites/Kernel/Baseport/USBHost/run.sh index 45b037e4..50d7ee3e 100755 --- a/Runner/suites/Kernel/Baseport/USBHost/run.sh +++ b/Runner/suites/Kernel/Baseport/USBHost/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause #Setup requires at least one USB peripheral connected to USB port that supports Host mode function # Robustly find and source init_env diff --git a/Runner/suites/Kernel/Baseport/UserDataEncryption/README_UserDataEncryption.md b/Runner/suites/Kernel/Baseport/UserDataEncryption/README_UserDataEncryption.md index beee26a7..22ebce2a 100644 --- a/Runner/suites/Kernel/Baseport/UserDataEncryption/README_UserDataEncryption.md +++ b/Runner/suites/Kernel/Baseport/UserDataEncryption/README_UserDataEncryption.md @@ -1,6 +1,5 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause # Qualcomm UserDataEncryption Functionality Test Script ## Overview diff --git a/Runner/suites/Kernel/Baseport/UserDataEncryption/run.sh b/Runner/suites/Kernel/Baseport/UserDataEncryption/run.sh index ada2785a..428c5baf 100755 --- a/Runner/suites/Kernel/Baseport/UserDataEncryption/run.sh +++ b/Runner/suites/Kernel/Baseport/UserDataEncryption/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Robustly find and source init_env +# SPDX-License-Identifier: BSD-3-Clause# Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" SEARCH="$SCRIPT_DIR" diff --git a/Runner/suites/Kernel/Baseport/adsp_remoteproc/run.sh b/Runner/suites/Kernel/Baseport/adsp_remoteproc/run.sh index 75daac39..833b675c 100755 --- a/Runner/suites/Kernel/Baseport/adsp_remoteproc/run.sh +++ b/Runner/suites/Kernel/Baseport/adsp_remoteproc/run.sh @@ -1,8 +1,10 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear +# SPDX-License-Identifier: BSD-3-Clause + # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + INIT_ENV="" SEARCH="$SCRIPT_DIR" while [ "$SEARCH" != "/" ]; do @@ -23,6 +25,7 @@ if [ -z "$__INIT_ENV_LOADED" ]; then # shellcheck disable=SC1090 . "$INIT_ENV" fi + # Always source functestlib.sh, using $TOOLS exported by init_env # shellcheck disable=SC1090,SC1091 . "$TOOLS/functestlib.sh" @@ -45,7 +48,80 @@ POLL_I="${POLL_I:-1}" # state poll interval (s) PRE_STOP_DELAY="${PRE_STOP_DELAY:-30}" # FIXED delay before stopping ADSP (seconds) FATAL_ON_UNSUSPENDED="${FATAL_ON_UNSUSPENDED:-0}" # 1 = abort if audio not suspended/unsupported after delay +# --- CLI ---------------------------------------------------------------------- +# Default: do NOT do SSR (stop/start). Enable explicitly with --ssr +DO_SSR=0 + +usage() { + echo "Usage: $0 [--ssr] [--pre-stop-delay SEC] [--fatal-on-unsuspended] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2 + echo " --ssr Perform ADSP stop/start (SSR). Default: OFF" >&2 + echo " --pre-stop-delay SEC Delay before stop when --ssr is used (default: $PRE_STOP_DELAY)" >&2 + echo " --fatal-on-unsuspended Abort if audio not suspended/unsupported after delay (only meaningful with --ssr)" >&2 + echo " --stop-to SEC Stop timeout (default: $STOP_TO)" >&2 + echo " --start-to SEC Start timeout (default: $START_TO)" >&2 + echo " --poll-i SEC Poll interval (default: $POLL_I)" >&2 +} + +while [ $# -gt 0 ]; do + case "$1" in + --ssr) + DO_SSR=1 + shift + ;; + --pre-stop-delay) + if [ $# -lt 2 ]; then + log_fail "Missing value for --pre-stop-delay" + usage + exit 2 + fi + PRE_STOP_DELAY="$2" + shift 2 + ;; + --fatal-on-unsuspended) + FATAL_ON_UNSUSPENDED=1 + shift + ;; + --stop-to) + if [ $# -lt 2 ]; then + log_fail "Missing value for --stop-to" + usage + exit 2 + fi + STOP_TO="$2" + shift 2 + ;; + --start-to) + if [ $# -lt 2 ]; then + log_fail "Missing value for --start-to" + usage + exit 2 + fi + START_TO="$2" + shift 2 + ;; + --poll-i) + if [ $# -lt 2 ]; then + log_fail "Missing value for --poll-i" + usage + exit 2 + fi + POLL_I="$2" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + log_warn "Unknown argument: $1" + usage + exit 2 + ;; + esac +done + log_info "Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I PRE_STOP_DELAY=$PRE_STOP_DELAY FATAL_ON_UNSUSPENDED=$FATAL_ON_UNSUSPENDED" +log_info "SSR control: DO_SSR=$DO_SSR (0=no stop/start, 1=do stop/start)" # --- Audio readiness snapshot (no hardcoding, no long wait) ------------------- # Discovers a bound snd*/snd-soc* driver, logs module once, collects nodes to check. @@ -59,7 +135,6 @@ discover_audio_stack_and_snapshot() { platform_drv="" platform_mod="" - for drvdir in "$DRIVERS_BASE"/snd-* "$DRIVERS_BASE"/snd-soc-*; do [ -d "$drvdir" ] || continue [ -L "$drvdir/sound" ] || continue @@ -92,17 +167,16 @@ discover_audio_stack_and_snapshot() { fi log_info "Using bound audio driver: $platform_drv${platform_mod:+ (module: $platform_mod)}" - TARGET_PATH="$DRIVERS_BASE/$platform_drv/sound" # 1) Platform sound root + immediate children (collect runtime_status files) if [ -d "$TARGET_PATH" ]; then _rt_nodes_list="$(mktemp)" find "$TARGET_PATH" -maxdepth 2 -type f -path "*/power/runtime_status" \ - -exec printf '%s\n' {} \; 2>/dev/null > "$_rt_nodes_list" + -exec printf '%s\n' {} \; 2>/dev/null >"$_rt_nodes_list" while IFS= read -r f; do [ -n "$f" ] && CHECK_NODES="$CHECK_NODES $f" - done < "$_rt_nodes_list" + done <"$_rt_nodes_list" rm -f "$_rt_nodes_list" fi @@ -197,69 +271,72 @@ while IFS='|' read -r rpath rstate rfirm rname; do log_fail "$inst_id: boot check FAIL (state=$rstate)" boot_res="FAIL" inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES - $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" + RESULT_LINES="$RESULT_LINES $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" continue fi - # ---- Fixed pre-stop delay (always wait PRE_STOP_DELAY seconds) ----------- - log_info "$inst_id: waiting ${PRE_STOP_DELAY}s before remoteproc stop (fixed delay)" - [ "$PRE_STOP_DELAY" -gt 0 ] && sleep "$PRE_STOP_DELAY" - - # Optional gating: after the fixed delay, ensure PM is OK before stopping - if [ "$FATAL_ON_UNSUSPENDED" -eq 1 ]; then - if [ "$(audio_pm_snapshot_ok)" -ne 1 ]; then - log_fail "Audio not in suspended/unsupported state after ${PRE_STOP_DELAY}s (FATAL_ON_UNSUSPENDED=1); aborting before stop" - log_info "Writing to file $RES_FILE" - echo "$TESTNAME FAIL" >"$RES_FILE" - exit 1 + if [ "$DO_SSR" -eq 1 ]; then + # ---- Fixed pre-stop delay (always wait PRE_STOP_DELAY seconds) ----------- + log_info "$inst_id: waiting ${PRE_STOP_DELAY}s before remoteproc stop (fixed delay)" + [ "$PRE_STOP_DELAY" -gt 0 ] && sleep "$PRE_STOP_DELAY" + + # Optional gating: after the fixed delay, ensure PM is OK before stopping + if [ "$FATAL_ON_UNSUSPENDED" -eq 1 ]; then + if [ "$(audio_pm_snapshot_ok)" -ne 1 ]; then + log_fail "Audio not in suspended/unsupported state after ${PRE_STOP_DELAY}s (FATAL_ON_UNSUSPENDED=1); aborting before stop" + log_info "Writing to file $RES_FILE" + echo "$TESTNAME FAIL" >"$RES_FILE" + exit 1 + fi fi - fi - # Helpful dmesg snapshots - dmesg | tail -n 100 > "$test_path/dmesg_before_stop.log" - dump_rproc_logs "$rpath" before-stop - - # ---- Stop ADSP ----------------------------------------------------------- - t0="$(date +%s)" - log_info "$inst_id: stopping" - if stop_remoteproc "$rpath" && wait_remoteproc_state "$rpath" offline "$STOP_TO" "$POLL_I"; then - t1="$(date +%s)" - log_pass "$inst_id: stop PASS ($((t1 - t0))s)" - stop_res="PASS" - else - dump_rproc_logs "$rpath" after-stop-fail - log_fail "$inst_id: stop FAIL" - stop_res="FAIL" - inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES - $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" - continue - fi + # Helpful dmesg snapshots + dmesg | tail -n 100 >"$test_path/dmesg_before_stop.log" + dump_rproc_logs "$rpath" before-stop + + # ---- Stop ADSP ----------------------------------------------------------- + t0="$(date +%s)" + log_info "$inst_id: stopping" + if stop_remoteproc "$rpath" && wait_remoteproc_state "$rpath" offline "$STOP_TO" "$POLL_I"; then + t1="$(date +%s)" + log_pass "$inst_id: stop PASS ($((t1 - t0))s)" + stop_res="PASS" + else + dump_rproc_logs "$rpath" after-stop-fail + log_fail "$inst_id: stop FAIL" + stop_res="FAIL" + inst_fail=$((inst_fail + 1)) + RESULT_LINES="$RESULT_LINES $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" + continue + fi + + dump_rproc_logs "$rpath" after-stop + dump_rproc_logs "$rpath" before-start - dump_rproc_logs "$rpath" after-stop - dump_rproc_logs "$rpath" before-start + # ---- Start ADSP ---------------------------------------------------------- + t2="$(date +%s)" + log_info "$inst_id: starting" + if start_remoteproc "$rpath" && wait_remoteproc_state "$rpath" running "$START_TO" "$POLL_I"; then + t3="$(date +%s)" + log_pass "$inst_id: start PASS ($((t3 - t2))s)" + start_res="PASS" + else + dump_rproc_logs "$rpath" after-start-fail + log_fail "$inst_id: start FAIL" + start_res="FAIL" + inst_fail=$((inst_fail + 1)) + RESULT_LINES="$RESULT_LINES $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" + continue + fi - # ---- Start ADSP ---------------------------------------------------------- - t2="$(date +%s)" - log_info "$inst_id: starting" - if start_remoteproc "$rpath" && wait_remoteproc_state "$rpath" running "$START_TO" "$POLL_I"; then - t3="$(date +%s)" - log_pass "$inst_id: start PASS ($((t3 - t2))s)" - start_res="PASS" + dump_rproc_logs "$rpath" after-start + dmesg | tail -n 100 >"$test_path/dmesg_after_restart.log" else - dump_rproc_logs "$rpath" after-start-fail - log_fail "$inst_id: start FAIL" - start_res="FAIL" - inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES - $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" - continue + log_info "$inst_id: SSR disabled (--ssr not set). Skipping stop/start." + stop_res="SKIPPED" + start_res="SKIPPED" fi - dump_rproc_logs "$rpath" after-start - dmesg | tail -n 100 > "$test_path/dmesg_after_restart.log" - # ---- Optional RPMsg sanity ping ----------------------------------------- if CTRL_DEV="$(find_rpmsg_ctrl_for "$FW")"; then log_info "$inst_id: RPMsg ctrl dev: $CTRL_DEV" @@ -275,8 +352,7 @@ while IFS='|' read -r rpath rstate rfirm rname; do log_info "$inst_id: no RPMsg channel, skipping ping" fi - RESULT_LINES="$RESULT_LINES - $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" + RESULT_LINES="$RESULT_LINES $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" done <<__RPROC_LIST__ $entries __RPROC_LIST__ diff --git a/Runner/suites/Kernel/Baseport/cdsp_remoteproc/run.sh b/Runner/suites/Kernel/Baseport/cdsp_remoteproc/run.sh index 984fecfd..45beda88 100755 --- a/Runner/suites/Kernel/Baseport/cdsp_remoteproc/run.sh +++ b/Runner/suites/Kernel/Baseport/cdsp_remoteproc/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" @@ -45,7 +44,65 @@ STOP_TO="${STOP_TO:-10}" START_TO="${START_TO:-10}" POLL_I="${POLL_I:-1}" -log_info "DEBUG: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I" +# --- CLI ---------------------------------------------------------------------- +# Default: do NOT do SSR (stop/start). Enable explicitly with --ssr +DO_SSR=0 + +usage() { + echo "Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2 + echo " --ssr Perform CDSP stop/start (SSR). Default: OFF" >&2 + echo " --stop-to SEC Stop timeout (default: $STOP_TO)" >&2 + echo " --start-to SEC Start timeout (default: $START_TO)" >&2 + echo " --poll-i SEC Poll interval (default: $POLL_I)" >&2 +} + +while [ $# -gt 0 ]; do + case "$1" in + --ssr) + DO_SSR=1 + shift + ;; + --stop-to) + if [ $# -lt 2 ]; then + log_fail "Missing value for --stop-to" + usage + exit 2 + fi + STOP_TO="$2" + shift 2 + ;; + --start-to) + if [ $# -lt 2 ]; then + log_fail "Missing value for --start-to" + usage + exit 2 + fi + START_TO="$2" + shift 2 + ;; + --poll-i) + if [ $# -lt 2 ]; then + log_fail "Missing value for --poll-i" + usage + exit 2 + fi + POLL_I="$2" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + log_warn "Unknown argument: $1" + usage + exit 2 + ;; + esac +done + +log_info "Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I" +log_info "SSR control: DO_SSR=$DO_SSR (0=no stop/start, 1=do stop/start)" # --- Device Tree gate ---------------------------------------------------- if dt_has_remoteproc_fw "$FW"; then @@ -59,9 +116,11 @@ fi # ---------- Discover all matching remoteproc entries ---------- # get_remoteproc_by_firmware prints: "path|state|firmware|name" -entries="$(get_remoteproc_by_firmware "$FW" "" all)" || entries="" +entries="$(get_remoteproc_by_firmware "$FW" "" all 2>/dev/null)" || entries="" if [ -z "$entries" ]; then log_fail "$FW present in DT but no /sys/class/remoteproc entry found" + log_info "Writing to $RES_FILE" + echo "$TESTNAME FAIL" > "$RES_FILE" exit 1 fi @@ -98,43 +157,51 @@ while IFS='|' read -r rpath rstate rfirm rname; do continue fi - # Stop - dump_rproc_logs "$rpath" before-stop - t0=$(date +%s) - log_info "$inst_id: stopping" - if stop_remoteproc "$rpath" && wait_remoteproc_state "$rpath" offline "$STOP_TO" "$POLL_I"; then - t1=$(date +%s) - log_pass "$inst_id: stop PASS ($((t1 - t0))s)" - stop_res="PASS" - else - dump_rproc_logs "$rpath" after-stop-fail - log_fail "$inst_id: stop FAIL" - stop_res="FAIL" - inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES + if [ "$DO_SSR" -eq 1 ]; then + # Stop + dump_rproc_logs "$rpath" before-stop + t0=$(date +%s) + log_info "$inst_id: stopping" + log_info "$inst_id: waiting for state=offline with timeout=${STOP_TO}s poll=${POLL_I}s" + if stop_remoteproc "$rpath" && wait_remoteproc_state "$rpath" offline "$STOP_TO" "$POLL_I"; then + t1=$(date +%s) + log_pass "$inst_id: stop PASS ($((t1 - t0))s)" + stop_res="PASS" + else + dump_rproc_logs "$rpath" after-stop-fail + log_fail "$inst_id: stop FAIL" + stop_res="FAIL" + inst_fail=$((inst_fail + 1)) + RESULT_LINES="$RESULT_LINES $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" - continue - fi - dump_rproc_logs "$rpath" after-stop - - # Start - dump_rproc_logs "$rpath" before-start - t2=$(date +%s) - log_info "$inst_id: starting" - if start_remoteproc "$rpath" && wait_remoteproc_state "$rpath" running "$START_TO" "$POLL_I"; then - t3=$(date +%s) - log_pass "$inst_id: start PASS ($((t3 - t2))s)" - start_res="PASS" - else - dump_rproc_logs "$rpath" after-start-fail - log_fail "$inst_id: start FAIL" - start_res="FAIL" - inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES + continue + fi + dump_rproc_logs "$rpath" after-stop + + # Start + dump_rproc_logs "$rpath" before-start + t2=$(date +%s) + log_info "$inst_id: starting" + log_info "$inst_id: waiting for state=running with timeout=${START_TO}s poll=${POLL_I}s" + if start_remoteproc "$rpath" && wait_remoteproc_state "$rpath" running "$START_TO" "$POLL_I"; then + t3=$(date +%s) + log_pass "$inst_id: start PASS ($((t3 - t2))s)" + start_res="PASS" + else + dump_rproc_logs "$rpath" after-start-fail + log_fail "$inst_id: start FAIL" + start_res="FAIL" + inst_fail=$((inst_fail + 1)) + RESULT_LINES="$RESULT_LINES $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" - continue + continue + fi + dump_rproc_logs "$rpath" after-start + else + log_info "$inst_id: SSR disabled (--ssr not set). Skipping stop/start." + stop_res="SKIPPED" + start_res="SKIPPED" fi - dump_rproc_logs "$rpath" after-start # Optional RPMsg ping if CTRL_DEV=$(find_rpmsg_ctrl_for "$FW"); then diff --git a/Runner/suites/Kernel/Baseport/etm_trace/README.md b/Runner/suites/Kernel/Baseport/etm_trace/README.md index 46bc9f05..b33a0351 100644 --- a/Runner/suites/Kernel/Baseport/etm_trace/README.md +++ b/Runner/suites/Kernel/Baseport/etm_trace/README.md @@ -1,7 +1,6 @@ # ETM_Trace Validation test Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause ## Overview This test case validates the CoreSight Embedded Trace Macrocell (ETM) trace capture functionality on the target device. It ensures that the ETM source and TMC sink are properly enabled and that trace data can be successfully captured and validated. diff --git a/Runner/suites/Kernel/Baseport/etm_trace/run.sh b/Runner/suites/Kernel/Baseport/etm_trace/run.sh index dbfe23ab..c88a12f4 100755 --- a/Runner/suites/Kernel/Baseport/etm_trace/run.sh +++ b/Runner/suites/Kernel/Baseport/etm_trace/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/gpdsp_remoteproc/run.sh b/Runner/suites/Kernel/Baseport/gpdsp_remoteproc/run.sh index d19d60bd..aa07858d 100755 --- a/Runner/suites/Kernel/Baseport/gpdsp_remoteproc/run.sh +++ b/Runner/suites/Kernel/Baseport/gpdsp_remoteproc/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" @@ -45,7 +44,65 @@ STOP_TO="${STOP_TO:-10}" START_TO="${START_TO:-10}" POLL_I="${POLL_I:-1}" -log_info "DEBUG: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I" +# --- CLI ---------------------------------------------------------------------- +# Default: do NOT do SSR (stop/start). Enable explicitly with --ssr +DO_SSR=0 + +usage() { + echo "Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2 + echo " --ssr Perform $FW stop/start (SSR). Default: OFF" >&2 + echo " --stop-to SEC Stop timeout (default: $STOP_TO)" >&2 + echo " --start-to SEC Start timeout (default: $START_TO)" >&2 + echo " --poll-i SEC Poll interval (default: $POLL_I)" >&2 +} + +while [ $# -gt 0 ]; do + case "$1" in + --ssr) + DO_SSR=1 + shift + ;; + --stop-to) + if [ $# -lt 2 ]; then + log_fail "Missing value for --stop-to" + usage + exit 2 + fi + STOP_TO="$2" + shift 2 + ;; + --start-to) + if [ $# -lt 2 ]; then + log_fail "Missing value for --start-to" + usage + exit 2 + fi + START_TO="$2" + shift 2 + ;; + --poll-i) + if [ $# -lt 2 ]; then + log_fail "Missing value for --poll-i" + usage + exit 2 + fi + POLL_I="$2" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + log_warn "Unknown argument: $1" + usage + exit 2 + ;; + esac +done + +log_info "Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I" +log_info "SSR control: DO_SSR=$DO_SSR (0=no stop/start, 1=do stop/start)" # DT check for entries if dt_has_remoteproc_fw "$FW"; then @@ -97,43 +154,49 @@ while IFS='|' read -r rpath rstate rfirm rname; do continue fi - # Stop - dump_rproc_logs "$rpath" before-stop - t0=$(date +%s) - log_info "$inst_id: stopping" - if stop_remoteproc "$rpath" && wait_remoteproc_state "$rpath" offline "$STOP_TO" "$POLL_I"; then - t1=$(date +%s) - log_pass "$inst_id: stop PASS ($((t1 - t0))s)" - stop_res="PASS" - else - dump_rproc_logs "$rpath" after-stop-fail - log_fail "$inst_id: stop FAIL" - stop_res="FAIL" - inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES + if [ "$DO_SSR" -eq 1 ]; then + # Stop + dump_rproc_logs "$rpath" before-stop + t0=$(date +%s) + log_info "$inst_id: stopping" + if stop_remoteproc "$rpath" && wait_remoteproc_state "$rpath" offline "$STOP_TO" "$POLL_I"; then + t1=$(date +%s) + log_pass "$inst_id: stop PASS ($((t1 - t0))s)" + stop_res="PASS" + else + dump_rproc_logs "$rpath" after-stop-fail + log_fail "$inst_id: stop FAIL" + stop_res="FAIL" + inst_fail=$((inst_fail + 1)) + RESULT_LINES="$RESULT_LINES $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" - continue - fi - dump_rproc_logs "$rpath" after-stop - - # Start - dump_rproc_logs "$rpath" before-start - t2=$(date +%s) - log_info "$inst_id: starting" - if start_remoteproc "$rpath" && wait_remoteproc_state "$rpath" running "$START_TO" "$POLL_I"; then - t3=$(date +%s) - log_pass "$inst_id: start PASS ($((t3 - t2))s)" - start_res="PASS" - else - dump_rproc_logs "$rpath" after-start-fail - log_fail "$inst_id: start FAIL" - start_res="FAIL" - inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES + continue + fi + dump_rproc_logs "$rpath" after-stop + + # Start + dump_rproc_logs "$rpath" before-start + t2=$(date +%s) + log_info "$inst_id: starting" + if start_remoteproc "$rpath" && wait_remoteproc_state "$rpath" running "$START_TO" "$POLL_I"; then + t3=$(date +%s) + log_pass "$inst_id: start PASS ($((t3 - t2))s)" + start_res="PASS" + else + dump_rproc_logs "$rpath" after-start-fail + log_fail "$inst_id: start FAIL" + start_res="FAIL" + inst_fail=$((inst_fail + 1)) + RESULT_LINES="$RESULT_LINES $inst_id: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" - continue + continue + fi + dump_rproc_logs "$rpath" after-start + else + log_info "$inst_id: SSR disabled (--ssr not set). Skipping stop/start." + stop_res="SKIPPED" + start_res="SKIPPED" fi - dump_rproc_logs "$rpath" after-start # Optional RPMsg ping if CTRL_DEV=$(find_rpmsg_ctrl_for "$FW"); then diff --git a/Runner/suites/Kernel/Baseport/hotplug/run.sh b/Runner/suites/Kernel/Baseport/hotplug/run.sh index 7a5b63fc..b3e8420f 100755 --- a/Runner/suites/Kernel/Baseport/hotplug/run.sh +++ b/Runner/suites/Kernel/Baseport/hotplug/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/iommu/README.md b/Runner/suites/Kernel/Baseport/iommu/README.md index 6807c595..69cb66a6 100644 --- a/Runner/suites/Kernel/Baseport/iommu/README.md +++ b/Runner/suites/Kernel/Baseport/iommu/README.md @@ -39,5 +39,4 @@ Test result will be saved in `IOMMU.res` as: ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -(C) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause(C) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Kernel/Baseport/iommu/run.sh b/Runner/suites/Kernel/Baseport/iommu/run.sh index 0cb0a794..0b81d1bd 100755 --- a/Runner/suites/Kernel/Baseport/iommu/run.sh +++ b/Runner/suites/Kernel/Baseport/iommu/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/irq/run.sh b/Runner/suites/Kernel/Baseport/irq/run.sh index 57f7e7fb..2bfe0044 100755 --- a/Runner/suites/Kernel/Baseport/irq/run.sh +++ b/Runner/suites/Kernel/Baseport/irq/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/kaslr/run.sh b/Runner/suites/Kernel/Baseport/kaslr/run.sh index 44da0505..d0775aa9 100755 --- a/Runner/suites/Kernel/Baseport/kaslr/run.sh +++ b/Runner/suites/Kernel/Baseport/kaslr/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/pinctrl/run.sh b/Runner/suites/Kernel/Baseport/pinctrl/run.sh index d41256e3..370cdc03 100755 --- a/Runner/suites/Kernel/Baseport/pinctrl/run.sh +++ b/Runner/suites/Kernel/Baseport/pinctrl/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/qcom_crypto/README_qcom_crypto.md b/Runner/suites/Kernel/Baseport/qcom_crypto/README_qcom_crypto.md index 37429568..f3c5fd32 100755 --- a/Runner/suites/Kernel/Baseport/qcom_crypto/README_qcom_crypto.md +++ b/Runner/suites/Kernel/Baseport/qcom_crypto/README_qcom_crypto.md @@ -1,6 +1,5 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause # Qualcomm Crypto (qcom_crypto) Functionality Test Script # Overview diff --git a/Runner/suites/Kernel/Baseport/qcom_crypto/run.sh b/Runner/suites/Kernel/Baseport/qcom_crypto/run.sh index 3faa0c61..c4b8318b 100755 --- a/Runner/suites/Kernel/Baseport/qcom_crypto/run.sh +++ b/Runner/suites/Kernel/Baseport/qcom_crypto/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/qcom_hwrng/README_qcom_hwrng.md b/Runner/suites/Kernel/Baseport/qcom_hwrng/README_qcom_hwrng.md index 23e07117..c34f132d 100644 --- a/Runner/suites/Kernel/Baseport/qcom_hwrng/README_qcom_hwrng.md +++ b/Runner/suites/Kernel/Baseport/qcom_hwrng/README_qcom_hwrng.md @@ -1,6 +1,5 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause # Qualcomm Hardware Random Number Generator (QRNG) Script # Overview diff --git a/Runner/suites/Kernel/Baseport/qcom_hwrng/run.sh b/Runner/suites/Kernel/Baseport/qcom_hwrng/run.sh index 376c90cc..415d8517 100755 --- a/Runner/suites/Kernel/Baseport/qcom_hwrng/run.sh +++ b/Runner/suites/Kernel/Baseport/qcom_hwrng/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/qcrypto/run.sh b/Runner/suites/Kernel/Baseport/qcrypto/run.sh index 2376a2e5..9979e113 100755 --- a/Runner/suites/Kernel/Baseport/qcrypto/run.sh +++ b/Runner/suites/Kernel/Baseport/qcrypto/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/remoteproc/run.sh b/Runner/suites/Kernel/Baseport/remoteproc/run.sh index 10889c25..d167bead 100755 --- a/Runner/suites/Kernel/Baseport/remoteproc/run.sh +++ b/Runner/suites/Kernel/Baseport/remoteproc/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/rngtest/run.sh b/Runner/suites/Kernel/Baseport/rngtest/run.sh index 6314dc29..ffecff30 100755 --- a/Runner/suites/Kernel/Baseport/rngtest/run.sh +++ b/Runner/suites/Kernel/Baseport/rngtest/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/shmbridge/README.md b/Runner/suites/Kernel/Baseport/shmbridge/README.md index 3128b6a3..5cceae43 100644 --- a/Runner/suites/Kernel/Baseport/shmbridge/README.md +++ b/Runner/suites/Kernel/Baseport/shmbridge/README.md @@ -1,6 +1,5 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause # shmbridge Validation test ## Overview diff --git a/Runner/suites/Kernel/Baseport/shmbridge/run.sh b/Runner/suites/Kernel/Baseport/shmbridge/run.sh index dc4fa893..650ec429 100755 --- a/Runner/suites/Kernel/Baseport/shmbridge/run.sh +++ b/Runner/suites/Kernel/Baseport/shmbridge/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Locate and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/smmu/run.sh b/Runner/suites/Kernel/Baseport/smmu/run.sh index f04ddff8..8b7ee749 100755 --- a/Runner/suites/Kernel/Baseport/smmu/run.sh +++ b/Runner/suites/Kernel/Baseport/smmu/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/stm_cpu/README.md b/Runner/suites/Kernel/Baseport/stm_cpu/README.md index ef0fea7b..5b8851b6 100644 --- a/Runner/suites/Kernel/Baseport/stm_cpu/README.md +++ b/Runner/suites/Kernel/Baseport/stm_cpu/README.md @@ -1,7 +1,6 @@ # STM CPU Trace Validation test Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause ## Overview This test case validates the System Trace Macrocell (STM) functionality on the target device by configuring the STM source, enabling tracing, and capturing trace data. It ensures that the STM infrastructure is correctly initialized and capable of generating trace output. diff --git a/Runner/suites/Kernel/Baseport/stm_cpu/run.sh b/Runner/suites/Kernel/Baseport/stm_cpu/run.sh index 54ee25a7..75f9103e 100755 --- a/Runner/suites/Kernel/Baseport/stm_cpu/run.sh +++ b/Runner/suites/Kernel/Baseport/stm_cpu/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/usb_hid/README.md b/Runner/suites/Kernel/Baseport/usb_hid/README.md index edcc2d21..218a902d 100644 --- a/Runner/suites/Kernel/Baseport/usb_hid/README.md +++ b/Runner/suites/Kernel/Baseport/usb_hid/README.md @@ -1,6 +1,5 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause # USB HID Validation ## Overview diff --git a/Runner/suites/Kernel/Baseport/usb_hid/run.sh b/Runner/suites/Kernel/Baseport/usb_hid/run.sh index 173ad2d7..94c50db7 100755 --- a/Runner/suites/Kernel/Baseport/usb_hid/run.sh +++ b/Runner/suites/Kernel/Baseport/usb_hid/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Validate USB HID device detection # Requires at least one USB HID peripheral (keyboard/mouse, etc.) connected to a USB Host port. diff --git a/Runner/suites/Kernel/Baseport/watchdog/run.sh b/Runner/suites/Kernel/Baseport/watchdog/run.sh index 2f8b46ea..2d5a159e 100755 --- a/Runner/suites/Kernel/Baseport/watchdog/run.sh +++ b/Runner/suites/Kernel/Baseport/watchdog/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Baseport/wpss_remoteproc/run.sh b/Runner/suites/Kernel/Baseport/wpss_remoteproc/run.sh index aaad5313..df72f35d 100755 --- a/Runner/suites/Kernel/Baseport/wpss_remoteproc/run.sh +++ b/Runner/suites/Kernel/Baseport/wpss_remoteproc/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" @@ -48,6 +47,66 @@ STOP_TO="${STOP_TO:-10}" START_TO="${START_TO:-10}" POLL_I="${POLL_I:-1}" +# --- CLI ---------------------------------------------------------------------- +# Default: do NOT do SSR (stop/start). Enable explicitly with --ssr +DO_SSR=0 + +usage() { + echo "Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2 + echo " --ssr Perform WPSS stop/start (SSR). Default: OFF" >&2 + echo " --stop-to SEC Stop timeout (default: $STOP_TO)" >&2 + echo " --start-to SEC Start timeout (default: $START_TO)" >&2 + echo " --poll-i SEC Poll interval (default: $POLL_I)" >&2 +} + +while [ $# -gt 0 ]; do + case "$1" in + --ssr) + DO_SSR=1 + shift + ;; + --stop-to) + if [ $# -lt 2 ]; then + log_fail "Missing value for --stop-to" + usage + exit 2 + fi + STOP_TO="$2" + shift 2 + ;; + --start-to) + if [ $# -lt 2 ]; then + log_fail "Missing value for --start-to" + usage + exit 2 + fi + START_TO="$2" + shift 2 + ;; + --poll-i) + if [ $# -lt 2 ]; then + log_fail "Missing value for --poll-i" + usage + exit 2 + fi + POLL_I="$2" + shift 2 + ;; + -h|--help) + usage + exit 0 + ;; + *) + log_warn "Unknown argument: $1" + usage + exit 2 + ;; + esac +done + +log_info "Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I" +log_info "SSR control: DO_SSR=$DO_SSR (0=no stop/start, 1=do stop/start)" + # ---------- Try remoteproc path ---------- rp_entries="" dt_says_present=0 @@ -92,43 +151,49 @@ if [ -n "$rp_entries" ]; then continue fi - # Stop - dump_rproc_logs "$rpath" before-stop - t0=$(date +%s) - log_info "$inst: stopping" - if stop_remoteproc "$rpath" && wait_remoteproc_state "$rpath" offline "$STOP_TO" "$POLL_I"; then - t1=$(date +%s) - log_pass "$inst: stop PASS ($((t1 - t0))s)" - stop_res="PASS" - else - dump_rproc_logs "$rpath" after-stop-fail - log_fail "$inst: stop FAIL" - stop_res="FAIL" - inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES + if [ "$DO_SSR" -eq 1 ]; then + # Stop + dump_rproc_logs "$rpath" before-stop + t0=$(date +%s) + log_info "$inst: stopping" + if stop_remoteproc "$rpath" && wait_remoteproc_state "$rpath" offline "$STOP_TO" "$POLL_I"; then + t1=$(date +%s) + log_pass "$inst: stop PASS ($((t1 - t0))s)" + stop_res="PASS" + else + dump_rproc_logs "$rpath" after-stop-fail + log_fail "$inst: stop FAIL" + stop_res="FAIL" + inst_fail=$((inst_fail + 1)) + RESULT_LINES="$RESULT_LINES $inst: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" - continue - fi - dump_rproc_logs "$rpath" after-stop - - # Start - dump_rproc_logs "$rpath" before-start - t2=$(date +%s) - log_info "$inst: starting" - if start_remoteproc "$rpath" && wait_remoteproc_state "$rpath" running "$START_TO" "$POLL_I"; then - t3=$(date +%s) - log_pass "$inst: start PASS ($((t3 - t2))s)" - start_res="PASS" - else - dump_rproc_logs "$rpath" after-start-fail - log_fail "$inst: start FAIL" - start_res="FAIL" - inst_fail=$((inst_fail + 1)) - RESULT_LINES="$RESULT_LINES + continue + fi + dump_rproc_logs "$rpath" after-stop + + # Start + dump_rproc_logs "$rpath" before-start + t2=$(date +%s) + log_info "$inst: starting" + if start_remoteproc "$rpath" && wait_remoteproc_state "$rpath" running "$START_TO" "$POLL_I"; then + t3=$(date +%s) + log_pass "$inst: start PASS ($((t3 - t2))s)" + start_res="PASS" + else + dump_rproc_logs "$rpath" after-start-fail + log_fail "$inst: start FAIL" + start_res="FAIL" + inst_fail=$((inst_fail + 1)) + RESULT_LINES="$RESULT_LINES $inst: boot=$boot_res, stop=$stop_res, start=$start_res, ping=$ping_res" - continue + continue + fi + dump_rproc_logs "$rpath" after-start + else + log_info "$inst: SSR disabled (--ssr not set). Skipping stop/start." + stop_res="SKIPPED" + start_res="SKIPPED" fi - dump_rproc_logs "$rpath" after-start # RPMsg ping (optional) if CTRL_DEV=$(find_rpmsg_ctrl_for "$FW"); then @@ -203,7 +268,7 @@ scan_dmesg_errors "ath11k|wpss" "." "crash|timeout|fail" "fw_version|firmware" # (Return codes from scan_dmesg_errors are informational; it logs itself) # Net interface presence is informative -set -- /sys/class/net/wlan[0-9]* 2>/dev/null +set -- /sys/class/net/wlan[0-9]* if [ -e "$1" ]; then log_info "wlan interface present (ath11k up)" else diff --git a/Runner/suites/Kernel/DCVS/Freq_Scaling/README.md b/Runner/suites/Kernel/DCVS/Freq_Scaling/README.md index eeb57119..c50f3769 100644 --- a/Runner/suites/Kernel/DCVS/Freq_Scaling/README.md +++ b/Runner/suites/Kernel/DCVS/Freq_Scaling/README.md @@ -33,5 +33,4 @@ Test result will be saved in `Freq_Scaling.res` as: ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -(C) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause(C) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Kernel/DCVS/Freq_Scaling/run.sh b/Runner/suites/Kernel/DCVS/Freq_Scaling/run.sh index d2345ace..3f697544 100755 --- a/Runner/suites/Kernel/DCVS/Freq_Scaling/run.sh +++ b/Runner/suites/Kernel/DCVS/Freq_Scaling/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Scheduler/CPU_affinity/README.md b/Runner/suites/Kernel/Scheduler/CPU_affinity/README.md index 40bd9049..11fa63fd 100644 --- a/Runner/suites/Kernel/Scheduler/CPU_affinity/README.md +++ b/Runner/suites/Kernel/Scheduler/CPU_affinity/README.md @@ -33,5 +33,4 @@ Test result will be saved in `CPU_affinity.res` as: ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -(C) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause(C) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Kernel/Scheduler/CPU_affinity/run.sh b/Runner/suites/Kernel/Scheduler/CPU_affinity/run.sh index 923e8e74..3a319cb8 100755 --- a/Runner/suites/Kernel/Scheduler/CPU_affinity/run.sh +++ b/Runner/suites/Kernel/Scheduler/CPU_affinity/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Kernel/Stress/Stress-ng/README.md b/Runner/suites/Kernel/Stress/Stress-ng/README.md index bfa7d671..f0d1ec49 100644 --- a/Runner/suites/Kernel/Stress/Stress-ng/README.md +++ b/Runner/suites/Kernel/Stress/Stress-ng/README.md @@ -287,7 +287,7 @@ Still, run on development hardware or staging boards when possible. License -The test runner: BSD-3-Clause-Clear (Qualcomm Technologies, Inc. and/or its subsidiaries). +The test runner: BSD-3-Clause (Qualcomm Technologies, Inc. and/or its subsidiaries). stress-ng is licensed upstream by its author; see its repository for details. diff --git a/Runner/suites/Kernel/Stress/Stress-ng/run.sh b/Runner/suites/Kernel/Stress/Stress-ng/run.sh index cd643848..c381764e 100755 --- a/Runner/suites/Kernel/Stress/Stress-ng/run.sh +++ b/Runner/suites/Kernel/Stress/Stress-ng/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # stress-ng validation runner: # - Default: auto-sized CPU + VM/HDD sets with strict FAIL criteria # - Custom: pass any stress-ng CLI via --stressng-args "…" or after "--" diff --git a/Runner/suites/Kernel/Stress/Stressapptest/README.md b/Runner/suites/Kernel/Stress/Stressapptest/README.md index ebd96755..b0adbc54 100644 --- a/Runner/suites/Kernel/Stress/Stressapptest/README.md +++ b/Runner/suites/Kernel/Stress/Stressapptest/README.md @@ -223,5 +223,5 @@ Auto network starts a local listen thread and chooses a primary IP (falling back License -The test runner: BSD-3-Clause-Clear (Qualcomm Technologies, Inc. and/or its subsidiaries). +The test runner: BSD-3-Clause (Qualcomm Technologies, Inc. and/or its subsidiaries). stressapptest is licensed by its upstream author; see its repository for details. diff --git a/Runner/suites/Kernel/Stress/Stressapptest/run.sh b/Runner/suites/Kernel/Stress/Stressapptest/run.sh index 8d080893..d2d7331a 100755 --- a/Runner/suites/Kernel/Stress/Stressapptest/run.sh +++ b/Runner/suites/Kernel/Stress/Stressapptest/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # stressapptest/run.sh # Safe wrapper around stressapptest for embedded/CI use. # Memory-safety features: --mem-pct, --mem-cap-mb, --mem-headroom-mb, diff --git a/Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md b/Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md index a81b8793..d97c3f8c 100644 --- a/Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md +++ b/Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md @@ -383,5 +383,4 @@ Results: ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -(C) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause(C) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh b/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh index 05ff639b..e685987a 100755 --- a/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh +++ b/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" # ---- Source init_env & tools ---- diff --git a/Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md b/Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md index 2864f02c..7ef508b4 100644 --- a/Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md +++ b/Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md @@ -360,5 +360,4 @@ Results: ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -(C) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause(C) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Multimedia/Audio/AudioRecord/run.sh b/Runner/suites/Multimedia/Audio/AudioRecord/run.sh index 430c1707..58770e1b 100755 --- a/Runner/suites/Multimedia/Audio/AudioRecord/run.sh +++ b/Runner/suites/Multimedia/Audio/AudioRecord/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" # ---- Source init_env & tools ---- 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 33654420..85f22b00 100644 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/fastrpc_test_README.md @@ -155,5 +155,4 @@ FASTRPC_DOMAIN=2 FASTRPC_USER_PD=1 ./run.sh ## License -SPDX-License-Identifier: BSD-3-Clause-Clear -Copyright (c) Qualcomm Technologies, Inc. +SPDX-License-Identifier: BSD-3-ClauseCopyright (c) Qualcomm Technologies, Inc. diff --git a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh index 8bb96ec1..4546e45f 100755 --- a/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh +++ b/Runner/suites/Multimedia/CDSP/fastrpc_test/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # --------- Robustly source init_env and functestlib.sh ---------- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Multimedia/Camera/Camera_NHX/run.sh b/Runner/suites/Multimedia/Camera/Camera_NHX/run.sh index 5547249b..38ed33e8 100755 --- a/Runner/suites/Multimedia/Camera/Camera_NHX/run.sh +++ b/Runner/suites/Multimedia/Camera/Camera_NHX/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Camera NHX validation TESTNAME="Camera_NHX" diff --git a/Runner/suites/Multimedia/Camera/Camera_RDI_FrameCapture/run.sh b/Runner/suites/Multimedia/Camera/Camera_RDI_FrameCapture/run.sh index edff66da..dd939b56 100755 --- a/Runner/suites/Multimedia/Camera/Camera_RDI_FrameCapture/run.sh +++ b/Runner/suites/Multimedia/Camera/Camera_RDI_FrameCapture/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# --- Robustly find and source init_env --------------------------- +# SPDX-License-Identifier: BSD-3-Clause# --- Robustly find and source init_env --------------------------- # ---------- Repo env + helpers ---------- SCRIPT_DIR="$( cd "$(dirname "$0")" || exit 1 diff --git a/Runner/suites/Multimedia/Camera/Libcamera_cam/run.sh b/Runner/suites/Multimedia/Camera/Libcamera_cam/run.sh index d021c5a3..5a746700 100755 --- a/Runner/suites/Multimedia/Camera/Libcamera_cam/run.sh +++ b/Runner/suites/Multimedia/Camera/Libcamera_cam/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# libcamera 'cam' runner with strong post-capture validation (CLI-config only) +# SPDX-License-Identifier: BSD-3-Clause# libcamera 'cam' runner with strong post-capture validation (CLI-config only) # ---------- Repo env + helpers (single-pass) ---------- SCRIPT_DIR=$(cd "$(dirname "$0")" || exit 1; pwd) SEARCH="$SCRIPT_DIR" diff --git a/Runner/suites/Multimedia/DSP_AudioPD/run.sh b/Runner/suites/Multimedia/DSP_AudioPD/run.sh index 3e2f787b..55eafac7 100755 --- a/Runner/suites/Multimedia/DSP_AudioPD/run.sh +++ b/Runner/suites/Multimedia/DSP_AudioPD/run.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Robustly find and source init_env SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" INIT_ENV="" diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md b/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md index 00a1d86d..ff5e9daa 100644 --- a/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/Display_IGT_Core_Auth_TestValidation_Readme.md @@ -1,7 +1,6 @@ # License Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear - +SPDX-License-Identifier: BSD-3-Clause # IGT Core Auth Test Script ## Overview diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh b/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh index 3934737b..690ec7cd 100755 --- a/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" # ---- Source init_env & tools ---- diff --git a/Runner/suites/Multimedia/Display/weston-clickdot/run.sh b/Runner/suites/Multimedia/Display/weston-clickdot/run.sh index 9b83c50b..088c5671 100755 --- a/Runner/suites/Multimedia/Display/weston-clickdot/run.sh +++ b/Runner/suites/Multimedia/Display/weston-clickdot/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Validate weston-clickdot runs under a working Wayland session. # - Wayland env resolution (adopts socket & fixes XDG_RUNTIME_DIR perms) # - CI-friendly logs and PASS/FAIL/SKIP semantics (LAVA-friendly: exits 0) diff --git a/Runner/suites/Multimedia/Display/weston-cliptest/run.sh b/Runner/suites/Multimedia/Display/weston-cliptest/run.sh index 0db7d109..7758f18d 100755 --- a/Runner/suites/Multimedia/Display/weston-cliptest/run.sh +++ b/Runner/suites/Multimedia/Display/weston-cliptest/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Validate weston-cliptest runs under a working Wayland session. # - Wayland env resolution (adopts socket & fixes XDG_RUNTIME_DIR perms) # - CI-friendly logs and PASS/FAIL/SKIP semantics (LAVA-friendly: exits 0) diff --git a/Runner/suites/Multimedia/Display/weston-editor/run.sh b/Runner/suites/Multimedia/Display/weston-editor/run.sh index ad6b1d88..5ccb2450 100755 --- a/Runner/suites/Multimedia/Display/weston-editor/run.sh +++ b/Runner/suites/Multimedia/Display/weston-editor/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Validate weston-editor runs under a working Wayland session. # - Uses lib_display.sh to adopt Wayland env (socket + XDG_RUNTIME_DIR) # - CI-friendly logs and PASS/FAIL/SKIP semantics (LAVA-friendly: exits 0) diff --git a/Runner/suites/Multimedia/Display/weston-flower/run.sh b/Runner/suites/Multimedia/Display/weston-flower/run.sh index 84eb6cf3..1d02acde 100755 --- a/Runner/suites/Multimedia/Display/weston-flower/run.sh +++ b/Runner/suites/Multimedia/Display/weston-flower/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Validate weston-flower runs under a working Wayland session. # - Wayland env resolution (adopts socket & fixes XDG_RUNTIME_DIR perms) # - Optional Wayland protocol validation via WAYLAND_DEBUG capture diff --git a/Runner/suites/Multimedia/Display/weston-resizor/run.sh b/Runner/suites/Multimedia/Display/weston-resizor/run.sh index 87527bf4..5b03fcc1 100755 --- a/Runner/suites/Multimedia/Display/weston-resizor/run.sh +++ b/Runner/suites/Multimedia/Display/weston-resizor/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Validate weston-resizor runs under a working Wayland session. # - Wayland env resolution (adopts socket & fixes XDG_RUNTIME_DIR perms) # - CI-friendly logs and PASS/FAIL/SKIP semantics (LAVA-friendly: exits 0) diff --git a/Runner/suites/Multimedia/Display/weston-scaler/run.sh b/Runner/suites/Multimedia/Display/weston-scaler/run.sh index 0744533f..e3a2b678 100755 --- a/Runner/suites/Multimedia/Display/weston-scaler/run.sh +++ b/Runner/suites/Multimedia/Display/weston-scaler/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Validate weston-scaler runs under a working Wayland session. # - Uses lib_display.sh to adopt Wayland env (socket + XDG_RUNTIME_DIR) # - CI-friendly logs and PASS/FAIL/SKIP semantics (LAVA-friendly: exits 0) diff --git a/Runner/suites/Multimedia/Display/weston-smoke/run.sh b/Runner/suites/Multimedia/Display/weston-smoke/run.sh index 967ddec5..c4d9107f 100755 --- a/Runner/suites/Multimedia/Display/weston-smoke/run.sh +++ b/Runner/suites/Multimedia/Display/weston-smoke/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Validate weston-smoke runs under a working Wayland session. # - Wayland env resolution (adopts socket & fixes XDG_RUNTIME_DIR perms) # - Optional Wayland protocol validation via WAYLAND_DEBUG capture diff --git a/Runner/suites/Multimedia/GSTreamer/Audio/Audio_Playback/run.sh b/Runner/suites/Multimedia/GSTreamer/Audio/Audio_Playback/run.sh index f1c97d9d..69be70c8 100755 --- a/Runner/suites/Multimedia/GSTreamer/Audio/Audio_Playback/run.sh +++ b/Runner/suites/Multimedia/GSTreamer/Audio/Audio_Playback/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Audio Playback validation using GStreamer (auto backend: PipeWire/Pulse/ALSA) +# SPDX-License-Identifier: BSD-3-Clause# Audio Playback validation using GStreamer (auto backend: PipeWire/Pulse/ALSA) # Logs everything to console and also to local log files. # PASS/FAIL/SKIP is emitted to .res. Always exits 0 (LAVA-friendly). diff --git a/Runner/suites/Multimedia/Graphics/KMSCube/README_KMSCube.md b/Runner/suites/Multimedia/Graphics/KMSCube/README_KMSCube.md index f033372f..2dd17975 100644 --- a/Runner/suites/Multimedia/Graphics/KMSCube/README_KMSCube.md +++ b/Runner/suites/Multimedia/Graphics/KMSCube/README_KMSCube.md @@ -1,7 +1,6 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear -# KMSCube GraphicsTest Scripts for Qualcomm Linux based platform (Yocto) +SPDX-License-Identifier: BSD-3-Clause# KMSCube GraphicsTest Scripts for Qualcomm Linux based platform (Yocto) # Overview Graphics scripts automates the validation of Graphics OpenGL ES 2.0 capabilities on the Qualcomm RB3 Gen2 platform running a Yocto-based Linux system. It utilizes kmscube test app which is publicly available at https://gitlab.freedesktop.org/mesa/kmscube diff --git a/Runner/suites/Multimedia/Graphics/KMSCube/run.sh b/Runner/suites/Multimedia/Graphics/KMSCube/run.sh index a5b1c42e..22c6c79c 100755 --- a/Runner/suites/Multimedia/Graphics/KMSCube/run.sh +++ b/Runner/suites/Multimedia/Graphics/KMSCube/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # KMSCube Validator Script (Yocto-Compatible, POSIX sh) # --- Robustly find and source init_env --------------------------------------- diff --git a/Runner/suites/Multimedia/Graphics/weston-simple-egl/README_weston-simple-egl.md b/Runner/suites/Multimedia/Graphics/weston-simple-egl/README_weston-simple-egl.md index f9d01098..0e661c99 100644 --- a/Runner/suites/Multimedia/Graphics/weston-simple-egl/README_weston-simple-egl.md +++ b/Runner/suites/Multimedia/Graphics/weston-simple-egl/README_weston-simple-egl.md @@ -1,7 +1,6 @@ Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear -# weston-simple-egl GraphicsTest Scripts for Qualcomm Linux based platform (Yocto) +SPDX-License-Identifier: BSD-3-Clause# weston-simple-egl GraphicsTest Scripts for Qualcomm Linux based platform (Yocto) # Overview Graphics scripts automates the validation of Graphics OpenGL ES 2.0 capabilities on the Qualcomm RB3 Gen2 platform running a Yocto-based Linux system. It utilizes Weston-Simple-EGL test app which is publicly available at https://github.com/krh/weston diff --git a/Runner/suites/Multimedia/Graphics/weston-simple-egl/run.sh b/Runner/suites/Multimedia/Graphics/weston-simple-egl/run.sh index b43ad210..6c5eb481 100755 --- a/Runner/suites/Multimedia/Graphics/weston-simple-egl/run.sh +++ b/Runner/suites/Multimedia/Graphics/weston-simple-egl/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Validate weston-simple-egl runs under a working Wayland session. # - Wayland env resolution (adopts socket & fixes XDG_RUNTIME_DIR perms) # - CI-friendly logs and PASS/FAIL/SKIP semantics diff --git a/Runner/suites/Multimedia/OpenCV/opencv_suite_README.md b/Runner/suites/Multimedia/OpenCV/opencv_suite_README.md index c395555b..481e4dc2 100644 --- a/Runner/suites/Multimedia/OpenCV/opencv_suite_README.md +++ b/Runner/suites/Multimedia/OpenCV/opencv_suite_README.md @@ -332,5 +332,5 @@ Run one binary with extra args: ## License -BSD-3-Clause-Clear (same as the script). +BSD-3-Clause (same as the script). diff --git a/Runner/suites/Multimedia/OpenCV/run.sh b/Runner/suites/Multimedia/OpenCV/run.sh index 1c2f89c2..d6ae74f8 100755 --- a/Runner/suites/Multimedia/OpenCV/run.sh +++ b/Runner/suites/Multimedia/OpenCV/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # OpenCV test/perf suite runner (auto-discovery; per-binary skip; summary; proper exit codes) -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # ----- locate and source init_env ----- SCRIPT_DIR="$( cd "$(dirname "$0")" || exit 1 diff --git a/Runner/suites/Multimedia/Video/Video_V4L2_Runner/README_Video.md b/Runner/suites/Multimedia/Video/Video_V4L2_Runner/README_Video.md index aa53fd16..a5d3d5fb 100644 --- a/Runner/suites/Multimedia/Video/Video_V4L2_Runner/README_Video.md +++ b/Runner/suites/Multimedia/Video/Video_V4L2_Runner/README_Video.md @@ -1,7 +1,7 @@ # Iris V4L2 Video Test Scripts for Qualcomm Linux (Yocto) **Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.** -**SPDX-License-Identifier: BSD-3-Clause-Clear** +**SPDX-License-Identifier: BSD-3-Clause** --- diff --git a/Runner/suites/Multimedia/Video/Video_V4L2_Runner/h264Encoder.json b/Runner/suites/Multimedia/Video/Video_V4L2_Runner/h264Encoder.json index a8a2d945..e09dd6ad 100755 --- a/Runner/suites/Multimedia/Video/Video_V4L2_Runner/h264Encoder.json +++ b/Runner/suites/Multimedia/Video/Video_V4L2_Runner/h264Encoder.json @@ -11,7 +11,7 @@ "PixelFormat": "NV12", "Width": 256, "Height": 144, - "Outputpath": "", + "Outputpath": "", "_Outputpath_original": "./Output_Animation_144p.h264", "InputBufferCount": 32, "OutputBufferCount": 32, @@ -23,9 +23,11 @@ {"Id": "FrameRC", "Vtype": "Int", "Value": 1}, {"Id": "BitRate", "Vtype": "Int", "Value": 18000000}, {"Id": "BitRateMode", "Vtype": "String", "Value": "CBR"}, - {"Id": "PrefixHeaderMode", "Vtype": "String", "Value": "JOINED"} - ] + {"Id": "PrefixHeaderMode", "Vtype": "String", "Value": "JOINED"}, + ], + "DynamicControls": [], + "MemoryType": "MMAP" } } ] -} +} \ No newline at end of file diff --git a/Runner/suites/Multimedia/Video/Video_V4L2_Runner/h265Encoder.json b/Runner/suites/Multimedia/Video/Video_V4L2_Runner/h265Encoder.json index 997d7f6e..1a785747 100755 --- a/Runner/suites/Multimedia/Video/Video_V4L2_Runner/h265Encoder.json +++ b/Runner/suites/Multimedia/Video/Video_V4L2_Runner/h265Encoder.json @@ -12,7 +12,7 @@ "PixelFormat": "NV12", "Width": 256, "Height": 144, - "Outputpath": "", + "Outputpath": "", "_Outputpath_original": "./Output_Animation_144p.265", "UseMinBufferCtrl": false, "InputBufferCount": 32, @@ -61,8 +61,9 @@ "Value": 59 } ], - "DynamicControls": [] + "DynamicControls": [], + "MemoryType": "MMAP" } } ] -} +} \ No newline at end of file diff --git a/Runner/suites/Multimedia/Video/Video_V4L2_Runner/run.sh b/Runner/suites/Multimedia/Video/Video_V4L2_Runner/run.sh index 4681b7a2..4ec7e285 100755 --- a/Runner/suites/Multimedia/Video/Video_V4L2_Runner/run.sh +++ b/Runner/suites/Multimedia/Video/Video_V4L2_Runner/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# IRIS Video V4L2 runner with stack selection via utils/lib_video.sh +# SPDX-License-Identifier: BSD-3-Clause# IRIS Video V4L2 runner with stack selection via utils/lib_video.sh # ---------- Repo env + helpers ---------- SCRIPT_DIR="$( diff --git a/Runner/suites/Performance/Boot_Systemd_KPI_Loop/run.sh b/Runner/suites/Performance/Boot_Systemd_KPI_Loop/run.sh index 78a94429..10a759d2 100755 --- a/Runner/suites/Performance/Boot_Systemd_KPI_Loop/run.sh +++ b/Runner/suites/Performance/Boot_Systemd_KPI_Loop/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Boot KPI multi-boot aggregator / auto-reboot wrapper around Boot_Systemd_Validate. +# SPDX-License-Identifier: BSD-3-Clause# Boot KPI multi-boot aggregator / auto-reboot wrapper around Boot_Systemd_Validate. SCRIPT_DIR="$( cd "$(dirname "$0")" || exit 1 diff --git a/Runner/suites/Performance/Boot_Systemd_Validate/run.sh b/Runner/suites/Performance/Boot_Systemd_Validate/run.sh index c74791f5..8e01be27 100755 --- a/Runner/suites/Performance/Boot_Systemd_Validate/run.sh +++ b/Runner/suites/Performance/Boot_Systemd_Validate/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Systemd boot KPI + validation (single run). +# SPDX-License-Identifier: BSD-3-Clause# Systemd boot KPI + validation (single run). SCRIPT_DIR="$( cd "$(dirname "$0")" || exit 1 diff --git a/Runner/suites/Performance/Geekbench/run.sh b/Runner/suites/Performance/Geekbench/run.sh index eb41603c..ec49df82 100755 --- a/Runner/suites/Performance/Geekbench/run.sh +++ b/Runner/suites/Performance/Geekbench/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Geekbench runner with live console progress + CSV dump (summary + workloads) +# SPDX-License-Identifier: BSD-3-Clause# Geekbench runner with live console progress + CSV dump (summary + workloads) # POSIX + LAVA-friendly, always exits 0, writes PASS/FAIL/SKIP to .res TESTNAME="Geekbench" diff --git a/Runner/suites/Performance/Sysbench_Performance/README_sysbench.md b/Runner/suites/Performance/Sysbench_Performance/README_sysbench.md index 8dd06bc6..5a97c6dc 100644 --- a/Runner/suites/Performance/Sysbench_Performance/README_sysbench.md +++ b/Runner/suites/Performance/Sysbench_Performance/README_sysbench.md @@ -224,4 +224,4 @@ Keep `CSV_FILE` empty by default (to avoid extra artifacts) and enable only when ## License Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -SPDX-License-Identifier: BSD-3-Clause-Clear +SPDX-License-Identifier: BSD-3-Clause \ No newline at end of file diff --git a/Runner/suites/Performance/Sysbench_Performance/run.sh b/Runner/suites/Performance/Sysbench_Performance/run.sh index 4afda1e8..a51b4733 100755 --- a/Runner/suites/Performance/Sysbench_Performance/run.sh +++ b/Runner/suites/Performance/Sysbench_Performance/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause SCRIPT_DIR="$( cd "$(dirname "$0")" || exit 1 pwd diff --git a/Runner/suites/Performance/Tiotest/run.sh b/Runner/suites/Performance/Tiotest/run.sh index 518b7062..753ca269 100755 --- a/Runner/suites/Performance/Tiotest/run.sh +++ b/Runner/suites/Performance/Tiotest/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause SCRIPT_DIR="$( cd "$(dirname "$0")" || exit 1 pwd diff --git a/Runner/suites/Performance/resource-tuner/README.md b/Runner/suites/Performance/resource-tuner/README.md index 5f34f03d..026a625d 100644 --- a/Runner/suites/Performance/resource-tuner/README.md +++ b/Runner/suites/Performance/resource-tuner/README.md @@ -161,5 +161,5 @@ The script writes the overall result to `resource-tuner.res`. The **process exit - **Very long runs** β†’ a `run_with_timeout` helper (if available in your repo toolchain) will be used automatically. ## License -- SPDX-License-Identifier: BSD-3-Clause-Clear +- SPDX-License-Identifier: BSD-3-Clause - (C) Qualcomm Technologies, Inc. and/or its subsidiaries. diff --git a/Runner/suites/Performance/resource-tuner/run.sh b/Runner/suites/Performance/resource-tuner/run.sh index 8dd5bdcf..207cb775 100755 --- a/Runner/suites/Performance/resource-tuner/run.sh +++ b/Runner/suites/Performance/resource-tuner/run.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# resource-tuner test runner (pinned whitelist) +# SPDX-License-Identifier: BSD-3-Clause# resource-tuner test runner (pinned whitelist) # ---------- Repo env + helpers ---------- SCRIPT_DIR="$( diff --git a/Runner/utils/audio_common.sh b/Runner/utils/audio_common.sh index 2dc53599..1b1b7bc3 100755 --- a/Runner/utils/audio_common.sh +++ b/Runner/utils/audio_common.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Common audio helpers for PipeWire / PulseAudio runners. +# SPDX-License-Identifier: BSD-3-Clause# Common audio helpers for PipeWire / PulseAudio runners. # Requires: functestlib.sh (log_* helpers, extract_tar_from_url, scan_dmesg_errors) # ---------- Backend detection & daemon checks ---------- diff --git a/Runner/utils/basics.sh b/Runner/utils/basics.sh index 6a1d99a2..df2330fd 100755 --- a/Runner/utils/basics.sh +++ b/Runner/utils/basics.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Import test suite definitions . "${PWD}"/init_env diff --git a/Runner/utils/camera/lib_camera.sh b/Runner/utils/camera/lib_camera.sh index 6955a4d1..7897317a 100755 --- a/Runner/utils/camera/lib_camera.sh +++ b/Runner/utils/camera/lib_camera.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Shared libcamera helpers +# SPDX-License-Identifier: BSD-3-Clause# Shared libcamera helpers # ---------- Sensor & index helpers ---------- # Return the number of sensors visible in `cam -l` diff --git a/Runner/utils/camera/parse_media_topology.py b/Runner/utils/camera/parse_media_topology.py index bd30c5b9..ac10718a 100755 --- a/Runner/utils/camera/parse_media_topology.py +++ b/Runner/utils/camera/parse_media_topology.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause import sys import re import subprocess diff --git a/Runner/utils/functestlib.sh b/Runner/utils/functestlib.sh index db72d415..abc55efe 100755 --- a/Runner/utils/functestlib.sh +++ b/Runner/utils/functestlib.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # --- Logging helpers --- log() { level=$1 diff --git a/Runner/utils/lib_bluetooth.sh b/Runner/utils/lib_bluetooth.sh index a42ac9b8..02589445 100755 --- a/Runner/utils/lib_bluetooth.sh +++ b/Runner/utils/lib_bluetooth.sh @@ -1,8 +1,7 @@ #!/bin/sh # lib_bluetooth.sh - Bluetooth-specific helpers split out from functestlib.sh # Copyright (c) Qualcomm Technologies, Inc. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # This file is meant to be sourced *after* init_env and functestlib.sh: # . "$TOOLS/functestlib.sh" # . "$TOOLS/lib_bluetooth.sh" @@ -22,17 +21,17 @@ bt_has_controller() { # stdout: first controller MAC from `bluetoothctl list` (e.g. 00:00:00:00:5A:AD) # return: 0 if found and printed, 1 if no controller line found bt_first_mac() { - bluetoothctl list 2>/dev/null \ - | sanitize_bt_output \ - | awk ' - { - # strip CR, defensive - } - tolower($1) == "controller" { - print $2; - exit - } - ' + out="$(bluetoothctl list 2>/dev/null | sanitize_bt_output || true)" + + if ! printf '%s\n' "$out" | grep -qi '^[[:space:]]*Controller[[:space:]]'; then + # mark fallback (so btctl_script logs the interactive mode message once) + BTCTLINTERACTIVEFALLBACK=1 + out="$(btctl_script "list" "quit" | sanitize_bt_output || true)" + fi + + printf '%s\n' "$out" | awk ' + tolower($1) == "controller" { print $2; exit } + ' } # Remove paired BT device by MAC @@ -766,25 +765,119 @@ hascmd() { command -v "$1" >/dev/null 2>&1; } sanitize_bt_output() { # Strip CR (\r) from bluetoothctl / expect output. # Ignore EPIPE when the downstream command (awk/grep) exits early. - tr -d '\r' 2>/dev/null || true + #tr -d '\r' 2>/dev/null || true + tr -d '\r' \ + | sed 's/\x1B\[[0-9;?]*[ -/]*[@-~]//g' \ + | tr -cd '\11\12\15\40-\176' +} + +# ret: 0=controller visible in *non-interactive* "bluetoothctl list", 1=none +btcontrollerpresentplain() { + if command -v timeout >/dev/null 2>&1; then + timeout 2 bluetoothctl list 2>/dev/null \ + | sanitize_bt_output \ + | grep -qi '^[[:space:]]*Controller[[:space:]]' + return $? + fi + + bluetoothctl list 2>/dev/null \ + | sanitize_bt_output \ + | grep -qi '^[[:space:]]*Controller[[:space:]]' +} + +# Log useful diagnostics when bluetoothctl list/controller visibility is flaky. +btloghcidiag() { + adapter="${1:-}" + + log_warn "Bluetooth diagnostics: controller visibility is inconsistent" + + if [ -n "$adapter" ]; then + log_warn "Adapter: $adapter" + fi + + if command -v hciconfig >/dev/null 2>&1; then + out="$(hciconfig 2>/dev/null || true)" + if [ -z "$out" ]; then + log_warn "hciconfig output is empty (HCI attach may be incomplete). Check bluetooth.service + journalctl." + else + log_warn "hciconfig output:" + printf '%s\n' "$out" | sanitize_bt_output | sed 's/^/[BT-DIAG] /' + fi + else + log_warn "hciconfig not found; cannot dump HCI state" + fi + + if command -v systemctl >/dev/null 2>&1; then + log_warn "systemctl status bluetooth:" + systemctl status bluetooth --no-pager 2>/dev/null | sed 's/^/[BT-DIAG] /' || true + else + log_warn "systemctl not found; cannot dump bluetooth.service status" + fi + + if command -v journalctl >/dev/null 2>&1; then + log_warn "journalctl -u bluetooth -b (tail):" + journalctl -u bluetooth -b --no-pager 2>/dev/null | tail -n 60 | sed 's/^/[BT-DIAG] /' || true + else + log_warn "journalctl not found; cannot dump bluetooth logs" + fi +} + +# Warn+diag once per run if "bluetoothctl list" is empty in non-interactive mode. +btwarniflistempty() { + adapter="${1:-}" + + if [ -n "${BTWARNEDLISTEMPTY:-}" ]; then + return 0 + fi + + if btcontrollerpresentplain; then + return 0 + fi + + BTWARNEDLISTEMPTY=1 + + log_warn "bluetoothctl list returned no controllers in non-interactive mode." + log_warn "On minimal/ramdisk images this can be normal; interactive bluetoothctl may still work." + log_info "Proceeding with interactive bluetoothctl for controller queries (non-interactive output incomplete on some images)." + + btloghcidiag "$adapter" + return 1 } # Run bluetoothctl with a list of commands. # Each argument becomes one line; callers can also pass a single # multi-line string if they prefer. btctl_script() { - # If nothing to send, do nothing if [ "$#" -eq 0 ]; then return 0 fi - + + # Log once per run when we actually end up using interactive bluetoothctl + # (Gate it via BTCTLINTERACTIVEFALLBACK so it prints only on the fallback path) + if [ "${BTCTLINTERACTIVEFALLBACK:-0}" = "1" ] && [ -z "${BTINTERACTIVEMODELOGGED:-}" ]; then + log_info "Proceeding with interactive bluetoothctl for controller queries (non-interactive output incomplete on some images)." + BTINTERACTIVEMODELOGGED=1 + fi + + if command -v timeout >/dev/null 2>&1; then + { + for line in "$@"; do + [ -n "$line" ] || continue + printf '%s\n' "$line" + sleep 0.2 + done + sleep 1 + } | timeout 6 bluetoothctl 2>/dev/null + return $? + fi + { - # Each argument is printed as a separate line for line in "$@"; do - # Skip empty arguments to be safe [ -n "$line" ] || continue printf '%s\n' "$line" + sleep 0.2 done + sleep 1 } | bluetoothctl 2>/dev/null } @@ -794,56 +887,104 @@ btctl_script() { # which matches the manual "bluetoothctl ; scan on" usage. # - Non-expect, pure CLI. bt_set_scan() { - want="${1:-}" - # adapter="${2:-}" # currently unused but kept for API compatibility - - case "$want" in + mode="$1" + # $2 (adapter) is currently unused but kept for API compatibility. + # adapter="${2:-}" + + [ -n "$mode" ] || return 2 + + case "$mode" in on) - log_info "Enabling scan via 'bluetoothctl scan on'" - if ! printf 'scan on\n' | bluetoothctl >/dev/null 2>&1; then - log_warn "bt_set_scan(on): bluetoothctl scan on failed" - return 1 + timeout="${BT_SCAN_ON_TIMEOUT:-15}" + + if command -v log_info >/dev/null 2>&1; then + log_info "bt_set_scan(on): running 'bluetoothctl --timeout $timeout scan on'" + fi + + out="$(bluetoothctl --timeout "$timeout" scan on 2>&1 || true)" + + if command -v sanitize_bt_output >/dev/null 2>&1 && \ + command -v log_info >/dev/null 2>&1; then + printf '%s\n' "$out" | sanitize_bt_output | while IFS= read -r line; do + [ -n "$line" ] && log_info " [scan on] $line" + done + fi + + # Success marker + if printf '%s\n' "$out" | grep -q "Discovery started"; then + sleep 1 + return 0 fi + + # Soft-fail (caller decides), but try interactive fallback once + out2="$(btctl_script "scan on" "quit" 2>/dev/null | sanitize_bt_output || true)" + if printf '%s\n' "$out2" | grep -q "Discovery started"; then + sleep 1 + return 0 + fi + + sleep 1 + return 1 ;; - off) - timeout="${BT_SCAN_OFF_TIMEOUT:-5}" - - if command -v log_info >/dev/null 2>&1; then - log_info "bt_set_scan(off): running 'bluetoothctl --timeout $timeout scan off'" - fi - - out="$(bluetoothctl --timeout "$timeout" scan off 2>&1 || true)" - - if command -v sanitize_bt_output >/dev/null 2>&1 && \ - command -v log_info >/dev/null 2>&1; then - printf '%s\n' "$out" | sanitize_bt_output | while IFS= read -r line; do - [ -n "$line" ] && log_info " [scan off] $line" - done - fi - - # Consider both "Discovery stopped" and "Failed to stop discovery" - # (already stopped) as success. - if printf '%s\n' "$out" | grep -q "Discovery stopped"; then - return 0 - fi - if printf '%s\n' "$out" | grep -q "Failed to stop discovery"; then - log_info "bt_set_scan(off): discovery was already stopped, treating as success" - return 0 - fi - - return 1 - ;; - - + + off) + timeout="${BT_SCAN_OFF_TIMEOUT:-5}" + + if command -v log_info >/dev/null 2>&1; then + log_info "bt_set_scan(off): running 'bluetoothctl --timeout $timeout scan off'" + fi + + out="$(bluetoothctl --timeout "$timeout" scan off 2>&1 || true)" + + if command -v sanitize_bt_output >/dev/null 2>&1 && \ + command -v log_info >/dev/null 2>&1; then + printf '%s\n' "$out" | sanitize_bt_output | while IFS= read -r line; do + [ -n "$line" ] && log_info " [scan off] $line" + done + fi + + # Treat "already stopped" as success too + if printf '%s\n' "$out" | grep -q "Discovery stopped"; then + sleep 1 + return 0 + fi + if printf '%s\n' "$out" | grep -qi "Failed to stop discovery"; then + if command -v log_info >/dev/null 2>&1; then + log_info "bt_set_scan(off): discovery already stopped, treating as success" + fi + sleep 1 + return 0 + fi + + # Fallback: interactive bluetoothctl (needed on minimal/ramdisk) + if command -v log_warn >/dev/null 2>&1; then + log_warn "bt_set_scan(off): non-interactive scan off did not confirm stop; falling back to interactive bluetoothctl." + fi + + out2="$(btctl_script "scan off" "quit" 2>/dev/null | sanitize_bt_output || true)" + if printf '%s\n' "$out2" | grep -q "Discovery stopped"; then + sleep 1 + return 0 + fi + if printf '%s\n' "$out2" | grep -qi "Failed to stop discovery"; then + if command -v log_info >/dev/null 2>&1; then + log_info "bt_set_scan(off): discovery already stopped, treating as success" + fi + sleep 1 + return 0 + fi + + sleep 1 + return 1 + ;; + *) - log_warn "bt_set_scan: invalid argument '$want' (expected on/off)" + if command -v log_warn >/dev/null 2>&1; then + log_warn "bt_set_scan: unsupported mode '$mode' (expected on|off)" + fi return 2 ;; esac - - # Give BlueZ a very short moment to apply the change - sleep 1 - return 0 } rfkillunblocksysfs() { @@ -906,17 +1047,54 @@ btgetbdaddr() { # ret: 0=controller visible, 1=none btcontrollerpresent() { - # Use plain bluetoothctl list here; the expect wrapper is overkill and - # sometimes swallows the "Controller ..." line for pipelines. - if bluetoothctl list 2>/dev/null \ - | sanitize_bt_output \ - | grep -qi '^[[:space:]]*Controller[[:space:]]' - then - return 0 + # Fast path: cheap one-shot (works on some builds) + if command -v timeout >/dev/null 2>&1; then + if timeout 2 bluetoothctl list 2>/dev/null \ + | sanitize_bt_output \ + | grep -qi '^[[:space:]]*Controller[[:space:]]' + then + return 0 + fi + else + if bluetoothctl list 2>/dev/null \ + | sanitize_bt_output \ + | grep -qi '^[[:space:]]*Controller[[:space:]]' + then + return 0 + fi + fi + + # Announce fallback once per process (prevents log spam across loops/calls) + if [ -z "${BTCTLINTERACTIVEFALLBACK:-}" ]; then + log_warn "bluetoothctl list returned no controllers in non-interactive mode." + log_warn "On minimal/ramdisk images this can be normal; interactive bluetoothctl may still work." + log_info "Proceeding with interactive bluetoothctl for controller queries (non-interactive output incomplete on some images)." + BTCTLINTERACTIVEFALLBACK=1 fi + + # Robust path: interactive list+quit, retry for async BlueZ readiness + i=0 + maxwait=15 + while [ "$i" -lt "$maxwait" ]; do + if btctl_script "list" "quit" \ + | sanitize_bt_output \ + | grep -qi '^[[:space:]]*Controller[[:space:]]' + then + return 0 + fi + sleep 1 + i=$((i + 1)) + done + return 1 } +# ret: 0=controller visible, 1=not visible +# This is just a clearer alias/wrapper if you prefer the name. +bt_controller_visible() { + btcontrollerpresent +} + # Usage: btensurepublicaddr hci0 # Logic: # - If bluetoothctl already sees a Controller -> no-op (no expect) @@ -929,12 +1107,11 @@ btensurepublicaddr() { dev="${1:-}" # Already visible: nothing to do. - if btcontrollerpresent; then + if btcontrollerpresent || bt_controller_visible "$dev"; then log_info "controller already visible via bluetoothctl, skip public-addr" return 0 fi - # Read BD address and sanitize to a single MAC token mac="$( btgetbdaddr "$dev" 2>/dev/null \ | head -n 1 \ @@ -948,17 +1125,16 @@ btensurepublicaddr() { log_info "applying bluetoothctl public-addr $mac" - # Drive bluetoothctl menu mgmt non-interactively (no expect) btctl_script "menu mgmt public-addr $mac back quit" >/dev/null 2>&1 || true - # --- NEW: poll for controller visibility (handle BlueZ async delay) --- + # Poll for controller visibility (BlueZ can be async) i=0 - max_wait=5 # seconds + max_wait=15 # was 5; 15 is still small but avoids flakiness while [ "$i" -lt "$max_wait" ]; do - if btcontrollerpresent; then + if btcontrollerpresent || bt_controller_visible "$dev"; then log_info "controller visible after public-addr $mac (waited ${i}s)" return 0 fi @@ -970,6 +1146,63 @@ quit" >/dev/null 2>&1 || true return 1 } +btcontrollervisible() { + # Usage: + # btcontrollervisible + # btcontrollervisible hci0 + # btcontrollervisible 00:11:22:33:44:55 + # + # Returns: 0 if controller visible to bluetoothctl, else 1 + + arg="${1:-}" + addr="" + dev="" + out="" + + # Normalize arg + case "$arg" in + hci[0-9]*) + dev="$arg" + if [ -r "/sys/class/bluetooth/$dev/address" ]; then + addr="$(cat "/sys/class/bluetooth/$dev/address" 2>/dev/null || true)" + fi + ;; + *:*:*:*:*:*) + addr="$arg" + ;; + *) + ;; + esac + + btctlrun() { + if command -v timeout >/dev/null 2>&1; then + timeout 2 bluetoothctl "$@" 2>/dev/null || true + else + bluetoothctl "$@" 2>/dev/null || true + fi + } + + # bluetoothctl list + out="$(btctlrun list)" + if [ -n "$out" ]; then + if [ -n "$addr" ]; then + printf '%s\n' "$out" | grep -qi "$addr" && return 0 + fi + printf '%s\n' "$out" | grep -q '^Controller ' && return 0 + fi + + # bluetoothctl show + out="$(btctlrun show)" + if [ -n "$out" ]; then + if [ -n "$addr" ]; then + printf '%s\n' "$out" | grep -qi "$addr" && return 0 + fi + printf '%s\n' "$out" | grep -q '^Controller ' && return 0 + fi + + return 1 +} + # Ensure at least one controller is visible to bluetoothctl. # Optionally takes an adapter name (e.g. hci0) to use for public-addr. # Usage: @@ -982,7 +1215,7 @@ bt_ensure_controller_visible() { adapter="${1:-}" # Fast path: already visible - if btcontrollerpresent; then + if btcontrollerpresent || bt_controller_visible "$adapter"; then return 0 fi @@ -1002,13 +1235,14 @@ bt_ensure_controller_visible() { fi # Final controller visibility check - if btcontrollerpresent; then + if btcontrollerpresent || bt_controller_visible "$adapter"; then return 0 fi return 1 } + # Resolve a controller handle we can safely use with `bluetoothctl select`. # Input: "hci0" or "MAC". Output: MAC address suitable for `select`. bt_resolve_controller_id() { @@ -1185,82 +1419,6 @@ bt_set_power() { return 1 } -# Set controller scan state using bluetoothctl, with an internal timeout -# and logging. This wraps the standalone working pattern: -# bluetoothctl --timeout 15 scan on -# bluetoothctl --timeout 5 scan off -# -# Usage: -# bt_set_scan on [adapter] -# bt_set_scan off [adapter] -# -# Returns: -# 0 on "reasonable success", non-zero on clear error. Caller still -# validates devices list / discovering state for real PASS/FAIL. -bt_set_scan() { - mode="$1" - # $2 (adapter) is currently unused here but kept for API compatibility. - - if [ -z "$mode" ]; then - # Invalid usage - return 2 - fi - - case "$mode" in - on) - timeout="${BT_SCAN_ON_TIMEOUT:-15}" - - # Informative log if logging helpers are available - if command -v log_info >/dev/null 2>&1; then - log_info "bt_set_scan(on): running 'bluetoothctl --timeout $timeout scan on'" - fi - - out="$(bluetoothctl --timeout "$timeout" scan on 2>&1 || true)" - - # Optional: pretty log of the scan-on output - if command -v sanitize_bt_output >/dev/null 2>&1 && \ - command -v log_info >/dev/null 2>&1; then - printf '%s\n' "$out" | sanitize_bt_output | while IFS= read -r line; do - [ -n "$line" ] && log_info " [scan on] $line" - done - fi - - # Treat it as success if we at least see Discovery started - printf '%s\n' "$out" | grep -q "Discovery started" && return 0 - # Otherwise soft-fail: caller still decides based on devices list. - return 1 - ;; - - off) - timeout="${BT_SCAN_OFF_TIMEOUT:-5}" - - if command -v log_info >/dev/null 2>&1; then - log_info "bt_set_scan(off): running 'bluetoothctl --timeout $timeout scan off'" - fi - - out="$(bluetoothctl --timeout "$timeout" scan off 2>&1 || true)" - - if command -v sanitize_bt_output >/dev/null 2>&1 && \ - command -v log_info >/dev/null 2>&1; then - printf '%s\n' "$out" | sanitize_bt_output | while IFS= read -r line; do - [ -n "$line" ] && log_info " [scan off] $line" - done - fi - - # If Discovery stopped shows up, good. - printf '%s\n' "$out" | grep -q "Discovery stopped" && return 0 - return 1 - ;; - - *) - if command -v log_warn >/dev/null 2>&1; then - log_warn "bt_set_scan: unsupported mode '$mode' (expected on|off)" - fi - return 2 - ;; - esac -} - # Query Discovering state via 'bluetoothctl show'. # Prints: yes|no|unknown # Return: @@ -1281,6 +1439,22 @@ bt_is_discovering() { ' )" + # Fallback: interactive bluetoothctl (needed on minimal/ramdisk) + if [ -z "$val" ]; then + out="$(btctl_script "show" "quit" 2>/dev/null | sanitize_bt_output || true)" + val="$( + printf '%s\n' "$out" \ + | awk -F':[[:space:]]*' ' + /^[[:space:]]*Discovering:/ { + v = tolower($2); + gsub(/[[:space:]\r]+/, "", v); + print v; + exit + } + ' + )" + fi + if [ -z "$val" ]; then printf '%s\n' "unknown" return 1 @@ -1379,7 +1553,18 @@ bt_wait_discovering() { # Raw devices output from bluetoothctl bt_list_devices_raw() { - bluetoothctl devices 2>/dev/null | sanitize_bt_output + out="$(bluetoothctl devices 2>/dev/null | sanitize_bt_output || true)" + + if [ -z "$out" ]; then + # If controller list is already known-flaky, mark fallback so btctl_script logs once. + if ! btcontrollerpresentplain; then + BTCTLINTERACTIVEFALLBACK=1 + fi + + out="$(btctl_script "devices" "quit" | sanitize_bt_output || true)" + fi + + printf '%s\n' "$out" } # Check whether devices are seen, optionally for a specific MAC. @@ -1550,14 +1735,36 @@ bt_check_connected() { btgetpower() { dev="${1-}" state="" - - # Prefer adapter-specific show if provided + mac="" + + # If a specific adapter is provided (e.g. hci0), resolve to BDADDR and use "show " + # because "select hci0" is unreliable on some minimal/ramdisk setups. if [ -n "$dev" ]; then - out="$(bluetoothctl show "$dev" 2>/dev/null | sanitize_bt_output || true)" + mac="$( + btgetbdaddr "$dev" 2>/dev/null \ + | head -n 1 \ + | awk '{print $NF}' + )" + fi + + if [ -n "$mac" ]; then + out="$( + { + printf 'show %s\n' "$mac" + sleep 1 + printf 'quit\n' + } | bluetoothctl 2>/dev/null | sanitize_bt_output || true + )" else - out="$(bluetoothctl show 2>/dev/null | sanitize_bt_output || true)" + out="$( + { + printf 'show\n' + sleep 1 + printf 'quit\n' + } | bluetoothctl 2>/dev/null | sanitize_bt_output || true + )" fi - + state="$(printf '%s\n' "$out" \ | awk -F':[[:space:]]*' ' /^[[:space:]]*Powered:/ { @@ -1568,10 +1775,16 @@ btgetpower() { exit } ')" - - # Fallback: try default controller if adapter one failed + + # Fallback: try default controller if adapter-specific attempt didn’t yield Powered: if [ -z "$state" ]; then - out="$(bluetoothctl show 2>/dev/null | sanitize_bt_output || true)" + out="$( + { + printf 'show\n' + sleep 1 + printf 'quit\n' + } | bluetoothctl 2>/dev/null | sanitize_bt_output || true + )" state="$(printf '%s\n' "$out" \ | awk -F':[[:space:]]*' ' /^[[:space:]]*Powered:/ { @@ -1583,17 +1796,16 @@ btgetpower() { } ')" fi - + [ -n "$state" ] || return 2 - + if [ "$state" = "yes" ] || [ "$state" = "no" ]; then printf '%s\n' "$state" return 0 fi - + return 2 } - # Usage: btpower hci0 on|off # Returns: # 0 = requested state achieved (including when already in that state) @@ -1612,7 +1824,6 @@ btpower() { ;; esac - # ---- Early check: avoid redundant toggles ---- cur_state="$(btgetpower "$dev" 2>/dev/null || true)" [ -z "$cur_state" ] && cur_state="unknown" @@ -1628,35 +1839,19 @@ btpower() { log_info "btpower: requesting '$want' on $dev (current=$cur_state)" - # ---- Existing behaviour: drive HCI or bluetoothctl, then poll ---- - if [ -n "$dev" ] && command -v hciconfig >/dev/null 2>&1; then - case "$want" in - on) - hciconfig "$dev" up >/dev/null 2>&1 || true - ;; - off) - hciconfig "$dev" down >/dev/null 2>&1 || true - ;; - esac - else - # Fallback: drive via bluetoothctl main menu (no 'select hci0' β€” that breaks) - printf 'power %s\nquit\n' "$want" | bluetoothctl >/dev/null 2>&1 || true - fi + # Drive bluetoothctl interactively (works on ramdisk where non-interactive list/show may be empty) + # Do NOT use "select hci0" (it can say "Controller hci0 not available" even when controller exists). + btctl_script "power $want" "quit" >/dev/null 2>&1 || true - # Now poll btgetpower a few times to see if BlueZ agrees i=0 - max_tries=5 + max_tries=10 state="" + pstate="" + while [ "$i" -lt "$max_tries" ]; do + # Read Powered via btgetpower (must be interactive-based implementation) state="$(btgetpower "$dev" 2>/dev/null || true)" - # Could not read state at all β†’ try again briefly - if [ -z "$state" ]; then - sleep 1 - i=$((i + 1)) - continue - fi - if [ "$want" = "on" ] && [ "$state" = "yes" ]; then log_info "btpower: $dev Powered=yes after request." return 0 @@ -1667,19 +1862,39 @@ btpower() { return 0 fi - # Mismatch, give BlueZ a moment more + # If Powered line is not available yet, try to parse PowerState as an informational fallback + # (Some stacks lag on Powered; PowerState can show transitions like off-enabling/on-disabling.) + out="$( + { + printf 'show\n' + sleep 1 + printf 'quit\n' + } | bluetoothctl 2>/dev/null | sanitize_bt_output || true + )" + + pstate="$(printf '%s\n' "$out" \ + | awk -F':[[:space:]]*' ' + /^[[:space:]]*PowerState:/ { + v = tolower($2); + gsub(/\r/, "", v); + gsub(/[[:space:]]+/, "", v); + print v; + exit + }')" + + # If Powered was empty but PowerState suggests we reached a stable end state, + # keep waiting a little more for Powered to update (do not treat pstate as PASS alone). sleep 1 i=$((i + 1)) done - # After polling, decide error type if [ -z "$state" ]; then - log_warn "btpower: unable to read Powered state for $dev after request." - return 2 # unknown / no Powered line + log_warn "btpower: unable to read Powered state for $dev after request. (PowerState last='$pstate')" + return 2 fi - log_warn "btpower: $dev state after request is '$state' (wanted $want)." - return 1 # we read a state but it never matched the target + log_warn "btpower: $dev state after request is '$state' (wanted $want). (PowerState last='$pstate')" + return 1 } btfwpresent() { @@ -1855,10 +2070,8 @@ bt_scan_poll_on() { if [ "$disc_state" = "yes" ]; then seen_disc_yes=1 fi - - devices_out="$( - bluetoothctl devices 2>/dev/null | sanitize_bt_output || true - )" + + devices_out="$(bt_list_devices_raw || true)" devices_snapshot="$devices_out" if [ -n "$target_mac" ]; then @@ -1923,6 +2136,9 @@ bt_scan_poll_off() { attempts=$((max_wait_secs / step_secs)) [ "$attempts" -lt 1 ] && attempts=1 + saw_yes=0 + saw_unknown=0 + i=0 while [ "$i" -lt "$attempts" ]; do disc_state="$(bt_is_discovering 2>/dev/null || printf '%s\n' "unknown")" @@ -1931,11 +2147,25 @@ bt_scan_poll_off() { if [ "$disc_state" = "no" ]; then return 0 fi + if [ "$disc_state" = "yes" ]; then + saw_yes=1 + fi + if [ "$disc_state" = "unknown" ]; then + saw_unknown=1 + fi i=$((i + 1)) sleep "$step_secs" done + # Small tweak: + # If we never saw Discovering=yes and state reporting is always unknown (common on minimal/ramdisk), + # treat scan-off as best-effort success to avoid flakiness/noisy warnings. + if [ "$saw_unknown" -eq 1 ] && [ "$saw_yes" -eq 0 ]; then + log_warn "Discovering state stayed 'unknown' during scan OFF polling; treating scan-off as best-effort success." + return 0 + fi + log_warn "Discovering did not settle to 'no' within scan OFF polling window." return 1 } diff --git a/Runner/utils/lib_display.sh b/Runner/utils/lib_display.sh index 6bc205b1..8f187799 100755 --- a/Runner/utils/lib_display.sh +++ b/Runner/utils/lib_display.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -############################################################################### +# SPDX-License-Identifier: BSD-3-Clause############################################################################### # DRM display + Weston + Wayland helpers # (assumes log_info/log_warn/log_error and run_with_timeout from functestlib.sh) ############################################################################### diff --git a/Runner/utils/lib_gstreamer.sh b/Runner/utils/lib_gstreamer.sh index 95b90f19..579bb263 100755 --- a/Runner/utils/lib_gstreamer.sh +++ b/Runner/utils/lib_gstreamer.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# +# SPDX-License-Identifier: BSD-3-Clause# # Runner/utils/lib_gstreamer.sh # # GStreamer helpers. diff --git a/Runner/utils/lib_performance.sh b/Runner/utils/lib_performance.sh index def6997f..4c2ea233 100755 --- a/Runner/utils/lib_performance.sh +++ b/Runner/utils/lib_performance.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Common performance-related helpers for KPI-style tests. +# SPDX-License-Identifier: BSD-3-Clause# Common performance-related helpers for KPI-style tests. # --------------------------------------------------------------------------- # Logging fallback (avoid repeated command -v checks) diff --git a/Runner/utils/lib_video.sh b/Runner/utils/lib_video.sh index 31086b78..69c31238 100755 --- a/Runner/utils/lib_video.sh +++ b/Runner/utils/lib_video.sh @@ -1,7 +1,6 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -# Common, POSIX-compliant helpers for Qualcomm video stack selection and V4L2 testing. +# SPDX-License-Identifier: BSD-3-Clause# Common, POSIX-compliant helpers for Qualcomm video stack selection and V4L2 testing. # Requires functestlib.sh: log_info/log_warn/log_pass/log_fail/log_skip, # check_dependencies, extract_tar_from_url, (optional) run_with_timeout, ensure_network_online. diff --git a/Runner/utils/platform.sh b/Runner/utils/platform.sh index b3bc8b4f..fcd74595 100755 --- a/Runner/utils/platform.sh +++ b/Runner/utils/platform.sh @@ -2,8 +2,7 @@ # Intentionally not defining shell. # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear - +# SPDX-License-Identifier: BSD-3-Clause # Detect Android userland ANDROID_PATH=/system/build.prop if [ -f $ANDROID_PATH ]; then diff --git a/Runner/utils/result_parse.sh b/Runner/utils/result_parse.sh index 58c4f832..f3ef322d 100755 --- a/Runner/utils/result_parse.sh +++ b/Runner/utils/result_parse.sh @@ -1,8 +1,7 @@ #!/bin/sh # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -# SPDX-License-Identifier: BSD-3-Clause-Clear -echo "Current working directory is $PWD" +# SPDX-License-Identifier: BSD-3-Clauseecho "Current working directory is $PWD" find . -type f -name "*.res" 2>/dev/null | while IFS= read res_file; do echo "$res_file" diff --git a/Runner/utils/send-to-lava.sh b/Runner/utils/send-to-lava.sh index 394d520e..6cebc36c 100755 --- a/Runner/utils/send-to-lava.sh +++ b/Runner/utils/send-to-lava.sh @@ -1,8 +1,7 @@ #!/bin/sh #Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. -#SPDX-License-Identifier: BSD-3-Clause-Clear - +#SPDX-License-Identifier: BSD-3-Clause RESULT_FILE="$1" SIGNAL_FILE="/tmp/lava_signals_$$.log" diff --git a/host-tools/SuspendResume/README.md b/host-tools/SuspendResume/README.md new file mode 100644 index 00000000..a5125286 --- /dev/null +++ b/host-tools/SuspendResume/README.md @@ -0,0 +1,280 @@ +# SuspendResume Validation Test +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause-Clear + +## Overview +This test case validates the system suspend/resume functionality on the target device using ADB-based remote control. It triggers a suspend cycle, waits for the device to resume, and validates the suspend/resume operation through multiple checks including suspend statistics, kernel logs, and Qualcomm-specific power management statistics. + +## Test Performs: +1. Performs device reboot to ensure adb functionality after Renesas firmware flash + - Syncs filesystem + - Executes reboot + - Waits for device to complete reboot (30s) +2. Waits for adb device detection (30s timeout) + - Uses non-blocking checks + - Skips test if device not detected within timeout +3. Connects to device via ADB and obtains root access +4. Remounts filesystems as read-write +3. Mounts debugfs for accessing kernel statistics +4. Captures initial suspend count from `/sys/power/suspend_stats/success` +5. Triggers suspend using `rtcwake` (30-second timer) and `systemctl suspend` +6. Waits for device to resume (40-second timeout) +7. Validates suspend/resume cycle through three checks: + - **Check 1**: Verifies suspend count incremented + - **Check 2**: Verifies suspend entry markers in dmesg + - **Check 3**: Verifies resume markers in dmesg +8. Collects comprehensive debug statistics: + - Kernel suspend statistics + - Qualcomm power management statistics (AOSD, ADSP, CDSP, DDR, CXSD) + - Complete qcom_stats and suspend_stats dumps + +## Usage + +### Directory Structure +This test is located in the `host-tools` directory structure: +``` +qcom-linux-testkit/ +β”œβ”€β”€ Runner/ # Main test framework +β”‚ β”œβ”€β”€ utils/ # Shared utilities (functestlib.sh, etc.) +β”‚ └── suites/ # Standard test suites +└── host-tools/ # Host-based tests (ADB, remote control) + β”œβ”€β”€ init_env # Environment setup (finds Runner/utils) + β”œβ”€β”€ run-test.sh # Test orchestrator for host-tools tests + └── SuspendResume/ # This test + β”œβ”€β”€ run.sh + β”œβ”€β”€ README.md + └── SuspendResume.yaml +``` + +### Running the Test + +#### Method 1: Direct Execution (Recommended for LAVA) +```sh +cd host-tools/SuspendResume +./run.sh +``` + +#### Method 2: Using Test Orchestrator +```sh +cd host-tools +./run-test.sh SuspendResume +``` + +#### Method 3: Run All Host-Tools Tests +```sh +cd host-tools +./run-test.sh all +``` + +### Quick Example +```sh +git clone +cd + +# Ensure exactly one device is connected +adb devices + +# Run the test +cd host-tools/SuspendResume +./run.sh +``` + +**Note:** The test requires exactly one ADB device to be connected. If multiple devices are detected, the test will skip with an error message. + +--- + +## Prerequisites +1. **ADB**: The `adb` command must be available on the host machine +2. **Single Device Connection**: Exactly one target device must be connected via ADB + - The test will automatically detect and validate device count + - Multiple devices will cause the test to skip with an error message +3. **Root Access**: Device must allow `adb root` for root access +4. **Kernel Support**: Device must support: + - `rtcwake` command for RTC-based wakeup + - `systemctl suspend` for triggering suspend + - Suspend statistics in `/sys/power/suspend_stats/` + - Debugfs support for accessing kernel debug information +5. **RTC Device**: `/dev/rtc0` must be present and functional +6. **Framework Files**: `init_env` and `functestlib.sh` must be present and correctly configured + +## Configuration +The test uses the following default configuration (can be modified in run.sh): +```sh +SUSPEND_DURATION=30 # seconds to suspend +WAIT_TIMEOUT=40 # seconds to wait for device to resume +``` + +## Result Format +Test result will be saved in `SuspendResume.res` as: + +## Output +A .res file is generated in the same directory: +- `SuspendResume PASS` - All validation checks passed +- `SuspendResume FAIL` - One or more validation checks failed +- `SuspendResume SKIP` - ADB not available or prerequisites not met + +## Validation Checks + +### Check 1: Suspend Count Increment +Verifies that `/sys/power/suspend_stats/success` incremented after suspend/resume cycle. + +### Check 2: Suspend Entry Markers +Searches dmesg for suspend entry indicators: +- `PM: suspend entry` +- `Freezing user space processes` + +### Check 3: Resume Markers +Searches dmesg for resume indicators: +- `PM: suspend exit` +- `Restarting tasks` + +## Debug Statistics Collected + +The test collects comprehensive power management statistics: + +### Kernel Suspend Stats +- `/sys/kernel/debug/suspend_stats` - Overall suspend statistics + +### Qualcomm Power Stats +- `/sys/kernel/debug/qcom_stats/aosd` - Always-On Subsystem Domain stats +- `/sys/kernel/debug/qcom_stats/adsp` - Audio DSP stats +- `/sys/kernel/debug/qcom_stats/adsp_island` - ADSP Island mode stats +- `/sys/kernel/debug/qcom_stats/cdsp` - Compute DSP stats +- `/sys/kernel/debug/qcom_stats/ddr` - DDR stats +- `/sys/kernel/debug/qcom_stats/cxsd` - CX Subsystem Domain stats + +### Complete Dumps +- All entries in `/sys/kernel/debug/qcom_stats/` +- All entries in `/sys/power/suspend_stats/` + +## Skip Criteria +The test will be skipped if: +1. `adb` command is not found on the host machine +2. Device not detected within 30s timeout after reboot +3. No ADB devices are connected +4. Multiple ADB devices are connected (only one device is allowed) +5. Device is not responding to ADB commands + +## Failure Criteria +The test will fail if: +1. Device does not resume within the timeout period (40 seconds) +2. Suspend count does not increment +3. Suspend entry markers are not found in kernel log +4. Resume markers are not found in kernel log + +## Sample Log - Success +``` +[INFO] 2026-02-01 20:30:00 - ----------------------------------------------------------------------------------------- +[INFO] 2026-02-01 20:30:00 - -------------------Starting SuspendResume Testcase (ADB-based)---------------------------- +[INFO] 2026-02-01 20:30:00 - === Test Initialization === +[INFO] 2026-02-01 20:30:00 - Checking for connected ADB devices... +[INFO] 2026-02-01 20:30:01 - Detected 1 device(s) +[INFO] 2026-02-01 20:30:01 - Single device detected - proceeding with test +[INFO] 2026-02-01 20:30:01 - Waiting for device to be ready... +[INFO] 2026-02-01 20:30:02 - Obtaining root access... +[INFO] 2026-02-01 20:30:04 - Remounting filesystems as read-write... +[INFO] 2026-02-01 20:30:05 - Mounting debugfs... +[INFO] 2026-02-01 20:30:06 - Capturing pre-suspend state... +[INFO] 2026-02-01 20:30:06 - Initial suspend count: 5 +[INFO] 2026-02-01 20:30:06 - Triggering suspend for 30 seconds... +[INFO] 2026-02-01 20:30:06 - Command: rtcwake -d /dev/rtc0 -m no -s 30 && systemctl suspend +[INFO] 2026-02-01 20:30:11 - Waiting for device to resume (timeout: 40s)... +[PASS] 2026-02-01 20:30:38 - Device resumed successfully +[INFO] 2026-02-01 20:30:41 - Post-resume phase: Validating suspend/resume cycle +[INFO] 2026-02-01 20:30:42 - Current suspend count: 6 +[PASS] 2026-02-01 20:30:42 - Validation 1 PASSED: Suspend count increased from 5 to 6 +[INFO] 2026-02-01 20:30:42 - Checking for suspend entry markers in kernel log... +[PASS] 2026-02-01 20:30:43 - Validation 2 PASSED: Suspend entry markers found +[INFO] 2026-02-01 20:30:43 - Checking for resume markers in kernel log... +[PASS] 2026-02-01 20:30:44 - Validation 3 PASSED: Resume markers found +[INFO] 2026-02-01 20:30:44 - Collecting debug statistics... +[PASS] 2026-02-01 20:30:50 - SuspendResume : Test Passed - Suspend/Resume cycle completed successfully +``` + +## Sample Log - Failure (Device Not Resuming) +``` +[INFO] 2026-02-01 20:30:00 - ----------------------------------------------------------------------------------------- +[INFO] 2026-02-01 20:30:00 - -------------------Starting SuspendResume Testcase (ADB-based)---------------------------- +[INFO] 2026-02-01 20:30:00 - === Test Initialization === +[INFO] 2026-02-01 20:30:00 - Checking for connected ADB devices... +[INFO] 2026-02-01 20:30:01 - Detected 1 device(s) +[INFO] 2026-02-01 20:30:01 - Single device detected - proceeding with test +[INFO] 2026-02-01 20:30:01 - Waiting for device to be ready... +[INFO] 2026-02-01 20:30:02 - Obtaining root access... +[INFO] 2026-02-01 20:30:04 - Remounting filesystems as read-write... +[INFO] 2026-02-01 20:30:05 - Mounting debugfs... +[INFO] 2026-02-01 20:30:06 - Capturing pre-suspend state... +[INFO] 2026-02-01 20:30:06 - Initial suspend count: 5 +[INFO] 2026-02-01 20:30:06 - Triggering suspend for 30 seconds... +[INFO] 2026-02-01 20:30:06 - Command: rtcwake -d /dev/rtc0 -m no -s 30 && systemctl suspend +[INFO] 2026-02-01 20:30:11 - Waiting for device to resume (timeout: 40s)... +[INFO] 2026-02-01 20:30:16 - Still waiting... (10s elapsed) +[INFO] 2026-02-01 20:30:26 - Still waiting... (20s elapsed) +[INFO] 2026-02-01 20:30:36 - Still waiting... (30s elapsed) +[INFO] 2026-02-01 20:30:46 - Still waiting... (40s elapsed) +[FAIL] 2026-02-01 20:30:51 - SuspendResume : Device did not resume within 40s timeout +``` + +## Sample Log - Skip (Multiple Devices) +``` +[INFO] 2026-02-01 20:30:00 - ----------------------------------------------------------------------------------------- +[INFO] 2026-02-01 20:30:00 - -------------------Starting SuspendResume Testcase (ADB-based)---------------------------- +[INFO] 2026-02-01 20:30:00 - === Test Initialization === +[INFO] 2026-02-01 20:30:00 - Checking for connected ADB devices... +[INFO] 2026-02-01 20:30:01 - Detected 2 device(s) +[FAIL] 2026-02-01 20:30:01 - Multiple ADB devices connected (2 devices) - please connect only one device +[INFO] 2026-02-01 20:30:01 - Connected devices: +List of devices attached +ABC123456789 device +DEF987654321 device +``` + +## Sample Log - Skip (No Devices) +``` +[INFO] 2026-02-01 20:30:00 - ----------------------------------------------------------------------------------------- +[INFO] 2026-02-01 20:30:00 - -------------------Starting SuspendResume Testcase (ADB-based)---------------------------- +[INFO] 2026-02-01 20:30:00 - === Test Initialization === +[INFO] 2026-02-01 20:30:00 - Rebooting device to ensure adb functionality... +[INFO] 2026-02-01 20:30:33 - Waiting for device to be detected by adb (timeout: 30s)... +[WARN] 2026-02-01 20:31:03 - SuspendResume SKIP: Device not detected by adb within timeout +``` + +## Integration with LAVA +This test is designed to work with LAVA's ADB support framework. The YAML configuration file (`SuspendResume.yaml`) defines the test metadata and execution steps for LAVA integration. + +## Troubleshooting + +### Device Not Resuming +- Check if RTC device (`/dev/rtc0`) is functional +- Verify `rtcwake` command works manually +- Check if suspend is supported: `cat /sys/power/state` +- Increase `WAIT_TIMEOUT` if device takes longer to resume + +### ADB Connection Issues +- Verify device is visible: `adb devices` +- Ensure only one device is connected (disconnect other devices if multiple are shown) +- Try `adb kill-server && adb start-server` +- Check USB connection and drivers + +### Multiple Devices Connected +- The test requires exactly one device to be connected +- Disconnect all but one device before running the test +- Use `adb devices` to verify only one device is listed + +### Permission Issues +- Ensure `adb root` works on your device +- Some devices may require unlocked bootloader for root access + +### Missing Statistics +- Verify debugfs is mounted: `adb shell mount | grep debugfs` +- Check if qcom_stats are available: `adb shell ls /sys/kernel/debug/qcom_stats/` + +## Notes +- The test uses a 30-second suspend duration by default +- A 40-second timeout is used to wait for device resume +- All commands are executed remotely via ADB +- The test is non-destructive and safe to run multiple times +- Debug statistics collection is best-effort and won't fail the test if unavailable + +## License +SPDX-License-Identifier: BSD-3-Clause-Clear diff --git a/host-tools/SuspendResume/SuspendResume.yaml b/host-tools/SuspendResume/SuspendResume.yaml new file mode 100644 index 00000000..7612db0d --- /dev/null +++ b/host-tools/SuspendResume/SuspendResume.yaml @@ -0,0 +1,15 @@ +metadata: + name: SuspendResume + format: "Lava-Test Test Definition 1.0" + description: "ADB-based Suspend/Resume validation with kernel debug stats collection" + os: + - linux + scope: + - functional + +run: + steps: + - REPO_PATH=$PWD + - cd host-tools/SuspendResume + - ./run.sh || true + - $REPO_PATH/Runner/utils/send-to-lava.sh SuspendResume.res || true diff --git a/host-tools/SuspendResume/run.sh b/host-tools/SuspendResume/run.sh new file mode 100755 index 00000000..c02cdbc9 --- /dev/null +++ b/host-tools/SuspendResume/run.sh @@ -0,0 +1,304 @@ +#!/bin/sh + +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# Robustly find and source init_env +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +INIT_ENV="" +SEARCH="$SCRIPT_DIR" +while [ "$SEARCH" != "/" ]; do + if [ -f "$SEARCH/init_env" ]; then + INIT_ENV="$SEARCH/init_env" + break + fi + SEARCH=$(dirname "$SEARCH") +done + +if [ -z "$INIT_ENV" ]; then + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 + exit 1 +fi + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi + +TESTNAME="SuspendResume" +# shellcheck disable=SC2034 +res_file="./$TESTNAME.res" + +# Reboot device to ensure adb functionality after Renesas firmware flash +log_info "Rebooting device to ensure adb functionality..." +sync +sleep 2 +reboot +sleep 30 + +# Restart adb server +log_info "Restarting adb server..." +adb kill-server +sleep 2 +adb start-server +sleep 2 + +# Wait for adb to detect the device (non-blocking, 30s timeout) +log_info "Waiting for device to be detected by adb (timeout: 30s)..." + +if timeout 30s adb wait-for-device >/dev/null 2>&1; then + log_info "Device detected by adb" +else + log_warn "$TESTNAME SKIP: Device not detected by adb within timeout" + echo "SKIP" > "$res_file" + exit 0 +fi + +if [ $DEVICE_DETECTED -eq 0 ]; then + log_warn "$TESTNAME SKIP: Device not detected by adb within timeout" + echo "SKIP" > "$res_file" + exit 0 +fi + +log_info "-----------------------------------------------------------------------------------------" +log_info "-------------------Starting $TESTNAME Testcase (ADB-based)----------------------------" +log_info "=== Test Initialization ===" + +# ============================================================================ +# ADB-BASED SUSPEND/RESUME TEST +# ============================================================================ +# This version uses adb commands to control the device remotely, which is +# compatible with LAVA's upcoming adb support framework. +# ============================================================================ + +# Configuration +SUSPEND_DURATION=30 # seconds to suspend +WAIT_TIMEOUT=40 # seconds to wait for device to resume + +# Check if adb is available +if ! command -v adb >/dev/null 2>&1; then + log_fail "adb command not found - this test requires adb to be installed" + echo "$TESTNAME SKIP" > "$res_file" + exit 0 +fi + +# Check that exactly one device is connected +log_info "Checking for connected ADB devices..." + +# Count devices using grep (handles Windows line endings better than awk) +DEVICE_COUNT=$(adb devices 2>/dev/null | grep -v "List of devices" | grep "device" | wc -l | tr -d ' \t\r\n') + +# Ensure DEVICE_COUNT is a valid integer +if [ -z "$DEVICE_COUNT" ]; then + DEVICE_COUNT=0 +fi + +log_info "Detected $DEVICE_COUNT device(s)" + +if [ "$DEVICE_COUNT" -eq 0 ]; then + log_fail "No ADB devices connected - please connect a device" + echo "$TESTNAME SKIP" > "$res_file" + exit 0 +elif [ "$DEVICE_COUNT" -gt 1 ]; then + log_fail "Multiple ADB devices connected ($DEVICE_COUNT devices) - please connect only one device" + log_info "Connected devices:" + adb devices + echo "$TESTNAME SKIP" > "$res_file" + exit 0 +fi + +log_info "Single device detected - proceeding with test" +log_info "Waiting for device to be ready..." +adb wait-for-device + +# Get root access +log_info "Obtaining root access..." +adb root +sleep 2 +adb wait-for-device + +# Remount filesystems as read-write +log_info "Remounting filesystems as read-write..." +adb shell "mount -o remount,rw /" 2>/dev/null || true +adb shell "mount -o remount,rw /usr" 2>/dev/null || true + +# Mount debugfs +log_info "Mounting debugfs..." +adb shell "mount -t debugfs none /sys/kernel/debug" 2>/dev/null || true + +# ============================================================================ +# PRE-SUSPEND: Capture initial state +# ============================================================================ + +log_info "Capturing pre-suspend state..." + +# Get initial suspend count +INITIAL_SUSPEND_COUNT=$(adb shell "cat /sys/power/suspend_stats/success 2>/dev/null" | tr -d '\r\n' || echo "0") +log_info "Initial suspend count: $INITIAL_SUSPEND_COUNT" + +# Verify suspend stats are accessible +if [ -z "$INITIAL_SUSPEND_COUNT" ] || [ "$INITIAL_SUSPEND_COUNT" = "0" ]; then + log_warn "Suspend stats may not be available or this is first suspend" +fi + +# ============================================================================ +# TRIGGER SUSPEND +# ============================================================================ + +log_info "Triggering suspend for $SUSPEND_DURATION seconds..." +log_info "Command: rtcwake -d /dev/rtc0 -m no -s $SUSPEND_DURATION && systemctl suspend" + +# Execute suspend command (this will disconnect adb) +adb shell "rtcwake -d /dev/rtc0 -m no -s $SUSPEND_DURATION && systemctl suspend" & +SUSPEND_PID=$! + +# Give the suspend command time to execute +sleep 5 + +# ============================================================================ +# WAIT FOR RESUME +# ============================================================================ + +log_info "Waiting for device to resume (timeout: ${WAIT_TIMEOUT}s)..." + +# Wait for device to come back online using counter-based timeout +WAIT_COUNT=0 +DEVICE_RESUMED=0 + +while [ $WAIT_COUNT -lt $WAIT_TIMEOUT ]; do + # Try to check if device is responsive (non-blocking check) + if adb shell "echo test" >/dev/null 2>&1; then + DEVICE_RESUMED=1 + log_pass "Device resumed successfully after ${WAIT_COUNT}s" + break + fi + sleep 1 + WAIT_COUNT=$((WAIT_COUNT + 1)) + + # Log progress every 10 seconds + if [ $((WAIT_COUNT % 10)) -eq 0 ]; then + log_info "Still waiting... (${WAIT_COUNT}s elapsed)" + fi +done + +# Clean up background process +kill $SUSPEND_PID 2>/dev/null || true +wait $SUSPEND_PID 2>/dev/null || true + +if [ $DEVICE_RESUMED -eq 0 ]; then + log_fail "$TESTNAME : Device did not resume within ${WAIT_TIMEOUT}s timeout" + echo "$TESTNAME FAIL" > "$res_file" + exit 1 +fi + +# Give system a moment to stabilize after resume +sleep 3 + +# ============================================================================ +# POST-RESUME: Validate suspend/resume cycle +# ============================================================================ + +log_info "Post-resume phase: Validating suspend/resume cycle" + +# Remount debugfs again (may have been unmounted during suspend) +adb shell "mount -t debugfs none /sys/kernel/debug" 2>/dev/null || true + +# Get current suspend count +CURRENT_SUSPEND_COUNT=$(adb shell "cat /sys/power/suspend_stats/success 2>/dev/null" | tr -d '\r\n' || echo "0") +log_info "Current suspend count: $CURRENT_SUSPEND_COUNT" + +# ============================================================================ +# VALIDATION CHECKS +# ============================================================================ + +VALIDATION_PASSED=1 + +# Validation Check 1: Verify suspend count incremented +if [ "$CURRENT_SUSPEND_COUNT" -le "$INITIAL_SUSPEND_COUNT" ]; then + log_fail "Validation 1 FAILED: Suspend count did not increase (expected > $INITIAL_SUSPEND_COUNT, got $CURRENT_SUSPEND_COUNT)" + VALIDATION_PASSED=0 +else + log_pass "Validation 1 PASSED: Suspend count increased from $INITIAL_SUSPEND_COUNT to $CURRENT_SUSPEND_COUNT" +fi + +# Validation Check 2: Verify suspend entry markers in dmesg +log_info "Checking for suspend entry markers in kernel log..." +SUSPEND_ENTRY=$(adb shell "dmesg | grep -E 'PM: suspend entry|Freezing user space processes'" | tail -5) +if [ -z "$SUSPEND_ENTRY" ]; then + log_fail "Validation 2 FAILED: Suspend entry markers not found in kernel log" + VALIDATION_PASSED=0 +else + log_pass "Validation 2 PASSED: Suspend entry markers found" + echo "$SUSPEND_ENTRY" | while IFS= read -r line; do + log_info " $line" + done +fi + +# Validation Check 3: Verify resume markers in dmesg +log_info "Checking for resume markers in kernel log..." +RESUME_MARKERS=$(adb shell "dmesg | grep -E 'PM: suspend exit|Restarting tasks'" | tail -5) +if [ -z "$RESUME_MARKERS" ]; then + log_fail "Validation 3 FAILED: Resume markers not found in kernel log" + VALIDATION_PASSED=0 +else + log_pass "Validation 3 PASSED: Resume markers found" + echo "$RESUME_MARKERS" | while IFS= read -r line; do + log_info " $line" + done +fi + +# ============================================================================ +# DEBUG INFO COLLECTION +# ============================================================================ + +log_info "Collecting debug statistics..." + +# Collect kernel suspend statistics +log_info "=== Suspend Stats ===" +adb shell "cat /sys/kernel/debug/suspend_stats" 2>/dev/null || log_warn "Could not read suspend_stats" + +# Collect Qualcomm-specific power statistics +log_info "=== Qualcomm Power Stats ===" + +log_info "--- AOSD Stats ---" +adb shell "cat /sys/kernel/debug/qcom_stats/aosd" 2>/dev/null || log_warn "Could not read aosd stats" + +log_info "--- ADSP Stats ---" +adb shell "cat /sys/kernel/debug/qcom_stats/adsp" 2>/dev/null || log_warn "Could not read adsp stats" + +log_info "--- ADSP Island Stats ---" +adb shell "cat /sys/kernel/debug/qcom_stats/adsp_island" 2>/dev/null || log_warn "Could not read adsp_island stats" + +log_info "--- CDSP Stats ---" +adb shell "cat /sys/kernel/debug/qcom_stats/cdsp" 2>/dev/null || log_warn "Could not read cdsp stats" + +log_info "--- DDR Stats ---" +adb shell "cat /sys/kernel/debug/qcom_stats/ddr" 2>/dev/null || log_warn "Could not read ddr stats" + +log_info "--- CXSD Stats ---" +adb shell "cat /sys/kernel/debug/qcom_stats/cxsd" 2>/dev/null || log_warn "Could not read cxsd stats" + +# Dump all qcom_stats entries +log_info "=== All Qcom Stats (grep) ===" +adb shell "cd /sys/kernel/debug/qcom_stats && grep -r . 2>/dev/null" || log_warn "Could not grep qcom_stats" + +# Dump all suspend_stats entries +log_info "=== All Suspend Stats (grep) ===" +adb shell "cd /sys/power/suspend_stats && grep -r . 2>/dev/null" || log_warn "Could not grep suspend_stats" + +# ============================================================================ +# FINAL RESULT +# ============================================================================ + +if [ $VALIDATION_PASSED -eq 1 ]; then + log_pass "$TESTNAME : Test Passed - Suspend/Resume cycle completed successfully" + echo "$TESTNAME PASS" > "$res_file" + exit 0 +else + log_fail "$TESTNAME : Test Failed - One or more validation checks failed" + echo "$TESTNAME FAIL" > "$res_file" + exit 1 +fi + +log_info "-------------------Completed $TESTNAME Testcase----------------------------" diff --git a/host-tools/init_env b/host-tools/init_env new file mode 100755 index 00000000..64fa9b05 --- /dev/null +++ b/host-tools/init_env @@ -0,0 +1,120 @@ +#!/bin/sh + +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# Idempotency guard: only initialize ONCE per shell session +[ -n "$__INIT_ENV_LOADED" ] && return +__INIT_ENV_LOADED=1 + +# --- Robust root detection for host-tools --- +if [ -z "$ROOT_DIR" ]; then + # When sourced, we need to find the directory containing this init_env file + # Try multiple methods to get the script location + if [ -n "${BASH_SOURCE:-}" ]; then + # Bash + _script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + elif [ -n "${ZSH_VERSION:-}" ]; then + # Zsh + _script_dir="$(cd "$(dirname "${(%):-%x}")" && pwd)" + else + # POSIX fallback: assume init_env is in a known location relative to caller + # The caller (run.sh) sets INIT_ENV variable before sourcing + if [ -n "${INIT_ENV:-}" ]; then + _script_dir="$(cd "$(dirname "$INIT_ENV")" && pwd)" + else + _script_dir="$(cd "$(dirname "$0")" && pwd)" + fi + fi + + # For host-tools, ROOT_DIR is the host-tools directory itself + ROOT_DIR="$_script_dir" +fi + +# --- Validate and export key environment paths --- +# Point to Runner/utils for shared utilities +RUNNER_ROOT="$ROOT_DIR/../Runner" +if [ ! -d "$RUNNER_ROOT/utils" ] || [ ! -f "$RUNNER_ROOT/utils/functestlib.sh" ]; then + echo "[ERROR] Could not find Runner/utils/functestlib.sh" >&2 + echo "[ERROR] Expected at: $RUNNER_ROOT/utils/functestlib.sh" >&2 + exit 1 +fi + +export ROOT_DIR +export TOOLS="$RUNNER_ROOT/utils" +export __RUNNER_SUITES_DIR="$ROOT_DIR" +export __RUNNER_UTILS_BIN_DIR="$ROOT_DIR/common" + +# --- Ensure TOOLS is usable in all shells --- +case ":$PATH:" in + *":$TOOLS:"*) : ;; + *) + PATH="$TOOLS:$PATH" + export PATH + ;; +esac + +# --- Source functestlib.sh from Runner to make functions available --- +if [ -f "$TOOLS/functestlib.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/functestlib.sh" +else + echo "[ERROR] Could not source functestlib.sh from $TOOLS" >&2 + exit 1 +fi + +############################################################################### +# Stdout/stderr capture (per-test folder) +# +# Controls (set BEFORE sourcing this file): +# RUN_STDOUT_ENABLE = 1 | 0 (default: 1) +# RUN_STDOUT_TAG = (default: basename of $PWD) +# RUN_STDOUT_FILE = (default: $PWD/_stdout_.log) +# +# Behavior: +# - Writes the capture file into the CURRENT DIRECTORY (usually the test dir). +# - No global logs/stdout directory is created/used. +############################################################################### +_runner_stdout_cleanup() { + st=$? + # restore original fds (if they were saved) + exec 1>&3 2>&4 + if [ -n "${__TEE_PID:-}" ]; then + kill "$__TEE_PID" 2>/dev/null + fi + if [ -n "${PIPE:-}" ]; then + rm -f "$PIPE" 2>/dev/null + fi + exit "$st" +} + +if [ "${RUN_STDOUT_ENABLE:-1}" -eq 1 ] && [ -z "${__RUN_STDOUT_ACTIVE:-}" ]; then + _tag="${RUN_STDOUT_TAG:-$(basename "$(pwd)")}" + _ts="$(date +%Y%m%d-%H%M%S)" + RUN_STDOUT_FILE="${RUN_STDOUT_FILE:-$(pwd)/${_tag}_stdout_${_ts}.log}" + export RUN_STDOUT_FILE + + # Save original stdout/stderr + exec 3>&1 4>&2 + + if command -v tee >/dev/null 2>&1; then + PIPE="$(mktemp -u "/tmp/stdout_pipe.XXXXXX")" + if mkfifo "$PIPE" 2>/dev/null; then + ( tee -a "$RUN_STDOUT_FILE" >&3 ) < "$PIPE" & + __TEE_PID=$! + exec > "$PIPE" 2>&1 + __RUN_STDOUT_ACTIVE=1 + trap _runner_stdout_cleanup EXIT INT TERM + else + # Fallback: file-only capture + exec >> "$RUN_STDOUT_FILE" 2>&1 + __RUN_STDOUT_ACTIVE=1 + trap _runner_stdout_cleanup EXIT INT TERM + fi + else + # Fallback: file-only capture + exec >> "$RUN_STDOUT_FILE" 2>&1 + __RUN_STDOUT_ACTIVE=1 + trap _runner_stdout_cleanup EXIT INT TERM + fi +fi diff --git a/host-tools/run-test.sh b/host-tools/run-test.sh new file mode 100755 index 00000000..875d83a8 --- /dev/null +++ b/host-tools/run-test.sh @@ -0,0 +1,197 @@ +#!/bin/sh + +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# Resolve the real path of this script +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# Disable wrapper-level capture; each test will capture in its own folder +export RUN_STDOUT_ENABLE=0 +unset RUN_STDOUT_TAG RUN_STDOUT_FILE + +# Safely source init_env from the same directory as this script +# init_env will set TOOLS, ROOT_DIR, __RUNNER_SUITES_DIR, etc. +if [ -f "$SCRIPT_DIR/init_env" ]; then + # shellcheck source=/dev/null + . "$SCRIPT_DIR/init_env" +else + echo "[ERROR] init_env not found at $SCRIPT_DIR/init_env" + exit 1 +fi + +# Verify that init_env set up the environment correctly +if [ -z "$TOOLS" ] || [ ! -f "$TOOLS/functestlib.sh" ]; then + echo "[ERROR] functestlib.sh not found at $TOOLS/functestlib.sh" + echo "[ERROR] init_env may not have set up the environment correctly" + exit 1 +fi + +# Export key vars so they are visible to child scripts like ./run.sh +export ROOT_DIR +export TOOLS +export __RUNNER_SUITES_DIR +export __RUNNER_UTILS_BIN_DIR + +# Reboot device to ensure adb functionality after Renesas firmware flash +log_info "Rebooting device to ensure adb functionality..." +sync +sleep 2 +reboot -f +sleep 30 + +# Restart adb server +log_info "Restarting adb server..." +adb kill-server +sleep 2 +adb start-server +sleep 2 + +# Wait for adb to detect the device (non-blocking, 30s timeout) +log_info "Waiting for device to be detected by adb (timeout: 30s)..." + +if timeout 30s adb wait-for-device >/dev/null 2>&1; then + log_info "Device detected by adb" +else + log_warn "$TESTNAME SKIP: Device not detected by adb within timeout" + echo "SKIP" > "$res_file" + exit 0 +fi + +# Set host-tools specific suites directory +HOST_TOOLS_DIR="$SCRIPT_DIR" +export HOST_TOOLS_DIR + +# Store results +RESULTS_PASS="" +RESULTS_FAIL="" +RESULTS_SKIP="" + +execute_test_case() { + test_path=$1 + shift + + test_name=$(basename "$test_path") + + if [ -d "$test_path" ]; then + run_script="$test_path/run.sh" + if [ -f "$run_script" ]; then + log "Executing test case: $test_name" + ( + cd "$test_path" || exit 2 + # Enable per-test capture in the test folder with a clear tag + RUN_STDOUT_ENABLE=1 RUN_STDOUT_TAG="$test_name" sh "./run.sh" "$@" + ) + res_file="$test_path/$test_name.res" + if [ -f "$res_file" ]; then + if grep -q "SKIP" "$res_file"; then + log_skip "$test_name skipped" + if [ -z "$RESULTS_SKIP" ]; then + RESULTS_SKIP="$test_name" + else + RESULTS_SKIP=$(printf "%s\n%s" "$RESULTS_SKIP" "$test_name") + fi + elif grep -q "PASS" "$res_file"; then + log_pass "$test_name passed" + if [ -z "$RESULTS_PASS" ]; then + RESULTS_PASS="$test_name" + else + RESULTS_PASS=$(printf "%s\n%s" "$RESULTS_PASS" "$test_name") + fi + elif grep -q "FAIL" "$res_file"; then + log_fail "$test_name failed" + if [ -z "$RESULTS_FAIL" ]; then + RESULTS_FAIL="$test_name" + else + RESULTS_FAIL=$(printf "%s\n%s" "$RESULTS_FAIL" "$test_name") + fi + else + log_fail "$test_name: unknown result in .res file" + RESULTS_FAIL=$(printf "%s\n%s" "$RESULTS_FAIL" "$test_name (unknown result)") + fi + else + log_fail "$test_name: .res file not found" + RESULTS_FAIL=$(printf "%s\n%s" "$RESULTS_FAIL" "$test_name (.res not found)") + fi + else + log_error "No run.sh found in $test_path" + RESULTS_FAIL=$(printf "%s\n%s" "$RESULTS_FAIL" "$test_name (missing run.sh)") + fi + else + log_error "Test case directory not found: $test_path" + RESULTS_FAIL=$(printf "%s\n%s" "$RESULTS_FAIL" "$test_name (directory not found)") + fi +} + +run_specific_test_by_name() { + test_name=$1 + shift + test_path=$(find_test_case_by_name "$test_name") + if [ -z "$test_path" ]; then + log_error "Test case with name $test_name not found." + RESULTS_FAIL=$(printf "%s\n%s" "$RESULTS_FAIL" "$test_name (not found)") + else + execute_test_case "$test_path" "$@" + fi +} + +run_all_tests() { + # Search for tests in host-tools directory (not Runner/suites) + find "${HOST_TOOLS_DIR}" -maxdepth 2 -type d -name '[A-Za-z]*' | while IFS= read -r test_dir; do + # Skip the host-tools directory itself + if [ "$test_dir" = "$HOST_TOOLS_DIR" ]; then + continue + fi + if [ -f "$test_dir/run.sh" ]; then + execute_test_case "$test_dir" + fi + done +} + +print_summary() { + echo + log_info "========== Test Summary ==========" + echo "PASSED:" + [ -n "$RESULTS_PASS" ] && printf "%s\n" "$RESULTS_PASS" || echo " None" + echo + echo "FAILED:" + [ -n "$RESULTS_FAIL" ] && printf "%s\n" "$RESULTS_FAIL" || echo " None" + echo + echo "SKIPPED:" + [ -n "$RESULTS_SKIP" ] && printf "%s\n" "$RESULTS_SKIP" || echo " None" + log_info "==================================" +} + +print_usage() { + cat >&2 < [arg1 arg2 ...] + +Notes: + - Extra args are forwarded only when a single is specified. + - 'all' runs every test and does not accept additional args. + - Each test captures stdout/stderr next to its .res file as: + _stdout_.log +EOF +} + +if [ "$#" -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + print_usage + if [ "$#" -eq 0 ]; then + log_error "No arguments provided" + exit 1 + else + exit 0 + fi +fi + +if [ "$1" = "all" ]; then + run_all_tests +else + test_case_name="$1" + shift + run_specific_test_by_name "$test_case_name" "$@" +fi + +print_summary