Skip to content

Commit a09302a

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 36715d9 commit a09302a

File tree

4 files changed

+134
-129
lines changed

4 files changed

+134
-129
lines changed

Runner/suites/Multimedia/Audio/AudioPlayback/Read_me.md

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

4-
# Audio playback Validation Script for RB3 Gen2 (Yocto)
4+
# Audio playback Validation Script for Qualcomm Linux based platform (Yocto)
55

66
## Overview
77

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.
8+
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.
99

1010
## Features
1111

@@ -22,15 +22,13 @@ Ensure the following components are present in the target Yocto build:
2222

2323
```bash
2424
Runner/
25-
├utils/
26-
├ ├AudioPlayback
2725
├──suites/
28-
├── Multimedia/
29-
│ ├ ├── Audio/
30-
│ ├├── AudioPlayback/
31-
│ ├ ├ ├ ├ └── run.sh
32-
├ ├ ├ ├ └── yesterday_48KHz.wav
33-
├ ├ ├ ├ └── audio_test.txt
26+
├── Multimedia/
27+
│ ├ ├── Audio/
28+
│ ├├── AudioPlayback/
29+
│ ├ ├ ├ ├ └── run.sh
30+
├ ├ ├ ├ └── yesterday_48KHz.wav
31+
├ ├ ├ ├ └── audio_test.txt
3432
```
3533

3634
## Usage
@@ -54,40 +52,34 @@ scp -r common Runner user@target_device_ip:/var
5452
ssh user@target_device_ip
5553
cd /var/Runner && ./run-test.sh AudioPlayback
5654
```
57-
5855
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----------------------------
56+
sh-5.2# cd /var/Runner && ./run-test.sh AudioPlayback
57+
[Executing test case: /var/Runner/suites/Multimedia/Audio/AudioPlayback] 1980-01-08 18:11:49 -
58+
[INFO] 1980-01-08 18:11:49 - --------------------------------------------------------------------------
59+
[INFO] 1980-01-08 18:11:49 - -------------------Starting audio_playback_test Testcase----------------------------
60+
[INFO] 1980-01-08 18:11:49 - Checking if dependency binary is available
61+
[PASS] 1980-01-08 18:11:49 - Test related dependencies are present.
62+
[INFO] Checking network connectivity...
63+
[FAIL] No active network interface found.
64+
[INFO] Downloading https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/Pulse-Audio-Files-v1.0/AudioClips.tar.gz...
65+
[INFO] 1980-01-08 18:11:49 - Playback clip downloaded
66+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 50: [-z: command not found
67+
[INFO] 1980-01-08 18:11:59 - Test Binary paplay is running successfully
68+
[INFO] 1980-01-08 18:11:59 - === Overall Audio Test Validation Result ===
69+
[INFO] 1980-01-08 18:11:59 - Param 26916561
70+
2691687 pts/0 S+ 0:00 paplay ./suites/Multimedia/Audio/AudioPlayback/yesterday_48KHz.wav -d low-latency0
71+
[INFO] 1980-01-08 18:11:59 - Successfully audio playback completed
72+
[PASS] 1980-01-08 18:11:59 - audio_playback_test : Test Passed
73+
[INFO] 1980-01-08 18:11:59 - Clean up the old PID by Killing the process
74+
[INFO] 1980-01-08 18:11:59 - 2691685
75+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 86: 2691685 Killed tail -f /var/log/syslog > results/audiotestresult/syslog_log.txt
76+
[INFO] 1980-01-08 18:12:00 - 2691686
77+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 86: 2691686 Killed dmesg -w > results/audiotestresult/dmesg_log.txt
78+
[INFO] 1980-01-08 18:12:01 - 2691687
79+
/var/Runner/suites/Multimedia/Audio/AudioPlayback/run.sh: line 86: 2691687 Killed paplay ./suites/Multimedia/Audio/AudioPlayback/yesterday_48KHz.wav -d low-latency0
80+
[INFO] 1980-01-08 18:12:02 - -------------------Completed audio_playback_test Testcase----------------------------
8881
sh-5.2#
8982

90-
9183
3. Results will be available in the `Runner/suites/Multimedia/Audio/AudioPlayback/audio_test.txt` directory.
9284

9385

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

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@ KILLPID=()
1414
# Import test functions
1515
. $TOOLS/functestlib.sh
1616
test_path=$(find_test_case_by_name "$TESTNAME")
17-
echo "--------------------------------------------------------------------------"
18-
echo "-------------------Starting $TESTNAME Testcase----------------------------"
17+
log_info "--------------------------------------------------------------------------"
18+
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
1919

20-
echo "Checking if dependency binary is available"
20+
log_info "Checking if dependency binary is available"
2121
check_dependencies $TESTBINARY
22+
check_network_status
2223
extract_tar_from_url https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/Pulse-Audio-Files-v1.0/AudioClips.tar.gz
24+
lscontent=`ls ./suites/Multimedia/Audio/AudioPlayback/`
25+
if [[ $lscontent == *"yesterday_48KHz.wav"* ]]; then
26+
log_info "Playback clip downloaded"
27+
else
28+
log_info "Playback clip not downloaded"
29+
fi
2330

2431
# Prepare environment
2532
mkdir -p results/audiotestresult
@@ -35,51 +42,51 @@ KILLPID[${#KILLPID[@]}+1]="$!"
3542

3643
#Start the Playback
3744
paplay ./suites/Multimedia/Audio/AudioPlayback/yesterday_48KHz.wav -d low-latency0 &
38-
PID = $!
45+
PID=$!
3946
KILLPID[${#KILLPID[@]}+1]="$!"
4047
sleep 10
4148

4249
#Check whether playback started
4350
if [-z "$PID"]; then
44-
echo "Fail to start the test binary $TESTBINARY"
51+
log_info "Fail to start the test binary $TESTBINARY"
4552
exit 1
4653
else
47-
echo "Test Binary $TESTBINARY is running successfully"
54+
log_info "Test Binary $TESTBINARY is running successfully"
4855
fi
4956

5057
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
58+
log_info "Param $$1"
59+
local pid="$1"
60+
local result_file="results/audiotestresult/stdout.txt"
61+
ps -ax | grep $TESTBINARY | head -1 2>&1 | tee "$result_file"
62+
63+
if grep -q "$pid" "$result_file"; then
64+
log_info "Successfully audio playback completed"
65+
return 0
66+
else
67+
log_info "Fail to start audio playback"
68+
return 1
69+
fi
6370
}
6471

6572
# Final status, Print overall test result
66-
echo "=== Overall Audio Test Validation Result ==="
73+
log_info "=== Overall Audio Test Validation Result ==="
6774
if check_audio_pid_alive "$PID"; then
68-
log_pass "$TESTNAME : Test PASS"
69-
echo "$TESTNAME : Test Pass" > $test_path/$TESTNAME.res
75+
log_pass "$TESTNAME : Test Passed"
76+
echo "$TESTNAME : PASS" > $test_path/$TESTNAME.res
7077
else
71-
log_fail "$TESTNAME : Test FAIL"
72-
echo "$TESTNAME : Test Fail" > $test_path/$TESTNAME.res
78+
log_fail "$TESTNAME : Test Failed"
79+
echo "$TESTNAME : FAIL" > $test_path/$TESTNAME.res
7380
fi
7481

7582

7683
#Clean up
77-
echo "Clean up the old PID by Killing the process"
84+
log_info "Clean up the old PID by Killing the process"
7885
# Loop through the array
7986
for id in "${KILLPID[@]}"; do
80-
echo $id
81-
kill -9 $id >/dev/null 2>&1
82-
sleep 1
87+
log_info $id
88+
kill -9 $id >/dev/null 2>&1
89+
sleep 1
8390
done
8491

85-
echo "-------------------Completed $TESTNAME Testcase----------------------------"
92+
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

Runner/suites/Multimedia/Audio/AudioRecord/Read_me.md

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ Ensure the following components are present in the target Yocto build:
1919

2020
```bash
2121
Runner/
22-
├utils/
23-
├ ├AudioPlayback
2422
├──suites/
25-
├── Multimedia/
26-
│ ├ ├── Audio/
27-
│ ├├── AudioRecord/
28-
│ ├ ├ ├ ├ └── run.sh
29-
├ ├ ├ ├ └── audio_test.txt
23+
├── Multimedia/
24+
│ ├ ├── Audio/
25+
│ ├├── AudioRecord/
26+
│ ├ ├ ├ ├ └── run.sh
27+
├ ├ ├ ├ └── audio_test.txt
3028
```
3129

3230
## Usage
@@ -52,31 +50,29 @@ cd /var/Runner && ./run-test.sh AudioRecord
5250
```
5351

5452
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----------------------------
53+
sh-5.2# cd /var/Runner && ./run-test.sh AudioRecord
54+
[Executing test case: /var/Runner/suites/Multimedia/Audio/AudioRecord] 1980-01-08 18:13:16 -
55+
[INFO] 1980-01-08 18:13:16 - --------------------------------------------------------------------------
56+
[INFO] 1980-01-08 18:13:16 - -------------------Starting audio_record_test Testcase----------------------------
57+
[INFO] 1980-01-08 18:13:16 - Checking if dependency binary is available
58+
[PASS] 1980-01-08 18:13:16 - Test related dependencies are present.
59+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 44: [-z: command not found
60+
[INFO] 1980-01-08 18:13:28 - Test Binary parec is running successfully
61+
[INFO] 1980-01-08 18:13:28 - === Overall Audio Test Validation Result ===
62+
[INFO] 1980-01-08 18:13:28 - Param 26917541
63+
2691777 pts/0 S+ 0:00 parec --rate=48000 --format=s16le --channels=1 --file-format=wav /tmp/rec1.wav -d regular0
64+
[INFO] 1980-01-08 18:13:28 - Successfully audio record completed
65+
[PASS] 1980-01-08 18:13:28 - audio_record_test : Test Passed
66+
[INFO] 1980-01-08 18:13:28 - Clean up the old PID by Killing the process
67+
[INFO] 1980-01-08 18:13:28 - 2691773
68+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 80: 2691773 Killed tail -f /var/log/syslog > results/audiotestresult/syslog_log.txt
69+
[INFO] 1980-01-08 18:13:29 - 2691774
70+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 80: 2691774 Killed dmesg -w > results/audiotestresult/dmesg_log.txt
71+
[INFO] 1980-01-08 18:13:30 - 2691777
72+
/var/Runner/suites/Multimedia/Audio/AudioRecord/run.sh: line 80: 2691777 Killed parec --rate=48000 --format=s16le --channels=1 --file-format=wav /tmp/rec1.wav -d regular0
73+
[PASS] 1980-01-08 18:13:31 - audio_record_test : Recorded clip available
74+
[INFO] 1980-01-08 18:13:31 - -------------------Completed audio_record_test Testcase----------------------------
75+
sh-5.2#
8076

8177
3. Results will be available in the `Runner/suites/Multimedia/Audio/AudioRecord/audio_test.txt` directory.
8278

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

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ KILLPID=()
1414
# Import test functions
1515
. $TOOLS/functestlib.sh
1616
test_path=$(find_test_case_by_name "$TESTNAME")
17-
echo "--------------------------------------------------------------------------"
18-
echo "-------------------Starting $TESTNAME Testcase----------------------------"
17+
log_info "--------------------------------------------------------------------------"
18+
log_info "-------------------Starting $TESTNAME Testcase----------------------------"
1919

20-
echo "Checking if dependency binary is available"
20+
log_info "Checking if dependency binary is available"
2121
check_dependencies $TESTBINARY
2222

2323
# Prepare environment
@@ -33,52 +33,62 @@ dmesg -w > results/audiotestresult/dmesg_log.txt &
3333
KILLPID[${#KILLPID[@]}+1]="$!"
3434

3535
#Start the Playback
36+
rm -rf /tmp/rec1.wav
37+
sleep 2
3638
parec --rate=48000 --format=s16le --channels=1 --file-format=wav /tmp/rec1.wav -d regular0 &
37-
PID = $!
39+
PID=$!
3840
KILLPID[${#KILLPID[@]}+1]="$!"
3941
sleep 10
4042

4143
#Check whether playback started
4244
if [-z "$PID"]; then
43-
echo "Fail to start the test binary $TESTBINARY"
45+
log_info "Fail to start the test binary $TESTBINARY"
4446
exit 1
4547
else
46-
echo "Test Binary $TESTBINARY is running successfully"
48+
log_info "Test Binary $TESTBINARY is running successfully"
4749
fi
4850

4951
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
52+
log_info "Param $$1"
53+
local pid="$1"
54+
local result_file="results/audiotestresult/stdout.txt"
55+
ps -ax | grep $TESTBINARY | head -1 2>&1 | tee "$result_file"
56+
57+
if grep -q "$pid" "$result_file"; then
58+
log_info "Successfully audio record completed"
59+
return 0
60+
else
61+
log_info "Fail to start audio record"
62+
return 1
63+
fi
6264
}
6365

6466
# Final status, Print overall test result
65-
echo "=== Overall Audio Test Validation Result ==="
67+
log_info "=== Overall Audio Test Validation Result ==="
6668
if check_audio_pid_alive "$PID"; then
67-
log_pass "$TESTNAME : Test PASS"
68-
echo "$TESTNAME : Test Pass" > $test_path/$TESTNAME.res
69+
log_pass "$TESTNAME : Test Passed"
70+
echo "$TESTNAME : PASS" > $test_path/$TESTNAME.res
6971
else
70-
log_fail "$TESTNAME : Test FAIL"
71-
echo "$TESTNAME : Test Fail" > $test_path/$TESTNAME.res
72+
log_fail "$TESTNAME : Test Failed"
73+
echo "$TESTNAME : FAIL" > $test_path/$TESTNAME.res
7274
fi
7375

7476

7577
#Clean up
76-
echo "Clean up the old PID by Killing the process"
78+
log_info "Clean up the old PID by Killing the process"
7779
# Loop through the array
7880
for id in "${KILLPID[@]}"; do
79-
echo $id
80-
kill -9 $id >/dev/null 2>&1
81-
sleep 1
81+
log_info $id
82+
kill -9 $id >/dev/null 2>&1
83+
sleep 1
8284
done
8385

84-
echo "-------------------Completed $TESTNAME Testcase----------------------------"
86+
lscontent=`ls -l /tmp/rec1.wav`
87+
if [[ $lscontent == *"rec1.wav"* ]]; then
88+
log_pass "$TESTNAME : Recorded clip available"
89+
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res
90+
else
91+
log_fail "$TESTNAME : Recorded clip not available"
92+
echo "$TESTNAME : FAIL" > $test_path/$TESTNAME.res
93+
fi
94+
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

0 commit comments

Comments
 (0)