Skip to content

Commit 0909af7

Browse files
committed
Adding Scripts for Audio Playback and Audio Record for Public CI Testcases
Added Audio Playback Shell Script Added ReadMe for Audio Playback Added Audio Record Shell Script Added ReadMe for Audio Record Signed-off-by: Abhishek Bajaj <[email protected]>
1 parent 1282816 commit 0909af7

File tree

2 files changed

+61
-17
lines changed
  • Runner/suites/Multimedia/Audio

2 files changed

+61
-17
lines changed

Runner/suites/Multimedia/Audio/AudioPlayback/run.sh

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,42 @@
33
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
44
# SPDX-License-Identifier: BSD-3-Clause-Clear
55

6-
# Import test suite definitions
7-
# shellcheck source=../../../../init_env
8-
. "${PWD}"/init_env
9-
TESTNAME="AudioPlayback"
10-
TESTBINARY="paplay"
11-
TAR_URL="https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/Pulse-Audio-Files-v1.0/AudioClips.tar.gz"
6+
# Robustly find and source init_env
7+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8+
INIT_ENV=""
9+
SEARCH="$SCRIPT_DIR"
10+
while [ "$SEARCH" != "/" ]; do
11+
if [ -f "$SEARCH/init_env" ]; then
12+
INIT_ENV="$SEARCH/init_env"
13+
break
14+
fi
15+
SEARCH=$(dirname "$SEARCH")
16+
done
17+
18+
if [ -z "$INIT_ENV" ]; then
19+
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
20+
exit 1
21+
fi
22+
23+
# Only source if not already loaded (idempotent)
24+
if [ -z "$__INIT_ENV_LOADED" ]; then
25+
# shellcheck disable=SC1090
26+
. "$INIT_ENV"
27+
fi
28+
# Always source functestlib.sh, using $TOOLS exported by init_env
29+
# shellcheck disable=SC1090,SC1091
30+
. "$TOOLS/functestlib.sh"
1231

1332
# Global variable to hold PIDs to be killed at the end of the test
1433
KILLPID=""
1534

16-
# Import test functions
17-
# shellcheck source=../../../../utils/functestlib.sh
18-
. "${TOOLS}"/functestlib.sh
35+
TESTNAME="AudioPlayback"
36+
TESTBINARY="paplay"
37+
TAR_URL="https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/Pulse-Audio-Files-v1.0/AudioClips.tar.gz"
1938
test_path=$(find_test_case_by_name "$TESTNAME")
39+
cd "$test_path" || exit 1
40+
# shellcheck disable=SC2034
41+
res_file="./$TESTNAME.res"
2042

2143
log_info "--------------------------------------------------------------------------"
2244
log_info "-------------------Starting $TESTNAME Testcase----------------------------"

Runner/suites/Multimedia/Audio/AudioRecord/run.sh

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,41 @@
33
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
44
# SPDX-License-Identifier: BSD-3-Clause-Clear
55

6-
# Import test suite definitions
7-
# shellcheck source=../../../../init_env
8-
. "${PWD}"/init_env
9-
TESTNAME="AudioRecord"
10-
TESTBINARY="parec"
6+
# Robustly find and source init_env
7+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8+
INIT_ENV=""
9+
SEARCH="$SCRIPT_DIR"
10+
while [ "$SEARCH" != "/" ]; do
11+
if [ -f "$SEARCH/init_env" ]; then
12+
INIT_ENV="$SEARCH/init_env"
13+
break
14+
fi
15+
SEARCH=$(dirname "$SEARCH")
16+
done
17+
18+
if [ -z "$INIT_ENV" ]; then
19+
echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2
20+
exit 1
21+
fi
22+
23+
# Only source if not already loaded (idempotent)
24+
if [ -z "$__INIT_ENV_LOADED" ]; then
25+
# shellcheck disable=SC1090
26+
. "$INIT_ENV"
27+
fi
28+
# Always source functestlib.sh, using $TOOLS exported by init_env
29+
# shellcheck disable=SC1090,SC1091
30+
. "$TOOLS/functestlib.sh"
1131

1232
# Global variable to hold PIDs to be killed at the end of the test
1333
KILLPID=""
1434

15-
# Import test functions
16-
# shellcheck source=../../../../utils/functestlib.sh
17-
. "${TOOLS}"/functestlib.sh
35+
TESTNAME="AudioRecord"
36+
TESTBINARY="parec"
1837
test_path=$(find_test_case_by_name "$TESTNAME")
38+
cd "$test_path" || exit 1
39+
# shellcheck disable=SC2034
40+
res_file="./$TESTNAME.res"
1941

2042
log_info "--------------------------------------------------------------------------"
2143
log_info "-------------------Starting $TESTNAME Testcase----------------------------"

0 commit comments

Comments
 (0)