diff --git a/Runner/plans/meta-ar-ci-premerge.yaml b/Runner/plans/meta-ar-ci-premerge.yaml new file mode 100644 index 00000000..135e3651 --- /dev/null +++ b/Runner/plans/meta-ar-ci-premerge.yaml @@ -0,0 +1,21 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: SmokeSanity + description: "Pre-merge LAVA plan to run AudioRecord and AudioPlayback on every PR" + maintainer: + - abbajaj@qti.qualcomm.com + os: + - openembedded + scope: + - functional + devices: + - rb3gen2 + +run: + steps: + - cd Runner + - $PWD/suites/Multimedia/Audio/AudioPlayback/run.sh || true + - $PWD/utils/send-to-lava.sh $PWD/suites/Multimedia/Audio/AudioPlayback/AudioPlayback.res || true + - $PWD/suites/Multimedia/Audio/AudioRecord/run.sh || true + - $PWD/utils/send-to-lava.sh $PWD/suites/Multimedia/Audio/AudioRecord/AudioRecord.res || true + diff --git a/Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md b/Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md new file mode 100644 index 00000000..77e6c192 --- /dev/null +++ b/Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md @@ -0,0 +1,78 @@ +# Audio playback Validation Script for Qualcomm Linux based platform (Yocto) + +## Overview + +This script automates the validation of audio playback capabilities on the Qualcomm Linux based platform running a Yocto-based Linux system. It utilizes pulseaudio test app to decode wav file. + +## Features + +- Decoding PCM clip +- Compatible with Yocto-based root filesystem + +## Prerequisites + +Ensure the following components are present in the target Yocto build: + +- `paplay` binary(available at /usr/bin) + +## Directory Structure + +```bash +Runner/ +├──suites/ +├ ├── Multimedia/ +│ ├ ├── Audio/ +│ ├ ├ ├── AudioPlayback/ +│ ├ ├ ├ ├ └── run.sh +├ ├ ├ ├ ├ └── Read_me.md +``` + +## Usage + + +Instructions + +1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to any directory on the target device. + +2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device. + +3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed. + +Run a specific test using: +--- +Quick Example +``` +git clone +cd +scp -r common Runner user@target_device_ip: +ssh user@target_device_ip +cd /Runner && ./run-test.sh AudioPlayback +``` +Sample Output: +``` +sh-5.2# cd /Runner/ && ./run-test.sh AudioPlayback +[Executing test case: AudioPlayback] 2025-05-28 19:01:59 - +[INFO] 2025-05-28 19:01:59 - ------------------------------------------------------------ +[INFO] 2025-05-28 19:01:59 - ------------------- Starting AudioPlayback Testcase ------------ +[INFO] 2025-05-28 19:01:59 - Checking if dependency binary is available +[INFO] 2025-05-28 19:01:59 - Playback clip present: AudioClips/yesterday_48KHz.wav +[PASS] 2025-05-28 19:02:14 - Playback completed or timed out (ret=124) as expected. +[PASS] 2025-05-28 19:02:14 - AudioPlayback : Test Passed +[INFO] 2025-05-28 19:02:14 - See results/audioplayback/playback_stdout.log, dmesg_before/after.log, syslog_before/after.log for debug details +[INFO] 2025-05-28 19:02:14 - ------------------- Completed AudioPlayback Testcase ------------- +[PASS] 2025-05-28 19:02:14 - AudioPlayback passed +sh-5.2# +``` +3. Results will be available in the `Runner/suites/Multimedia/Audio/AudioPlayback/AudioPlayback.res` directory. + + +## Notes + +- The script does not take any arguments. +- It validates the presence of required libraries before executing tests. +- If any critical tool is missing, the script exits with an error message. + +## License + +SPDX-License-Identifier: BSD-3-Clause-Clear +(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 new file mode 100755 index 00000000..6e6e0b8a --- /dev/null +++ b/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh @@ -0,0 +1,94 @@ +#!/bin/sh + +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# --------- Robustly source init_env and functestlib.sh ---------- +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 + +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" +# --------------------------------------------------------------- + +TESTNAME="AudioPlayback" +TESTBINARY="paplay" +TAR_URL="https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/Pulse-Audio-Files-v1.0/AudioClips.tar.gz" +PLAYBACK_CLIP="AudioClips/yesterday_48KHz.wav" +AUDIO_DEVICE="low-latency0" +LOGDIR="results/audioplayback" +RESULT_FILE="$TESTNAME.res" + +test_path=$(find_test_case_by_name "$TESTNAME") +cd "$test_path" || exit 1 + +# Prepare logdir +mkdir -p "$LOGDIR" +chmod -R 777 "$LOGDIR" + +log_info "------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase ------------" + +log_info "Checking if dependency binary is available" +check_dependencies "$TESTBINARY" pgrep grep timeout + +# Download/extract audio if not present +if [ ! -f "$PLAYBACK_CLIP" ]; then + log_info "Audio clip not found, downloading..." + extract_tar_from_url "$TAR_URL" || { + log_fail "Failed to fetch/extract playback audio tarball" + echo "$TESTNAME FAIL" > "$RESULT_FILE" + exit 1 + } +fi + +if [ ! -f "$PLAYBACK_CLIP" ]; then + log_fail "Playback clip $PLAYBACK_CLIP not found after extraction." + echo "$TESTNAME : FAIL" > "$RESULT_FILE" + exit 1 +fi + +log_info "Playback clip present: $PLAYBACK_CLIP" + +# --- Capture logs BEFORE playback (for debugging) --- +dmesg > "$LOGDIR/dmesg_before.log" +cp /var/log/syslog "$LOGDIR/syslog_before.log" 2>/dev/null + +# --- Start the Playback, capture output --- +timeout 15s paplay "$PLAYBACK_CLIP" -d "$AUDIO_DEVICE" > "$LOGDIR/playback_stdout.log" 2>&1 +ret=$? + +# --- Capture logs AFTER playback (for debugging) --- +dmesg > "$LOGDIR/dmesg_after.log" +cp /var/log/syslog "$LOGDIR/syslog_after.log" 2>/dev/null + +if [ "$ret" -eq 0 ] || [ "$ret" -eq 124 ] ; then + log_pass "Playback completed or timed out (ret=$ret) as expected." + log_pass "$TESTNAME : Test Passed" + echo "$TESTNAME PASS" > "$RESULT_FILE" +else + log_fail "$TESTBINARY playback exited with error code $ret" + log_fail "$TESTNAME : Test Failed" + echo "$TESTNAME FAIL" > "$RESULT_FILE" +fi + +log_info "See $LOGDIR/playback_stdout.log, dmesg_before/after.log, syslog_before/after.log for debug details" +log_info "------------------- Completed $TESTNAME Testcase -------------" +exit 0 diff --git a/Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md b/Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md new file mode 100644 index 00000000..39da5ec1 --- /dev/null +++ b/Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md @@ -0,0 +1,79 @@ +# Audio encode Validation Script for Qualcomm Linux based platform (Yocto) + +## Overview + +This script automates the validation of audio encode capabilities on the Qualcomm Linux based platform running a Yocto-based Linux system. It utilizes pulseaudio test app to encode file. + +## Features + +- Encode PCM clip with --rate=48000 --format=s16le --channels=1 --file-format=wav /tmp/rec1.wav -d regular0 +- Compatible with Yocto-based root filesystem + +## Prerequisites + +Ensure the following components are present in the target Yocto build: + +- `parec` binary(available at /usr/bin) + +## Directory Structure + +```bash +Runner/ +├──suites/ +├ ├── Multimedia/ +│ ├ ├── Audio/ +│ ├ ├ ├── AudioRecord/ +│ ├ ├ ├ ├ └── run.sh +├ ├ ├ ├ ├ └── Read_me.md +``` + +## Usage + + +Instructions + +1. Copy repo to Target Device: Use scp to transfer the scripts from the host to the target device. The scripts should be copied to any directory on the target device. + +2. Verify Transfer: Ensure that the repo have been successfully copied to any directory on the target device. + +3. Run Scripts: Navigate to the directory where these files are copied on the target device and execute the scripts as needed. + +Run a specific test using: +--- +Quick Example +``` +git clone +cd +scp -r common Runner user@target_device_ip: +ssh user@target_device_ip +cd Runner && ./run-test.sh AudioRecord +``` + +Sample Output: +``` +sh-5.2# cd /Runner/ && ./run-test.sh AudioRecord +[Executing test case: AudioRecord] 2025-05-28 19:03:33 - +[INFO] 2025-05-28 19:03:33 - ------------------------------------------------------------ +[INFO] 2025-05-28 19:03:33 - ------------------- Starting AudioRecord Testcase ------------ +[INFO] 2025-05-28 19:03:33 - Checking if dependency binary is available +[PASS] 2025-05-28 19:03:45 - Recording completed or timed out (ret=124) as expected and output file exists. +[PASS] 2025-05-28 19:03:45 - AudioRecord : Test Passed +[INFO] 2025-05-28 19:03:45 - See results/audiorecord/parec_stdout.log, dmesg_before/after.log, syslog_before/after.log for debug details +[INFO] 2025-05-28 19:03:45 - ------------------- Completed AudioRecord Testcase ------------- +[PASS] 2025-05-28 19:03:45 - AudioRecord passed +sh-5.2# +``` + +3. Results will be available in the `Runner/suites/Multimedia/Audio/AudioRecord/AudioRecord.res` directory. + + +## Notes + +- The script does not take any arguments. +- It validates the presence of required libraries before executing tests. +- If any critical tool is missing, the script exits with an error message. + +## License + +SPDX-License-Identifier: BSD-3-Clause-Clear +(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 new file mode 100755 index 00000000..8f586eda --- /dev/null +++ b/Runner/suites/Multimedia/Audio/AudioRecord/run.sh @@ -0,0 +1,77 @@ +#!/bin/sh + +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# --------- Robustly source init_env and functestlib.sh ---------- +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 + +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" +# --------------------------------------------------------------- + +TESTNAME="AudioRecord" +TESTBINARY="parec" +RECORD_FILE="/tmp/rec1.wav" +AUDIO_DEVICE="regular0" +LOGDIR="results/audiorecord" +RESULT_FILE="$TESTNAME.res" + +test_path=$(find_test_case_by_name "$TESTNAME") +cd "$test_path" || exit 1 +mkdir -p "$LOGDIR" +chmod -R 777 "$LOGDIR" + +log_info "------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase ------------" + +log_info "Checking if dependency binary is available" +check_dependencies "$TESTBINARY" pgrep timeout + +# --- Capture logs BEFORE recording (for debugging) --- +dmesg > "$LOGDIR/dmesg_before.log" +cp /var/log/syslog "$LOGDIR/syslog_before.log" 2>/dev/null + +# Remove old record file if present +rm -f "$RECORD_FILE" + +# --- Start recording --- +timeout 12s "$TESTBINARY" --rate=48000 --format=s16le --channels=1 --file-format=wav "$RECORD_FILE" -d "$AUDIO_DEVICE" > "$LOGDIR/parec_stdout.log" 2>&1 +ret=$? + +# --- Capture logs AFTER recording (for debugging) --- +dmesg > "$LOGDIR/dmesg_after.log" +cp /var/log/syslog "$LOGDIR/syslog_after.log" 2>/dev/null + +# --- Evaluate result: pass only if process completed successfully and file is non-empty --- +if ([ "$ret" -eq 0 ] || [ "$ret" -eq 124 ]) && [ -s "$RECORD_FILE" ]; then + log_pass "Recording completed or timed out (ret=$ret) as expected and output file exists." + log_pass "$TESTNAME : Test Passed" + echo "$TESTNAME PASS" > "$RESULT_FILE" +else + log_fail "parec failed (status $ret) or recorded file missing/empty" + log_fail "$TESTNAME : Test Failed" + echo "$TESTNAME FAIL" > "$RESULT_FILE" +fi + +log_info "See $LOGDIR/parec_stdout.log, dmesg_before/after.log, syslog_before/after.log for debug details" +log_info "------------------- Completed $TESTNAME Testcase -------------" +exit 0