Skip to content

Commit 36715d9

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 <[email protected]>
1 parent 73a2a03 commit 36715d9

File tree

4 files changed

+359
-0
lines changed

4 files changed

+359
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
# Audio playback Validation Script for RB3 Gen2 (Yocto)
5+
6+
## Overview
7+
8+
This script automates the validation of audio playback capabilities on the Qualcomm RB3 Gen2 platform running a Yocto-based Linux system. It utilizes pulseaudio test app to decode wav file.
9+
10+
## Features
11+
12+
- Decoding PCM clip
13+
- Compatible with Yocto-based root filesystem
14+
15+
## Prerequisites
16+
17+
Ensure the following components are present in the target Yocto build:
18+
19+
- `paplay` binary(available at /usr/bin)
20+
21+
## Directory Structure
22+
23+
```bash
24+
Runner/
25+
├utils/
26+
├ ├AudioPlayback
27+
├──suites/
28+
├ ├── Multimedia/
29+
│ ├ ├── Audio/
30+
│ ├ ├ ├── AudioPlayback/
31+
│ ├ ├ ├ ├ └── run.sh
32+
├ ├ ├ ├ ├ └── yesterday_48KHz.wav
33+
├ ├ ├ ├ ├ └── audio_test.txt
34+
```
35+
36+
## Usage
37+
38+
39+
Instructions
40+
41+
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 the /var directory on the target device.
42+
43+
2. Verify Transfer: Ensure that the repo have been successfully copied to the /var directory on the target device.
44+
45+
3. Run Scripts: Navigate to the /var directory on the target device and execute the scripts as needed.
46+
47+
Run a specific test using:
48+
---
49+
Quick Example
50+
```
51+
git clone <this-repo>
52+
cd <this-repo>
53+
scp -r common Runner user@target_device_ip:/var
54+
ssh user@target_device_ip
55+
cd /var/Runner && ./run-test.sh AudioPlayback
56+
```
57+
58+
Sample Output:
59+
sh-5.2# ./run-test.sh AudioRecord
60+
[Test case directory not found: /var/Runner/suites/Multimedia/Audio/AudioRecord
61+
/var/Runner/suites/Multimedia/AudioRecord] 1980-01-10 00:31:56 -
62+
sh-5.2# ./run-test.sh AudioPlayback
63+
[Executing test case: /var/Runner/suites/Multimedia/Audio/AudioPlayback] 1980-01-10 00:32:33 -
64+
--------------------------------------------------------------------------
65+
-------------------Starting audio_playback_test Testcase----------------------------
66+
Checking if dependency binary is available
67+
[PASS] 1980-01-10 00:32:33 - Test related dependencies are present.
68+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 41: PID: command not found
69+
70+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 46: [-z: command not found
71+
Test Binary paplay is running successfully
72+
=== Overall Audio Test Validation Result ===
73+
Param 2803321
74+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 55: local: `=': not a valid identifier
75+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 55: local: `': not a valid identifier
76+
280352 pts/0 S+ 0:00 paplay /tmp/yesterday_48KHz.wav -d low-latency0
77+
Successfully audio playback completed
78+
[PASS] 1980-01-10 00:32:43 - audio_playback_test : Test Passed
79+
Test Passed
80+
Clean up the old PID by Killing the process
81+
280350
82+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 84: 280350 Killed tail -f /var/log/syslog > results/audiotestresult/syslog_log.txt
83+
280351
84+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 84: 280351 Killed dmesg -w > results/audiotestresult/dmesg_log.txt
85+
280352
86+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 84: 280352 Killed paplay /tmp/yesterday_48KHz.wav -d low-latency0
87+
-------------------Completed audio_playback_test Testcase----------------------------
88+
sh-5.2#
89+
90+
91+
3. Results will be available in the `Runner/suites/Multimedia/Audio/AudioPlayback/audio_test.txt` directory.
92+
93+
94+
## Notes
95+
96+
- The script does not take any arguments.
97+
- It validates the presence of required libraries before executing tests.
98+
- If any critical tool is missing, the script exits with an error message.
99+
100+
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
#!/bin/sh
5+
6+
# Import test suite definitions
7+
. $(pwd)/init_env
8+
TESTNAME="audio_playback_test"
9+
TESTBINARY="paplay"
10+
11+
#Global variable to hold PID which needs to be killed at the end of the test
12+
KILLPID=()
13+
14+
# Import test functions
15+
. $TOOLS/functestlib.sh
16+
test_path=$(find_test_case_by_name "$TESTNAME")
17+
echo "--------------------------------------------------------------------------"
18+
echo "-------------------Starting $TESTNAME Testcase----------------------------"
19+
20+
echo "Checking if dependency binary is available"
21+
check_dependencies $TESTBINARY
22+
extract_tar_from_url https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/Pulse-Audio-Files-v1.0/AudioClips.tar.gz
23+
24+
# Prepare environment
25+
mkdir -p results/audiotestresult
26+
chmod -R 777 results/audiotestresult
27+
28+
# Start logs
29+
dmesg -C
30+
tail -f /var/log/syslog > results/audiotestresult/syslog_log.txt &
31+
KILLPID[${#KILLPID[@]}+1]="$!"
32+
33+
dmesg -w > results/audiotestresult/dmesg_log.txt &
34+
KILLPID[${#KILLPID[@]}+1]="$!"
35+
36+
#Start the Playback
37+
paplay ./suites/Multimedia/Audio/AudioPlayback/yesterday_48KHz.wav -d low-latency0 &
38+
PID = $!
39+
KILLPID[${#KILLPID[@]}+1]="$!"
40+
sleep 10
41+
42+
#Check whether playback started
43+
if [-z "$PID"]; then
44+
echo "Fail to start the test binary $TESTBINARY"
45+
exit 1
46+
else
47+
echo "Test Binary $TESTBINARY is running successfully"
48+
fi
49+
50+
check_audio_pid_alive() {
51+
echo "Param $$1"
52+
local pid = "$1"
53+
local result_file="results/audiotestresult/stdout.txt"
54+
ps -ax | grep $TESTBINARY | head -1 2>&1 | tee "$result_file"
55+
56+
if grep -q "$pid" "$result_file"; then
57+
echo "Successfully audio playback completed"
58+
return 0
59+
else
60+
echo "Fail to start audio playback"
61+
return 1
62+
fi
63+
}
64+
65+
# Final status, Print overall test result
66+
echo "=== Overall Audio Test Validation Result ==="
67+
if check_audio_pid_alive "$PID"; then
68+
log_pass "$TESTNAME : Test PASS"
69+
echo "$TESTNAME : Test Pass" > $test_path/$TESTNAME.res
70+
else
71+
log_fail "$TESTNAME : Test FAIL"
72+
echo "$TESTNAME : Test Fail" > $test_path/$TESTNAME.res
73+
fi
74+
75+
76+
#Clean up
77+
echo "Clean up the old PID by Killing the process"
78+
# Loop through the array
79+
for id in "${KILLPID[@]}"; do
80+
echo $id
81+
kill -9 $id >/dev/null 2>&1
82+
sleep 1
83+
done
84+
85+
echo "-------------------Completed $TESTNAME Testcase----------------------------"
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Audio enccode Validation Script for RB3 Gen2 (Yocto)
2+
3+
## Overview
4+
5+
This script automates the validation of audio encode capabilities on the Qualcomm RB3 Gen2 platform running a Yocto-based Linux system. It utilizes pulseaudio test app to encode file.
6+
7+
## Features
8+
9+
- Encode PCM clip with --rate=48000 --format=s16le --channels=1 --file-format=wav /tmp/rec1.wav -d regular0
10+
- Compatible with Yocto-based root filesystem
11+
12+
## Prerequisites
13+
14+
Ensure the following components are present in the target Yocto build:
15+
16+
- `parec` binary(available at /usr/bin)
17+
18+
## Directory Structure
19+
20+
```bash
21+
Runner/
22+
├utils/
23+
├ ├AudioPlayback
24+
├──suites/
25+
├ ├── Multimedia/
26+
│ ├ ├── Audio/
27+
│ ├ ├ ├── AudioRecord/
28+
│ ├ ├ ├ ├ └── run.sh
29+
├ ├ ├ ├ ├ └── audio_test.txt
30+
```
31+
32+
## Usage
33+
34+
35+
Instructions
36+
37+
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 the /var directory on the target device.
38+
39+
2. Verify Transfer: Ensure that the repo have been successfully copied to the /var directory on the target device.
40+
41+
3. Run Scripts: Navigate to the /var directory on the target device and execute the scripts as needed.
42+
43+
Run a specific test using:
44+
---
45+
Quick Example
46+
```
47+
git clone <this-repo>
48+
cd <this-repo>
49+
scp -r common Runner user@target_device_ip:/var
50+
ssh user@target_device_ip
51+
cd /var/Runner && ./run-test.sh AudioRecord
52+
```
53+
54+
Sample Output:
55+
sh-5.2# ./run-test.sh AudioRecord
56+
[Executing test case: /var/Runner/suites/Multimedia/Audio/AudioRecord] 1980-01-10 00:50:32 -
57+
--------------------------------------------------------------------------
58+
-------------------Starting audio_record_test Testcase----------------------------
59+
Checking if dependency binary is available
60+
[PASS] 1980-01-10 00:50:32 - Test related dependencies are present.
61+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 41: PID: command not found
62+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 46: [-z: command not found
63+
Test Binary parec is running successfully
64+
=== Overall Audio Test Validation Result ===
65+
Param 2808851
66+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 55: local: `=': not a valid identifier
67+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 55: local: `': not a valid identifier
68+
280905 pts/0 S+ 0:00 parec --rate=48000 --format=s16le --channels=1 --file-format=wav /tmp/rec1.wav -d regular0
69+
Successfully audio record completed
70+
[PASS] 1980-01-10 00:50:42 - audio_record_test : Test Passed
71+
Test Passed
72+
Clean up the old PID by Killing the process
73+
280903
74+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 84: 280903 Killed tail -f /var/log/syslog > results/audiotestresult/syslog_log.txt
75+
280904
76+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 84: 280904 Killed dmesg -w > results/audiotestresult/dmesg_log.txt
77+
280905
78+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 84: 280905 Killed parec --rate=48000 --format=s16le --channels=1 --file-format=wav /tmp/rec1.wav -d regular0
79+
-------------------Completed audio_record_test Testcase----------------------------
80+
81+
3. Results will be available in the `Runner/suites/Multimedia/Audio/AudioRecord/audio_test.txt` directory.
82+
83+
84+
## Notes
85+
86+
- The script does not take any arguments.
87+
- It validates the presence of required libraries before executing tests.
88+
- If any critical tool is missing, the script exits with an error message.
89+
90+
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
#!/bin/sh
5+
6+
# Import test suite definitions
7+
. $(pwd)/init_env
8+
TESTNAME="audio_record_test"
9+
TESTBINARY="parec"
10+
11+
#Global variable to hold PID which needs to be killed at the end of the test
12+
KILLPID=()
13+
14+
# Import test functions
15+
. $TOOLS/functestlib.sh
16+
test_path=$(find_test_case_by_name "$TESTNAME")
17+
echo "--------------------------------------------------------------------------"
18+
echo "-------------------Starting $TESTNAME Testcase----------------------------"
19+
20+
echo "Checking if dependency binary is available"
21+
check_dependencies $TESTBINARY
22+
23+
# Prepare environment
24+
mkdir -p results/audiotestresult
25+
chmod -R 777 results/audiotestresult
26+
27+
# Start logs
28+
dmesg -C
29+
tail -f /var/log/syslog > results/audiotestresult/syslog_log.txt &
30+
KILLPID[${#KILLPID[@]}+1]="$!"
31+
32+
dmesg -w > results/audiotestresult/dmesg_log.txt &
33+
KILLPID[${#KILLPID[@]}+1]="$!"
34+
35+
#Start the Playback
36+
parec --rate=48000 --format=s16le --channels=1 --file-format=wav /tmp/rec1.wav -d regular0 &
37+
PID = $!
38+
KILLPID[${#KILLPID[@]}+1]="$!"
39+
sleep 10
40+
41+
#Check whether playback started
42+
if [-z "$PID"]; then
43+
echo "Fail to start the test binary $TESTBINARY"
44+
exit 1
45+
else
46+
echo "Test Binary $TESTBINARY is running successfully"
47+
fi
48+
49+
check_audio_pid_alive() {
50+
echo "Param $$1"
51+
local pid = "$1"
52+
local result_file="results/audiotestresult/stdout.txt"
53+
ps -ax | grep $TESTBINARY | head -1 2>&1 | tee "$result_file"
54+
55+
if grep -q "$pid" "$result_file"; then
56+
echo "Successfully audio record completed"
57+
return 0
58+
else
59+
echo "Fail to start audio record"
60+
return 1
61+
fi
62+
}
63+
64+
# Final status, Print overall test result
65+
echo "=== Overall Audio Test Validation Result ==="
66+
if check_audio_pid_alive "$PID"; then
67+
log_pass "$TESTNAME : Test PASS"
68+
echo "$TESTNAME : Test Pass" > $test_path/$TESTNAME.res
69+
else
70+
log_fail "$TESTNAME : Test FAIL"
71+
echo "$TESTNAME : Test Fail" > $test_path/$TESTNAME.res
72+
fi
73+
74+
75+
#Clean up
76+
echo "Clean up the old PID by Killing the process"
77+
# Loop through the array
78+
for id in "${KILLPID[@]}"; do
79+
echo $id
80+
kill -9 $id >/dev/null 2>&1
81+
sleep 1
82+
done
83+
84+
echo "-------------------Completed $TESTNAME Testcase----------------------------"

0 commit comments

Comments
 (0)