Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions Runner/suites/Kernel/Baseport/adsp_remoteproc/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ log_info "------------------- Starting $TESTNAME Testcase ----------------------
log_info "=== Test Initialization ==="

# --- Tunables (override via env) ----------------------------------------------
BOOT_TO="${BOOT_TO:-30}" # wait for a processor to reach running (s)
STOP_TO="${STOP_TO:-10}" # remoteproc stop timeout (s)
START_TO="${START_TO:-10}" # remoteproc start timeout (s)
POLL_I="${POLL_I:-1}" # state poll interval (s)
Expand All @@ -53,10 +54,11 @@ FATAL_ON_UNSUSPENDED="${FATAL_ON_UNSUSPENDED:-0}" # 1 = abort if audio not suspe
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 "Usage: $0 [--ssr] [--pre-stop-delay SEC] [--fatal-on-unsuspended] [--boot-to SEC] [--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 " --boot-to SEC Boot-state wait (default: $BOOT_TO, 0 disables)" >&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
Expand All @@ -81,6 +83,15 @@ while [ $# -gt 0 ]; do
FATAL_ON_UNSUSPENDED=1
shift
;;
--boot-to)
if [ $# -lt 2 ]; then
log_fail "Missing value for --boot-to"
usage
exit 2
fi
BOOT_TO="$2"
shift 2
;;
--stop-to)
if [ $# -lt 2 ]; then
log_fail "Missing value for --stop-to"
Expand Down Expand Up @@ -120,7 +131,10 @@ while [ $# -gt 0 ]; do
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"
# A non-numeric BOOT_TO would silently disable the boot wait below.
is_unsigned_number "$BOOT_TO" || BOOT_TO=30

log_info "Tunables: BOOT_TO=$BOOT_TO 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) -------------------
Expand Down Expand Up @@ -265,6 +279,16 @@ while IFS='|' read -r rpath rstate rfirm rname; do
start_res="NA"
ping_res="SKIPPED"

# Boot check
#
# rstate is a snapshot taken moments after login; give a processor still
# coming up BOOT_TO seconds to reach running before failing it.
if [ "$rstate" != "running" ] && [ "$BOOT_TO" -gt 0 ] 2>/dev/null; then
log_info "$inst_id: state=$rstate, waiting up to ${BOOT_TO}s for state=running"
wait_remoteproc_state "$rpath" running "$BOOT_TO" "$POLL_I" || true
rstate="$(get_remoteproc_state "$rpath")"
fi

if [ "$rstate" = "running" ]; then
log_pass "$inst_id: boot check PASS"
else
Expand Down
27 changes: 25 additions & 2 deletions Runner/suites/Kernel/Baseport/cdsp_remoteproc/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ log_info "------------------- Starting $TESTNAME Testcase ----------------------
log_info "=== Test Initialization ==="

# Timeouts (can be overridden via env)
BOOT_TO="${BOOT_TO:-30}"
STOP_TO="${STOP_TO:-10}"
START_TO="${START_TO:-10}"
POLL_I="${POLL_I:-1}"
Expand All @@ -49,8 +50,9 @@ POLL_I="${POLL_I:-1}"
DO_SSR=0

usage() {
echo "Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
echo "Usage: $0 [--ssr] [--boot-to SEC] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
echo " --ssr Perform CDSP stop/start (SSR). Default: OFF" >&2
echo " --boot-to SEC Boot-state wait (default: $BOOT_TO, 0 disables)" >&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
Expand All @@ -62,6 +64,15 @@ while [ $# -gt 0 ]; do
DO_SSR=1
shift
;;
--boot-to)
if [ $# -lt 2 ]; then
log_fail "Missing value for --boot-to"
usage
exit 2
fi
BOOT_TO="$2"
shift 2
;;
--stop-to)
if [ $# -lt 2 ]; then
log_fail "Missing value for --stop-to"
Expand Down Expand Up @@ -101,7 +112,10 @@ while [ $# -gt 0 ]; do
esac
done

log_info "Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I"
# A non-numeric BOOT_TO would silently disable the boot wait below.
is_unsigned_number "$BOOT_TO" || BOOT_TO=30

log_info "Tunables: BOOT_TO=$BOOT_TO 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 ----------------------------------------------------
Expand Down Expand Up @@ -146,6 +160,15 @@ while IFS='|' read -r rpath rstate rfirm rname; do
ping_res="SKIPPED"

# Boot check
#
# rstate is a snapshot taken moments after login; give a processor still
# coming up BOOT_TO seconds to reach running before failing it.
if [ "$rstate" != "running" ] && [ "$BOOT_TO" -gt 0 ] 2>/dev/null; then
log_info "$inst_id: state=$rstate, waiting up to ${BOOT_TO}s for state=running"
wait_remoteproc_state "$rpath" running "$BOOT_TO" "$POLL_I" || true
rstate="$(get_remoteproc_state "$rpath")"
fi

if [ "$rstate" = "running" ]; then
log_pass "$inst_id: boot check PASS"
else
Expand Down
27 changes: 25 additions & 2 deletions Runner/suites/Kernel/Baseport/gpdsp_remoteproc/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ log_info "------------------- Starting $TESTNAME Testcase ----------------------
log_info "=== Test Initialization ==="

# Tunables
BOOT_TO="${BOOT_TO:-30}"
STOP_TO="${STOP_TO:-10}"
START_TO="${START_TO:-10}"
POLL_I="${POLL_I:-1}"
Expand All @@ -49,8 +50,9 @@ POLL_I="${POLL_I:-1}"
DO_SSR=0

usage() {
echo "Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
echo "Usage: $0 [--ssr] [--boot-to SEC] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
echo " --ssr Perform $FW stop/start (SSR). Default: OFF" >&2
echo " --boot-to SEC Boot-state wait (default: $BOOT_TO, 0 disables)" >&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
Expand All @@ -62,6 +64,15 @@ while [ $# -gt 0 ]; do
DO_SSR=1
shift
;;
--boot-to)
if [ $# -lt 2 ]; then
log_fail "Missing value for --boot-to"
usage
exit 2
fi
BOOT_TO="$2"
shift 2
;;
--stop-to)
if [ $# -lt 2 ]; then
log_fail "Missing value for --stop-to"
Expand Down Expand Up @@ -101,7 +112,10 @@ while [ $# -gt 0 ]; do
esac
done

log_info "Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I"
# A non-numeric BOOT_TO would silently disable the boot wait below.
is_unsigned_number "$BOOT_TO" || BOOT_TO=30

log_info "Tunables: BOOT_TO=$BOOT_TO 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
Expand Down Expand Up @@ -143,6 +157,15 @@ while IFS='|' read -r rpath rstate rfirm rname; do
ping_res="SKIPPED"

# Boot check
#
# rstate is a snapshot taken moments after login; give a processor still
# coming up BOOT_TO seconds to reach running before failing it.
if [ "$rstate" != "running" ] && [ "$BOOT_TO" -gt 0 ] 2>/dev/null; then
log_info "$inst_id: state=$rstate, waiting up to ${BOOT_TO}s for state=running"
wait_remoteproc_state "$rpath" running "$BOOT_TO" "$POLL_I" || true
rstate="$(get_remoteproc_state "$rpath")"
fi

if [ "$rstate" = "running" ]; then
log_pass "$inst_id: boot check PASS"
else
Expand Down
27 changes: 25 additions & 2 deletions Runner/suites/Kernel/Baseport/wpss_remoteproc/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ log_info "------------------- Starting $TESTNAME Testcase ----------------------
log_info "=== Test Initialization ==="

# Tunables
BOOT_TO="${BOOT_TO:-30}"
STOP_TO="${STOP_TO:-10}"
START_TO="${START_TO:-10}"
POLL_I="${POLL_I:-1}"
Expand All @@ -52,8 +53,9 @@ POLL_I="${POLL_I:-1}"
DO_SSR=0

usage() {
echo "Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
echo "Usage: $0 [--ssr] [--boot-to SEC] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
echo " --ssr Perform WPSS stop/start (SSR). Default: OFF" >&2
echo " --boot-to SEC Boot-state wait (default: $BOOT_TO, 0 disables)" >&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
Expand All @@ -65,6 +67,15 @@ while [ $# -gt 0 ]; do
DO_SSR=1
shift
;;
--boot-to)
if [ $# -lt 2 ]; then
log_fail "Missing value for --boot-to"
usage
exit 2
fi
BOOT_TO="$2"
shift 2
;;
--stop-to)
if [ $# -lt 2 ]; then
log_fail "Missing value for --stop-to"
Expand Down Expand Up @@ -104,7 +115,10 @@ while [ $# -gt 0 ]; do
esac
done

log_info "Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I"
# A non-numeric BOOT_TO would silently disable the boot wait below.
is_unsigned_number "$BOOT_TO" || BOOT_TO=30

log_info "Tunables: BOOT_TO=$BOOT_TO 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 ----------
Expand Down Expand Up @@ -140,6 +154,15 @@ if [ -n "$rp_entries" ]; then
ping_res="SKIPPED"

# Boot check
#
# rstate is a snapshot taken moments after login; give a processor still
# coming up BOOT_TO seconds to reach running before failing it.
if [ "$rstate" != "running" ] && [ "$BOOT_TO" -gt 0 ] 2>/dev/null; then
log_info "$inst: state=$rstate, waiting up to ${BOOT_TO}s for state=running"
wait_remoteproc_state "$rpath" running "$BOOT_TO" "$POLL_I" || true
rstate="$(get_remoteproc_state "$rpath")"
fi

if [ "$rstate" = "running" ]; then
log_pass "$inst: boot check PASS"
else
Expand Down
29 changes: 26 additions & 3 deletions Runner/suites/Multimedia/Audio/AudioRecord/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ if [ -n "$CONFIG_NAMES" ] && [ -n "$CONFIG_FILTER" ]; then
CONFIG_FILTER=""
fi

log_info "Args: backend=${AUDIO_BACKEND:-auto} source=$SRC_CHOICE overlay=$AUDIO_OVERLAY_REQUESTED loops=$LOOPS durations='$DURATIONS' record_seconds=$RECORD_SECONDS timeout=$TIMEOUT strict=$STRICT signal_strict=$AUDIO_RECORD_STRICT_SIGNAL dmesg=$DMESG_SCAN bootstrap=$AUDIO_BOOTSTRAP_MODE runtime_dir=${AUDIO_RUNTIME_DIR:-auto}"
log_info "Args: backend=${AUDIO_BACKEND:-auto} source=$SRC_CHOICE overlay=$AUDIO_OVERLAY_REQUESTED loops=$LOOPS durations='$DURATIONS' record_seconds=$RECORD_SECONDS timeout=$TIMEOUT start_grace=${AUDIO_RECORD_START_GRACE:-5} strict=$STRICT signal_strict=$AUDIO_RECORD_STRICT_SIGNAL dmesg=$DMESG_SCAN bootstrap=$AUDIO_BOOTSTRAP_MODE runtime_dir=${AUDIO_RUNTIME_DIR:-auto}"

# Resolve backend (allow minimal-build ALSA capture fallback)
if [ -z "$AUDIO_BACKEND" ]; then
Expand Down Expand Up @@ -960,6 +960,29 @@ auto_secs_for() {
esac
}

# Add startup headroom to the capture watchdog.
#
# pw-record has no duration flag on this path, so the watchdog is what ends
# the recording, and its clock starts before PipeWire has opened the device:
# a slow start is taken out of the recording and fails the duration check.
# Grant AUDIO_RECORD_START_GRACE extra watchdog seconds so the requested
# duration is still captured. The duration validated against is unchanged,
# and an explicit --timeout still overrides the watchdog.
audio_record_timeout_with_grace() {
artg_requested="$(audio_parse_secs "$1" 2>/dev/null || echo 0)"
artg_grace="${AUDIO_RECORD_START_GRACE:-5}"

is_unsigned_number "$artg_grace" || artg_grace=5

if [ "${artg_requested:-0}" -gt 0 ] 2>/dev/null &&
[ "$artg_grace" -gt 0 ] 2>/dev/null; then
printf '%ss\n' "$((artg_requested + artg_grace))"
return 0
fi

printf '%s\n' "$1"
}

# Validate the final capture selected by the existing backend/retry flow.
# Size remains useful only for deciding whether compatibility fallbacks should
# run; PASS requires a structurally valid WAV with acceptable sample content.
Expand Down Expand Up @@ -1079,7 +1102,7 @@ if [ "$USE_CONFIG_DISCOVERY" = "true" ]; then

while [ "$i" -le "$LOOPS" ]; do
iso="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
effective_timeout="$secs"
effective_timeout="$(audio_record_timeout_with_grace "$secs")"
if [ -n "$TIMEOUT" ] && [ "$TIMEOUT" != "0" ]; then
effective_timeout="$TIMEOUT"
fi
Expand Down Expand Up @@ -1384,7 +1407,7 @@ else

while [ "$i" -le "$LOOPS" ]; do
iso="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
effective_timeout="$secs"
effective_timeout="$(audio_record_timeout_with_grace "$secs")"
if [ -n "$TIMEOUT" ] && [ "$TIMEOUT" != "0" ]; then
effective_timeout="$TIMEOUT"
fi
Expand Down
5 changes: 3 additions & 2 deletions Runner/utils/functestlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3886,12 +3886,13 @@ wait_remoteproc_state() {
*) rpath="/sys/class/remoteproc/$rp" ;;
esac

start_ts=$(date +%s)
# Monotonic, so an NTP step cannot skew the wait.
start_ts=$(get_monotonic_seconds)
while :; do
cur=$(get_remoteproc_state "$rpath")
[ "$cur" = "$want" ] && return 0

now_ts=$(date +%s)
now_ts=$(get_monotonic_seconds)
[ $((now_ts - start_ts)) -ge "$to" ] && {
log_info "Waiting for state='$want' timed out (got='$cur')..."
return 1
Expand Down
Loading
Loading