Skip to content

Commit 91c4430

Browse files
committed
Public CI Video Decode and Encode Shell Scripts.
Implemented shell scripts for public CI for Decode and Encode Scenarios. Added Video encode test script Added Video decode test script Added readme document for video validation Implemented Function for ActiveIP Implemented Function for wget pull resource Implemented Functions for untar of resource Signed-off-by: Abhishek <[email protected]>
1 parent 73a2a03 commit 91c4430

File tree

6 files changed

+220
-12
lines changed

6 files changed

+220
-12
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
4+
# Iris V4L2 Video Test Scripts for Qualcomm Linux based platform (Yocto)
5+
6+
## Overview
7+
8+
Video scripts automates the validation of video encoding and decoding capabilities on the Qualcomm Linux based platform running a Yocto-based Linux system. It utilizes iri_v4l2_test test app which is publicly available @https://github.com/quic/v4l-video-test-app
9+
10+
## Features
11+
12+
- V4L2 driver level test
13+
- Encoding YUV to H264 bitstream
14+
- Decoding H264 bitstream to YUV
15+
- Compatible with Yocto-based root filesystem
16+
17+
## Prerequisites
18+
19+
Ensure the following components are present in the target Yocto build:
20+
21+
- `iris_v4l2_test` (available in /usr/bin/) - this test app can be compiled from https://github.com/quic/v4l-video-test-app
22+
- input json file for iris_v4l2_test app
23+
- input bitstream for decode script
24+
- input YUV for encode script
25+
- Write access to root filesystem (for environment setup)
26+
27+
## Directory Structure
28+
29+
```bash
30+
Runner/
31+
├── suites/
32+
│ ├── Multimedia/
33+
│ │ ├── Video/
34+
│ │ │ ├── iris_v4l2_video_encode/
35+
│ │ │ │ ├── H264Encoder.json
36+
│ │ │ │ ├── run.sh
37+
│ │ │ ├── iris_v4l2_video_decode/
38+
│ │ │ │ ├── H264Decoder.json
39+
│ │ │ │ ├── run.sh
40+
```
41+
42+
## Usage
43+
44+
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.
45+
46+
2. Verify Transfer: Ensure that the repo have been successfully copied to the /var directory on the target device.
47+
48+
3. Run Scripts: Navigate to the /var directory on the target device and execute the scripts as needed.
49+
50+
Run a specific test using:
51+
---
52+
Quick Example
53+
```
54+
git clone <this-repo>
55+
cd <this-repo>
56+
scp -r common Runner user@target_device_ip:/var
57+
ssh user@target_device_ip
58+
cd /var/Runner && ./run-test.sh iris_v4l2_video_encode
59+
```
60+
Sample output:
61+
```
62+
sh-5.2# cd /var/Runner && ./run-test.sh iris_v4l2_video_encode
63+
[Executing test case: /var/Runner/suites/Multimedia/Video/iris_v4l2_video_encode] 1980-01-08 22:22:15 -
64+
[INFO] 1980-01-08 22:22:15 - -----------------------------------------------------------------------------------------
65+
[INFO] 1980-01-08 22:22:15 - -------------------Starting iris_v4l2_video_encode Testcase----------------------------
66+
[INFO] 1980-01-08 22:22:15 - Checking if dependency binary is available
67+
[PASS] 1980-01-08 22:22:15 - Test related dependencies are present.
68+
...
69+
[PASS] 1980-01-08 22:22:17 - iris_v4l2_video_encode : Test Passed
70+
[INFO] 1980-01-08 22:22:17 - -------------------Completed iris_v4l2_video_encode Testcase----------------------------
71+
```
72+
3. Results will be available in the `Runner/suites/Multimedia/Video/` directory under each usecase folder.
73+
74+
## Notes
75+
76+
- The script does not take any arguments.
77+
- It validates the presence of required libraries before executing tests.
78+
- If any critical tool is missing, the script exits with an error message.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"ExecutionMode": "Sequential",
3+
"TestCases": [
4+
{
5+
"Name" : "Decoder Testcase",
6+
"TestConfigs" : {
7+
"Domain": "Decoder",
8+
"InputPath": "./simple_AVC_720p_10fps_90frames.264",
9+
"NumFrames": -1,
10+
"CodecName": "AVC",
11+
"PixelFormat": "NV12",
12+
"Width": 1280,
13+
"Height": 720,
14+
"Outputpath": "./output_simple_nv12_720p_90frms.yuv",
15+
"InputBufferCount": 16,
16+
"OutputBufferCount": 16
17+
}
18+
}
19+
]
20+
}
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
14
#!/bin/sh
25
# Import test suite definitions
3-
/var/Runner/init_env
4-
TESTNAME="video_decode"
6+
. $(pwd)/init_env
7+
TESTNAME="iris_v4l2_video_decode"
58

69
#import test functions library
710
. $TOOLS/functestlib.sh
@@ -11,15 +14,21 @@ log_info "-------------------Starting $TESTNAME Testcase------------------------
1114

1215
log_info "Checking if dependency binary is available"
1316
check_dependencies iris_v4l2_test
17+
check_network_status
18+
extract_tar_from_url https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/IRIS-Video-Files-v1.0/video_clips_iris.tar.gz
19+
20+
mkdir -p results/iris_v4l2_video_decode
21+
chmod -R 755 results/iris_v4l2_video_decode
1422

1523
# Run the first test
16-
iris_v4l2_test --config /Video/DEC_AVC_NV12_BASIC_CFG.json --loglevel 15 >> video_dec.txt
24+
iris_v4l2_test --config ./suites/Multimedia/Video/iris_v4l2_video_decode/h264Decoder.json --loglevel 15 >> ./suites/Multimedia/Video/iris_v4l2_video_decode/video_dec.txt
1725

18-
if grep -q "Test Passed" "video_dec.txt"; then
26+
if grep -q "SUCCESS" ./suites/Multimedia/Video/iris_v4l2_video_decode/video_dec.txt; then
1927
log_pass "$TESTNAME : Test Passed"
20-
echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res
28+
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res
2129
else
2230
log_fail "$TESTNAME : Test Failed"
23-
echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res
31+
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
2432
fi
33+
2534
log_info "-------------------Completed $TESTNAME Testcase----------------------------"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"ExecutionMode": "Sequential",
3+
"TestCases": [
4+
{
5+
"Name" : "Encoder Testcase",
6+
"TestConfigs" : {
7+
"Domain": "Encoder",
8+
"InputPath": "./simple_nv12_720p_90frms.yuv",
9+
"NumFrames": -1,
10+
"CodecName": "AVC",
11+
"PixelFormat": "NV12",
12+
"Width": 1280,
13+
"Height": 720,
14+
"Outputpath": "./output_simple_AVC_720p_10fps.h264",
15+
"InputBufferCount": 32,
16+
"OutputBufferCount": 32,
17+
"OperatingRate": 10,
18+
"FrameRate": 10,
19+
"StaticControls": [
20+
{"Id": "Profile", "Vtype": "String", "Value": "BASELINE"},
21+
{"Id": "Level", "Vtype": "String", "Value": "5.0"},
22+
{"Id": "FrameRC", "Vtype": "Int", "Value": 1},
23+
{"Id": "BitRate", "Vtype": "Int", "Value": 18000000},
24+
{"Id": "BitRateMode", "Vtype": "String", "Value": "CBR"},
25+
{"Id": "PrefixHeaderMode", "Vtype": "String", "Value": "JOINED"}
26+
]
27+
}
28+
}
29+
]
30+
}
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2+
# SPDX-License-Identifier: BSD-3-Clause-Clear
3+
14
#!/bin/sh
25
# Import test suite definitions
3-
/var/Runner/init_env
4-
TESTNAME="video_encode"
6+
. $(pwd)/init_env
7+
TESTNAME="iris_v4l2_video_encode"
58

69
#import test functions library
710
. $TOOLS/functestlib.sh
@@ -11,15 +14,21 @@ log_info "-------------------Starting $TESTNAME Testcase------------------------
1114

1215
log_info "Checking if dependency binary is available"
1316
check_dependencies iris_v4l2_test
17+
check_network_status
18+
extract_tar_from_url https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/IRIS-Video-Files-v1.0/video_clips_iris.tar.gz
19+
20+
mkdir -p results/iris_v4l2_video_encode
21+
chmod -R 755 results/iris_v4l2_video_encode
1422

1523
# Run the first test
16-
iris_v4l2_test --config /Video/ENC_AVC_NV12_BASIC_CFG.json --loglevel 15 >> video_enc.txt
24+
iris_v4l2_test --config ./suites/Multimedia/Video/iris_v4l2_video_encode/h264Encoder.json --loglevel 15 >> ./suites/Multimedia/Video/iris_v4l2_video_encode/video_enc.txt
1725

18-
if grep -q "Test Passed" "video_enc.txt"; then
26+
if grep -q "SUCCESS" ./suites/Multimedia/Video/iris_v4l2_video_encode/video_enc.txt; then
1927
log_pass "$TESTNAME : Test Passed"
20-
echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res
28+
echo "$TESTNAME PASS" > $test_path/$TESTNAME.res
2129
else
2230
log_fail "$TESTNAME : Test Failed"
23-
echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res
31+
echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res
2432
fi
33+
2534
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

Runner/utils/functestlib.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,65 @@ functestlibdoc()
8181
done
8282
echo "Note, these functions will probably not work with >=32 CPUs"
8383
}
84+
85+
check_network_status() {
86+
echo "[INFO] Checking network connectivity..."
87+
88+
# Get first active IPv4 address (excluding loopback)
89+
ip_addr=$(ip -4 addr show scope global up | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -n 1)
90+
91+
if [ -n "$ip_addr" ]; then
92+
echo "[PASS] Network is active. IP address: $ip_addr"
93+
94+
if ping -c 1 -W 2 8.8.8.8 >/dev/null 2>&1; then
95+
echo "[PASS] Internet is reachable."
96+
return 0
97+
else
98+
echo "[WARN] Network active but no internet access."
99+
return 2
100+
fi
101+
else
102+
echo "[FAIL] No active network interface found."
103+
return 1
104+
fi
105+
}
106+
107+
extract_tar_from_url() {
108+
local url="$1"
109+
local filename
110+
local extracted_files
111+
112+
# Extract the filename from the URL
113+
filename=$(basename "$url")
114+
115+
# Download the file using wget
116+
echo "[INFO] Downloading $url..."
117+
wget -O "$filename" "$url"
118+
119+
# Check if wget was successful
120+
if [ $? -ne 0 ]; then
121+
echo "[FAIL] Failed to download the file."
122+
return 1
123+
fi
124+
125+
# Extract the tar file
126+
echo "[INFO] Extracting $filename..."
127+
tar -xvf "$filename"
128+
129+
# Check if tar was successful
130+
if [ $? -ne 0 ]; then
131+
echo "[FAIL] Failed to extract the file."
132+
return 1
133+
fi
134+
135+
# Check if any files were extracted
136+
extracted_files=$(tar -tf "$filename")
137+
if [ -z "$extracted_files" ]; then
138+
echo "[FAIL] No files were extracted."
139+
return 1
140+
else
141+
echo "[PASS] Files extracted successfully:"
142+
echo "[INFO] $extracted_files"
143+
return 0
144+
fi
145+
}

0 commit comments

Comments
 (0)