diff --git a/Runner/suites/Multimedia/Video/README_Video.md b/Runner/suites/Multimedia/Video/README_Video.md new file mode 100644 index 0000000..48d56a7 --- /dev/null +++ b/Runner/suites/Multimedia/Video/README_Video.md @@ -0,0 +1,77 @@ +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +# Iris V4L2 Video Test Scripts for RB3 Gen2 (Yocto) + +## Overview + +Video scripts automates the validation of video encoding and decoding capabilities on the Qualcomm RB3 Gen2 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 + +## Features + +- V4L2 driver level test +- Encoding YUV to H264 bitstream +- Decoding H264 bitstream to YUV +- Compatible with Yocto-based root filesystem + +## Prerequisites + +Ensure the following components are present in the target Yocto build: + +- `iris_v4l2_test` (available in /usr/bin/) - this test app can be compiled from https://github.com/quic/v4l-video-test-app +- input json file for iris_v4l2_test app +- input bitstream for decode script +- input YUV for encode script +- Write access to root filesystem (for environment setup) + +## Directory Structure + +```bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Video/ +│ │ │ ├── iris_v4l2_video_encode/ +│ │ │ │ ├── H264Encoder.json +│ │ │ │ ├── run.sh +│ │ │ ├── iris_v4l2_video_decode/ +│ │ │ │ ├── H264Decoder.json +│ │ │ │ ├── run.sh +``` + +## Usage + +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. + +2. Verify Transfer: Ensure that the repo have been successfully copied to the /var directory on the target device. + +3. Run Scripts: Navigate to the /var directory 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:/var +ssh user@target_device_ip +cd /var/Runner && ./run-test.sh iris_v4l2_video_encode +``` +Sample output: +sh-5.2# cd /var/Runner && ./run-test.sh iris_v4l2_video_encode +[Executing test case: /var/Runner/suites/Multimedia/Video/iris_v4l2_video_encode] 1980-01-08 22:22:15 - +[INFO] 1980-01-08 22:22:15 - ----------------------------------------------------------------------------------------- +[INFO] 1980-01-08 22:22:15 - -------------------Starting iris_v4l2_video_encode Testcase---------------------------- +[INFO] 1980-01-08 22:22:15 - Checking if dependency binary is available +[PASS] 1980-01-08 22:22:15 - Test related dependencies are present. +... +[PASS] 1980-01-08 22:22:17 - iris_v4l2_video_encode : Test Passed +[INFO] 1980-01-08 22:22:17 - -------------------Completed iris_v4l2_video_encode Testcase---------------------------- + +3. Results will be available in the `Runner/suites/Multimedia/Video/` directory under each usecase folder. + +## 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. \ No newline at end of file diff --git a/Runner/suites/Multimedia/Video/iris_v4l2_video_decode/h264Decoder.json b/Runner/suites/Multimedia/Video/iris_v4l2_video_decode/h264Decoder.json new file mode 100644 index 0000000..2afb90f --- /dev/null +++ b/Runner/suites/Multimedia/Video/iris_v4l2_video_decode/h264Decoder.json @@ -0,0 +1,20 @@ +{ + "ExecutionMode": "Sequential", + "TestCases": [ + { + "Name" : "Decoder Testcase", + "TestConfigs" : { + "Domain": "Decoder", + "InputPath": "./simple_AVC_720p_10fps_90frames.264", + "NumFrames": -1, + "CodecName": "AVC", + "PixelFormat": "NV12", + "Width": 1280, + "Height": 720, + "Outputpath": "./output_simple_nv12_720p_90frms.yuv", + "InputBufferCount": 16, + "OutputBufferCount": 16 + } + } + ] +} diff --git a/Runner/suites/Multimedia/Video/iris_v4l2_video_decode/run.sh b/Runner/suites/Multimedia/Video/iris_v4l2_video_decode/run.sh old mode 100755 new mode 100644 index 68be7d6..6c08856 --- a/Runner/suites/Multimedia/Video/iris_v4l2_video_decode/run.sh +++ b/Runner/suites/Multimedia/Video/iris_v4l2_video_decode/run.sh @@ -1,7 +1,10 @@ +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + #!/bin/sh # Import test suite definitions -/var/Runner/init_env -TESTNAME="video_decode" +. $(pwd)/init_env +TESTNAME="iris_v4l2_video_decode" #import test functions library . $TOOLS/functestlib.sh @@ -11,15 +14,21 @@ log_info "-------------------Starting $TESTNAME Testcase------------------------ log_info "Checking if dependency binary is available" check_dependencies iris_v4l2_test +check_network_status +extract_tar_from_url https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/IRIS-Video-Files-v1.0/video_clips_iris.tar.gz + +mkdir -p results/iris_v4l2_video_decode +chmod -R 755 results/iris_v4l2_video_decode # Run the first test -iris_v4l2_test --config /Video/DEC_AVC_NV12_BASIC_CFG.json --loglevel 15 >> video_dec.txt +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 -if grep -q "Test Passed" "video_dec.txt"; then +if grep -q "SUCCESS" ./suites/Multimedia/Video/iris_v4l2_video_decode/video_dec.txt; then log_pass "$TESTNAME : Test Passed" - echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res + echo "$TESTNAME PASS" > $test_path/$TESTNAME.res else log_fail "$TESTNAME : Test Failed" - echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res + echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res fi + log_info "-------------------Completed $TESTNAME Testcase----------------------------" \ No newline at end of file diff --git a/Runner/suites/Multimedia/Video/iris_v4l2_video_encode/h264Encoder.json b/Runner/suites/Multimedia/Video/iris_v4l2_video_encode/h264Encoder.json new file mode 100644 index 0000000..4855b5b --- /dev/null +++ b/Runner/suites/Multimedia/Video/iris_v4l2_video_encode/h264Encoder.json @@ -0,0 +1,30 @@ +{ + "ExecutionMode": "Sequential", + "TestCases": [ + { + "Name" : "Encoder Testcase", + "TestConfigs" : { + "Domain": "Encoder", + "InputPath": "./simple_nv12_720p_90frms.yuv", + "NumFrames": -1, + "CodecName": "AVC", + "PixelFormat": "NV12", + "Width": 1280, + "Height": 720, + "Outputpath": "./output_simple_AVC_720p_10fps.h264", + "InputBufferCount": 32, + "OutputBufferCount": 32, + "OperatingRate": 10, + "FrameRate": 10, + "StaticControls": [ + {"Id": "Profile", "Vtype": "String", "Value": "BASELINE"}, + {"Id": "Level", "Vtype": "String", "Value": "5.0"}, + {"Id": "FrameRC", "Vtype": "Int", "Value": 1}, + {"Id": "BitRate", "Vtype": "Int", "Value": 18000000}, + {"Id": "BitRateMode", "Vtype": "String", "Value": "CBR"}, + {"Id": "PrefixHeaderMode", "Vtype": "String", "Value": "JOINED"} + ] + } + } + ] +} diff --git a/Runner/suites/Multimedia/Video/iris_v4l2_video_encode/run.sh b/Runner/suites/Multimedia/Video/iris_v4l2_video_encode/run.sh old mode 100755 new mode 100644 index ee63ef4..5c8e552 --- a/Runner/suites/Multimedia/Video/iris_v4l2_video_encode/run.sh +++ b/Runner/suites/Multimedia/Video/iris_v4l2_video_encode/run.sh @@ -1,7 +1,10 @@ +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + #!/bin/sh # Import test suite definitions -/var/Runner/init_env -TESTNAME="video_encode" +. $(pwd)/init_env +TESTNAME="iris_v4l2_video_encode" #import test functions library . $TOOLS/functestlib.sh @@ -11,15 +14,21 @@ log_info "-------------------Starting $TESTNAME Testcase------------------------ log_info "Checking if dependency binary is available" check_dependencies iris_v4l2_test +check_network_status +extract_tar_from_url https://github.com/qualcomm-linux/qcom-linux-testkit/releases/download/IRIS-Video-Files-v1.0/video_clips_iris.tar.gz + +mkdir -p results/iris_v4l2_video_encode +chmod -R 755 results/iris_v4l2_video_encode # Run the first test -iris_v4l2_test --config /Video/ENC_AVC_NV12_BASIC_CFG.json --loglevel 15 >> video_enc.txt +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 -if grep -q "Test Passed" "video_enc.txt"; then +if grep -q "SUCCESS" ./suites/Multimedia/Video/iris_v4l2_video_encode/video_enc.txt; then log_pass "$TESTNAME : Test Passed" - echo "$TESTNAME : Test Passed" > $test_path/$TESTNAME.res + echo "$TESTNAME PASS" > $test_path/$TESTNAME.res else log_fail "$TESTNAME : Test Failed" - echo "$TESTNAME : Test Failed" > $test_path/$TESTNAME.res + echo "$TESTNAME FAIL" > $test_path/$TESTNAME.res fi + log_info "-------------------Completed $TESTNAME Testcase----------------------------" \ No newline at end of file diff --git a/Runner/utils/functestlib.sh b/Runner/utils/functestlib.sh index 93d60c4..d21e5b8 100755 --- a/Runner/utils/functestlib.sh +++ b/Runner/utils/functestlib.sh @@ -81,3 +81,65 @@ functestlibdoc() done echo "Note, these functions will probably not work with >=32 CPUs" } + +check_network_status() { + echo "[INFO] Checking network connectivity..." + + # Get first active IPv4 address (excluding loopback) + ip_addr=$(ip -4 addr show scope global up | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -n 1) + + if [ -n "$ip_addr" ]; then + echo "[PASS] Network is active. IP address: $ip_addr" + + if ping -c 1 -W 2 8.8.8.8 >/dev/null 2>&1; then + echo "[PASS] Internet is reachable." + return 0 + else + echo "[WARN] Network active but no internet access." + return 2 + fi + else + echo "[FAIL] No active network interface found." + return 1 + fi +} + +extract_tar_from_url() { + local url="$1" + local filename + local extracted_files + + # Extract the filename from the URL + filename=$(basename "$url") + + # Download the file using wget + echo "[INFO] Downloading $url..." + wget -O "$filename" "$url" + + # Check if wget was successful + if [ $? -ne 0 ]; then + echo "[FAIL] Failed to download the file." + return 1 + fi + + # Extract the tar file + echo "[INFO] Extracting $filename..." + tar -xvf "$filename" + + # Check if tar was successful + if [ $? -ne 0 ]; then + echo "[FAIL] Failed to extract the file." + return 1 + fi + + # Check if any files were extracted + extracted_files=$(tar -tf "$filename") + if [ -z "$extracted_files" ]; then + echo "[FAIL] No files were extracted." + return 1 + else + echo "[PASS] Files extracted successfully:" + echo "[INFO] $extracted_files" + return 0 + fi +}