diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf/README.md b/Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf/README.md new file mode 100644 index 000000000..7d7192bd9 --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf/README.md @@ -0,0 +1,64 @@ +# dmabuf Test + +## Overview +The dmabuf test is an IGT (Intel GPU Tools) test that validates DMA-BUF (Direct Memory Access Buffer) functionality in the display subsystem. This test verifies the kernel's ability to handle DMA-BUF operations for graphics memory sharing. + +## Test Description +This test validates: +- DMA-BUF allocation and management +- Memory sharing between different subsystems +- Buffer import/export operations +- Kernel selftests for DMA-BUF functionality + +## Prerequisites +- IGT GPU tools must be installed on the target device +- Display hardware must be available +- Weston compositor will be stopped during test execution + +## Usage + +### Basic Usage (Default) +```bash +./run-test.sh dmabuf +``` +The test will automatically use the binary at `/usr/libexec/igt-gpu-tools/dmabuf` + +### With Custom Binary Path +```bash +./run-test.sh dmabuf --dmabuf-path /custom/path/to/dmabuf +``` + +Or: +```bash +./run-test.sh dmabuf /custom/path/to/dmabuf +``` + +### Help +```bash +cd Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf +./run.sh --help +``` + +## Test Results +The test generates: +- **Result file**: `dmabuf.res` - Contains PASS/FAIL/SKIP status +- **Log file**: `dmabuf_log.txt` - Contains detailed test output + +## Expected Behavior +- **PASS**: All subtests succeed or some subtests succeed with others skipped +- **SKIP**: All subtests are skipped (e.g., when kernel selftests are not available) +- **FAIL**: One or more subtests fail or the test exits with a non-zero code + +## Common Issues +1. **Test Skipped**: If the test shows "SKIP", it typically means the required kernel selftests are not available on the system. This is not necessarily an error - it indicates the test requirements are not met. + +2. **Binary Not Found**: Ensure IGT GPU tools are installed: + ```bash + # Check if binary exists + ls -l /usr/libexec/igt-gpu-tools/dmabuf + ``` + +## Notes +- The test automatically stops Weston before execution +- Exit code 77 indicates a SKIP condition (standard IGT behavior) +- Test output is parsed for SUCCESS, FAIL, and SKIP counts diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf/run.sh b/Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf/run.sh new file mode 100755 index 000000000..5ae71b0db --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/dmabuf/run.sh @@ -0,0 +1,144 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# ---- Source init_env & tools ---- +INIT_ENV="" +SEARCH="$SCRIPT_DIR" +while [ "$SEARCH" != "/" ]; do + if [ -f "$SEARCH/init_env" ]; then INIT_ENV="$SEARCH/init_env"; break; fi + SEARCH="$(dirname "$SEARCH")" +done +if [ -z "$INIT_ENV" ]; then + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 + exit 1 +fi + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# Always source functestlib.sh, using $TOOLS exported by init_env +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + +TESTNAME="dmabuf" +result_file="./${TESTNAME}.res" +# Default IGT test binary location +DEFAULT_IGT_PATH="/usr/libexec/igt-gpu-tools" +DMABUF_CMD="$DEFAULT_IGT_PATH/$TESTNAME" + +test_path="$(find_test_case_by_name "$TESTNAME" 2>/dev/null)" +if [ -z "$test_path" ] || [ ! -d "$test_path" ]; then + test_path="$SCRIPT_DIR" +fi + +if [ ! -w "$test_path" ]; then + log_error "Cannot write to test directory: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +while [ $# -gt 0 ]; do + case "$1" in + --dmabuf-path) + shift + if [ -n "${1:-}" ]; then + DMABUF_CMD="$1" + else + log_error "Missing value for --dmabuf-path parameter" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 + fi + ;; + --help|-h) + log_info "Usage: $0 [--dmabuf-path BINARY_PATH] | [BINARY_PATH]" + log_info "Default binary path: $DEFAULT_IGT_PATH/$TESTNAME" + exit 0 + ;; + -*) + log_warn "Unknown argument: $1" + ;; + *) + DMABUF_CMD="$1" + ;; + esac + shift +done + +if ! cd "$test_path"; then + log_error "cd failed: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +log_info "-------------------Starting $TESTNAME Testcase-----------------------------" + +# Check if the binary exists and is executable +if [ ! -x "$DMABUF_CMD" ]; then + log_error "FAIL: dmabuf binary not found or not executable at: $DMABUF_CMD" + log_error "Please ensure IGT GPU tools are installed or specify the binary path with --dmabuf-path" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_info "Using dmabuf binary at: $DMABUF_CMD" + +if ! weston_stop; then + log_error "Failed to stop Weston" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_file="$test_path/${TESTNAME}_log.txt" +"$DMABUF_CMD" > "$log_file" 2>&1 +RC="$?" + +log_info "Logs written to: $log_file" + +success_count=$(grep -c "SUCCESS" "$log_file" 2>/dev/null || echo "0") +fail_count=$(grep -c "FAIL" "$log_file" 2>/dev/null || echo "0") +skip_count=$(grep -c "SKIP" "$log_file" 2>/dev/null || echo "0") + +success_count=${success_count:-0} +fail_count=${fail_count:-0} +skip_count=${skip_count:-0} + +case "$success_count" in ''|*[!0-9]*) success_count=0 ;; esac +case "$fail_count" in ''|*[!0-9]*) fail_count=0 ;; esac +case "$skip_count" in ''|*[!0-9]*) skip_count=0 ;; esac + +total_subtests=$((success_count + fail_count + skip_count)) + +log_info "Subtest Results: SUCCESS=$success_count, FAIL=$fail_count, SKIP=$skip_count, TOTAL=$total_subtests" +log_info "results will be written to \"$result_file\"" +log_info "-------------------Completed $TESTNAME Testcase----------------------------" + +if [ "$RC" -ne 0 ]; then + log_fail "$TESTNAME : Test Failed (exit code: $RC)" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$fail_count" -gt 0 ]; then + log_fail "$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ]; then + log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped" + echo "$TESTNAME SKIP" > "$result_file" + exit 0 +else + if [ "$success_count" -gt 0 ]; then + if [ "$skip_count" -gt 0 ]; then + log_pass "$TESTNAME : Test Passed - $success_count subtest(s) succeeded, $skip_count skipped" + else + log_pass "$TESTNAME : Test Passed - All $success_count subtest(s) succeeded" + fi + else + log_pass "$TESTNAME : Test Passed (return code $RC)" + fi + echo "$TESTNAME PASS" > "$result_file" + exit 0 +fi diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_setmode/README.md b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_setmode/README.md new file mode 100644 index 000000000..00bf0dd84 --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_setmode/README.md @@ -0,0 +1,80 @@ +# kms_setmode Test + +## Overview +The kms_setmode test is an IGT (Intel GPU Tools) test that validates mode setting functionality in the KMS (Kernel Mode Setting) display subsystem. This test verifies the kernel's ability to set and switch between different display modes. + +## Test Description +This test validates: +- Display mode setting operations +- Mode switching between different resolutions and refresh rates +- Multi-monitor mode configuration +- Display pipeline configuration +- CRTC (Cathode Ray Tube Controller) and connector management +- Mode validation and compatibility checking + +## Prerequisites +- IGT GPU tools must be installed on the target device +- Display hardware must be available and connected +- Weston compositor will be stopped during test execution + +## Usage + +### Basic Usage (Default) +```bash +./run-test.sh kms_setmode +``` +The test will automatically use the binary at `/usr/libexec/igt-gpu-tools/kms_setmode` + +### With Custom Binary Path +```bash +./run-test.sh kms_setmode --kms-setmode-path /custom/path/to/kms_setmode +``` + +Or: +```bash +./run-test.sh kms_setmode /custom/path/to/kms_setmode +``` + +### Help +```bash +cd Runner/suites/Multimedia/Display/igt-gpu-tools/kms_setmode +./run.sh --help +``` + +## Test Results +The test generates: +- **Result file**: `kms_setmode.res` - Contains PASS/FAIL/SKIP status +- **Log file**: `kms_setmode_log.txt` - Contains detailed test output + +## Expected Behavior +- **PASS**: All subtests succeed or some subtests succeed with others skipped +- **SKIP**: All subtests are skipped (e.g., when display hardware is not available) +- **FAIL**: One or more subtests fail or the test exits with a non-zero code + +## Common Issues +1. **No Display Connected**: The test requires an active display connection. Ensure a monitor is connected. + +2. **Mode Not Supported**: Some display modes may not be supported by the hardware or monitor. This will result in test skips for those specific modes. + +3. **Display Flicker**: During mode switching tests, you may observe brief display flicker or blanking. This is expected behavior. + +4. **Binary Not Found**: Ensure IGT GPU tools are installed: + ```bash + # Check if binary exists + ls -l /usr/libexec/igt-gpu-tools/kms_setmode + ``` + +## Test Coverage +The test typically covers: +- Single display mode setting +- Multiple display configurations +- Mode switching sequences +- Invalid mode rejection +- Display pipeline state validation + +## Notes +- The test automatically stops Weston before execution +- Mode setting tests may cause brief display disruptions +- Test output is parsed for SUCCESS, FAIL, and SKIP counts +- The test validates both successful mode sets and proper error handling for invalid modes +- Results may vary based on display hardware capabilities and connected monitors diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_setmode/run.sh b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_setmode/run.sh new file mode 100755 index 000000000..f0e677d74 --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_setmode/run.sh @@ -0,0 +1,144 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# ---- Source init_env & tools ---- +INIT_ENV="" +SEARCH="$SCRIPT_DIR" +while [ "$SEARCH" != "/" ]; do + if [ -f "$SEARCH/init_env" ]; then INIT_ENV="$SEARCH/init_env"; break; fi + SEARCH="$(dirname "$SEARCH")" +done +if [ -z "$INIT_ENV" ]; then + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 + exit 1 +fi + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# Always source functestlib.sh, using $TOOLS exported by init_env +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + +TESTNAME="kms_setmode" +result_file="./${TESTNAME}.res" +# Default IGT test binary location +DEFAULT_IGT_PATH="/usr/libexec/igt-gpu-tools" +KMS_SETMODE_CMD="$DEFAULT_IGT_PATH/$TESTNAME" + +test_path="$(find_test_case_by_name "$TESTNAME" 2>/dev/null)" +if [ -z "$test_path" ] || [ ! -d "$test_path" ]; then + test_path="$SCRIPT_DIR" +fi + +if [ ! -w "$test_path" ]; then + log_error "Cannot write to test directory: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +while [ $# -gt 0 ]; do + case "$1" in + --kms-setmode-path) + shift + if [ -n "${1:-}" ]; then + KMS_SETMODE_CMD="$1" + else + log_error "Missing value for --kms-setmode-path parameter" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 + fi + ;; + --help|-h) + log_info "Usage: $0 [--kms-setmode-path BINARY_PATH] | [BINARY_PATH]" + log_info "Default binary path: $DEFAULT_IGT_PATH/$TESTNAME" + exit 0 + ;; + -*) + log_warn "Unknown argument: $1" + ;; + *) + KMS_SETMODE_CMD="$1" + ;; + esac + shift +done + +if ! cd "$test_path"; then + log_error "cd failed: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +log_info "-------------------Starting $TESTNAME Testcase-----------------------------" + +# Check if the binary exists and is executable +if [ ! -x "$KMS_SETMODE_CMD" ]; then + log_error "FAIL: kms_setmode binary not found or not executable at: $KMS_SETMODE_CMD" + log_error "Please ensure IGT GPU tools are installed or specify the binary path with --kms-setmode-path" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_info "Using kms_setmode binary at: $KMS_SETMODE_CMD" + +if ! weston_stop; then + log_error "Failed to stop Weston" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_file="$test_path/${TESTNAME}_log.txt" +"$KMS_SETMODE_CMD" > "$log_file" 2>&1 +RC="$?" + +log_info "Logs written to: $log_file" + +success_count=$(grep -c "SUCCESS" "$log_file" 2>/dev/null || echo "0") +fail_count=$(grep -c "FAIL" "$log_file" 2>/dev/null || echo "0") +skip_count=$(grep -c "SKIP" "$log_file" 2>/dev/null || echo "0") + +success_count=${success_count:-0} +fail_count=${fail_count:-0} +skip_count=${skip_count:-0} + +case "$success_count" in ''|*[!0-9]*) success_count=0 ;; esac +case "$fail_count" in ''|*[!0-9]*) fail_count=0 ;; esac +case "$skip_count" in ''|*[!0-9]*) skip_count=0 ;; esac + +total_subtests=$((success_count + fail_count + skip_count)) + +log_info "Subtest Results: SUCCESS=$success_count, FAIL=$fail_count, SKIP=$skip_count, TOTAL=$total_subtests" +log_info "results will be written to \"$result_file\"" +log_info "-------------------Completed $TESTNAME Testcase----------------------------" + +if [ "$RC" -ne 0 ]; then + log_fail "$TESTNAME : Test Failed (exit code: $RC)" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$fail_count" -gt 0 ]; then + log_fail "$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ]; then + log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped" + echo "$TESTNAME SKIP" > "$result_file" + exit 0 +else + if [ "$success_count" -gt 0 ]; then + if [ "$skip_count" -gt 0 ]; then + log_pass "$TESTNAME : Test Passed - $success_count subtest(s) succeeded, $skip_count skipped" + else + log_pass "$TESTNAME : Test Passed - All $success_count subtest(s) succeeded" + fi + else + log_pass "$TESTNAME : Test Passed (return code $RC)" + fi + echo "$TESTNAME PASS" > "$result_file" + exit 0 +fi diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_sysfs_edid_timing/README.md b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_sysfs_edid_timing/README.md new file mode 100644 index 000000000..75449a518 --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_sysfs_edid_timing/README.md @@ -0,0 +1,75 @@ +# kms_sysfs_edid_timing Test + +## Overview +The kms_sysfs_edid_timing test is an IGT (Intel GPU Tools) test that validates EDID (Extended Display Identification Data) timing information exposed through the sysfs interface. This test verifies the kernel's ability to correctly parse and expose display timing information. + +## Test Description +This test validates: +- EDID data parsing and exposure via sysfs +- Display timing information accuracy +- Sysfs interface for EDID access +- Display mode information retrieval +- Monitor capability detection + +## Prerequisites +- IGT GPU tools must be installed on the target device +- Display hardware must be available and connected +- A monitor with valid EDID data must be connected +- Weston compositor will be stopped during test execution + +## Usage + +### Basic Usage (Default) +```bash +./run-test.sh kms_sysfs_edid_timing +``` +The test will automatically use the binary at `/usr/libexec/igt-gpu-tools/kms_sysfs_edid_timing` + +### With Custom Binary Path +```bash +./run-test.sh kms_sysfs_edid_timing --kms-sysfs-edid-timing-path /custom/path/to/kms_sysfs_edid_timing +``` + +Or: +```bash +./run-test.sh kms_sysfs_edid_timing /custom/path/to/kms_sysfs_edid_timing +``` + +### Help +```bash +cd Runner/suites/Multimedia/Display/igt-gpu-tools/kms_sysfs_edid_timing +./run.sh --help +``` + +## Test Results +The test generates: +- **Result file**: `kms_sysfs_edid_timing.res` - Contains PASS/FAIL/SKIP status +- **Log file**: `kms_sysfs_edid_timing_log.txt` - Contains detailed test output + +## Expected Behavior +- **PASS**: All subtests succeed or some subtests succeed with others skipped +- **SKIP**: All subtests are skipped (e.g., when no display is connected or EDID is not available) +- **FAIL**: One or more subtests fail or the test exits with a non-zero code + +## Common Issues +1. **No Display Connected**: The test requires a monitor with valid EDID data. Ensure a display is properly connected. + +2. **EDID Not Available**: Some displays may not provide EDID data or the data may be corrupted. This will result in test skips. + +3. **Sysfs Access**: Ensure the sysfs interface is accessible and properly mounted: + ```bash + # Check sysfs DRM entries + ls -l /sys/class/drm/ + ``` + +4. **Binary Not Found**: Ensure IGT GPU tools are installed: + ```bash + # Check if binary exists + ls -l /usr/libexec/igt-gpu-tools/kms_sysfs_edid_timing + ``` + +## Notes +- The test automatically stops Weston before execution +- EDID data is display-specific and test results may vary based on the connected monitor +- Test output is parsed for SUCCESS, FAIL, and SKIP counts +- This test is non-destructive and only reads EDID information diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_sysfs_edid_timing/run.sh b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_sysfs_edid_timing/run.sh new file mode 100755 index 000000000..1b3581e83 --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_sysfs_edid_timing/run.sh @@ -0,0 +1,144 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# ---- Source init_env & tools ---- +INIT_ENV="" +SEARCH="$SCRIPT_DIR" +while [ "$SEARCH" != "/" ]; do + if [ -f "$SEARCH/init_env" ]; then INIT_ENV="$SEARCH/init_env"; break; fi + SEARCH="$(dirname "$SEARCH")" +done +if [ -z "$INIT_ENV" ]; then + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 + exit 1 +fi + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# Always source functestlib.sh, using $TOOLS exported by init_env +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + +TESTNAME="kms_sysfs_edid_timing" +result_file="./${TESTNAME}.res" +# Default IGT test binary location +DEFAULT_IGT_PATH="/usr/libexec/igt-gpu-tools" +KMS_SYSFS_EDID_TIMING_CMD="$DEFAULT_IGT_PATH/$TESTNAME" + +test_path="$(find_test_case_by_name "$TESTNAME" 2>/dev/null)" +if [ -z "$test_path" ] || [ ! -d "$test_path" ]; then + test_path="$SCRIPT_DIR" +fi + +if [ ! -w "$test_path" ]; then + log_error "Cannot write to test directory: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +while [ $# -gt 0 ]; do + case "$1" in + --kms-sysfs-edid-timing-path) + shift + if [ -n "${1:-}" ]; then + KMS_SYSFS_EDID_TIMING_CMD="$1" + else + log_error "Missing value for --kms-sysfs-edid-timing-path parameter" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 + fi + ;; + --help|-h) + log_info "Usage: $0 [--kms-sysfs-edid-timing-path BINARY_PATH] | [BINARY_PATH]" + log_info "Default binary path: $DEFAULT_IGT_PATH/$TESTNAME" + exit 0 + ;; + -*) + log_warn "Unknown argument: $1" + ;; + *) + KMS_SYSFS_EDID_TIMING_CMD="$1" + ;; + esac + shift +done + +if ! cd "$test_path"; then + log_error "cd failed: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +log_info "-------------------Starting $TESTNAME Testcase-----------------------------" + +# Check if the binary exists and is executable +if [ ! -x "$KMS_SYSFS_EDID_TIMING_CMD" ]; then + log_error "FAIL: kms_sysfs_edid_timing binary not found or not executable at: $KMS_SYSFS_EDID_TIMING_CMD" + log_error "Please ensure IGT GPU tools are installed or specify the binary path with --kms-sysfs-edid-timing-path" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_info "Using kms_sysfs_edid_timing binary at: $KMS_SYSFS_EDID_TIMING_CMD" + +if ! weston_stop; then + log_error "Failed to stop Weston" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_file="$test_path/${TESTNAME}_log.txt" +"$KMS_SYSFS_EDID_TIMING_CMD" > "$log_file" 2>&1 +RC="$?" + +log_info "Logs written to: $log_file" + +success_count=$(grep -c "SUCCESS" "$log_file" 2>/dev/null || echo "0") +fail_count=$(grep -c "FAIL" "$log_file" 2>/dev/null || echo "0") +skip_count=$(grep -c "SKIP" "$log_file" 2>/dev/null || echo "0") + +success_count=${success_count:-0} +fail_count=${fail_count:-0} +skip_count=${skip_count:-0} + +case "$success_count" in ''|*[!0-9]*) success_count=0 ;; esac +case "$fail_count" in ''|*[!0-9]*) fail_count=0 ;; esac +case "$skip_count" in ''|*[!0-9]*) skip_count=0 ;; esac + +total_subtests=$((success_count + fail_count + skip_count)) + +log_info "Subtest Results: SUCCESS=$success_count, FAIL=$fail_count, SKIP=$skip_count, TOTAL=$total_subtests" +log_info "results will be written to \"$result_file\"" +log_info "-------------------Completed $TESTNAME Testcase----------------------------" + +if [ "$RC" -ne 0 ]; then + log_fail "$TESTNAME : Test Failed (exit code: $RC)" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$fail_count" -gt 0 ]; then + log_fail "$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ]; then + log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped" + echo "$TESTNAME SKIP" > "$result_file" + exit 0 +else + if [ "$success_count" -gt 0 ]; then + if [ "$skip_count" -gt 0 ]; then + log_pass "$TESTNAME : Test Passed - $success_count subtest(s) succeeded, $skip_count skipped" + else + log_pass "$TESTNAME : Test Passed - All $success_count subtest(s) succeeded" + fi + else + log_pass "$TESTNAME : Test Passed (return code $RC)" + fi + echo "$TESTNAME PASS" > "$result_file" + exit 0 +fi diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_vblank/README.md b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_vblank/README.md new file mode 100644 index 000000000..e0c9666c0 --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_vblank/README.md @@ -0,0 +1,79 @@ +# kms_vblank Test + +## Overview +The kms_vblank test is an IGT (Intel GPU Tools) test that validates vertical blanking (VBLANK) functionality in the KMS (Kernel Mode Setting) display subsystem. This test verifies the kernel's ability to handle VBLANK events and timing. + +## Test Description +This test validates: +- VBLANK event generation and handling +- VBLANK timing accuracy +- VBLANK synchronization across multiple pipes +- VBLANK wait operations +- Display refresh timing + +## Prerequisites +- IGT GPU tools must be installed on the target device +- Display hardware must be available and connected +- Weston compositor will be stopped during test execution + +## Usage + +### Basic Usage (Default) +```bash +./run-test.sh kms_vblank +``` +The test will automatically use the binary at `/usr/libexec/igt-gpu-tools/kms_vblank` with default subtest filtering. + +**Default Arguments**: `--run-subtest '*,!*suspend*,!*rpm*'` +- Runs all subtests except those related to suspend and runtime power management +- These subtests are excluded to prevent hanging or system instability + +### With Custom Binary Path +```bash +./run-test.sh kms_vblank --kms-vblank-path /custom/path/to/kms_vblank +``` + +### With Custom Subtest Filter +```bash +./run-test.sh kms_vblank --run-subtest 'pipe-A-*' +``` + +### Help +```bash +cd Runner/suites/Multimedia/Display/igt-gpu-tools/kms_vblank +./run.sh --help +``` + +## Test Results +The test generates: +- **Result file**: `kms_vblank.res` - Contains PASS/FAIL/SKIP status +- **Log file**: `kms_vblank_log.txt` - Contains detailed test output + +## Expected Behavior +- **PASS**: All subtests succeed or some subtests succeed with others skipped +- **SKIP**: All subtests are skipped (e.g., when display hardware is not available) +- **FAIL**: One or more subtests fail or the test exits with a non-zero code + +## Subtest Filtering +The default subtest filter excludes: +- `*suspend*` - Suspend-related tests that may hang the system +- `*rpm*` - Runtime power management tests that may cause issues + +This filtering ensures the test runs reliably without hanging. You can override this with the `--run-subtest` parameter if needed. + +## Common Issues +1. **Test Hangs**: If the test hangs, ensure you're using the default subtest filter which excludes problematic tests. + +2. **No Display Connected**: The test requires an active display connection. Ensure a monitor is connected. + +3. **Binary Not Found**: Ensure IGT GPU tools are installed: + ```bash + # Check if binary exists + ls -l /usr/libexec/igt-gpu-tools/kms_vblank + ``` + +## Notes +- The test automatically stops Weston before execution +- VBLANK tests are timing-sensitive and may show variations based on display refresh rate +- Test output is parsed for SUCCESS, FAIL, and SKIP counts +- The default subtest filter is recommended for automated testing diff --git a/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_vblank/run.sh b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_vblank/run.sh new file mode 100755 index 000000000..65792963f --- /dev/null +++ b/Runner/suites/Multimedia/Display/igt-gpu-tools/kms_vblank/run.sh @@ -0,0 +1,159 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause-Clear + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +# ---- Source init_env & tools ---- +INIT_ENV="" +SEARCH="$SCRIPT_DIR" +while [ "$SEARCH" != "/" ]; do + if [ -f "$SEARCH/init_env" ]; then INIT_ENV="$SEARCH/init_env"; break; fi + SEARCH="$(dirname "$SEARCH")" +done +if [ -z "$INIT_ENV" ]; then + echo "[ERROR] Could not find init_env (starting at $SCRIPT_DIR)" >&2 + exit 1 +fi + +# Only source if not already loaded (idempotent) +if [ -z "$__INIT_ENV_LOADED" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" +fi +# Always source functestlib.sh, using $TOOLS exported by init_env +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/functestlib.sh" + +TESTNAME="kms_vblank" +result_file="./${TESTNAME}.res" +# Default IGT test binary location +DEFAULT_IGT_PATH="/usr/libexec/igt-gpu-tools" +KMS_VBLANK_CMD="$DEFAULT_IGT_PATH/$TESTNAME" +# Default arguments to exclude problematic subtests +DEFAULT_ARGS="--run-subtest '*,!*suspend*,!*rpm*'" +TEST_ARGS="$DEFAULT_ARGS" + +test_path="$(find_test_case_by_name "$TESTNAME" 2>/dev/null)" +if [ -z "$test_path" ] || [ ! -d "$test_path" ]; then + test_path="$SCRIPT_DIR" +fi + +if [ ! -w "$test_path" ]; then + log_error "Cannot write to test directory: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +while [ $# -gt 0 ]; do + case "$1" in + --kms-vblank-path) + shift + if [ -n "${1:-}" ]; then + KMS_VBLANK_CMD="$1" + else + log_error "Missing value for --kms-vblank-path parameter" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 + fi + ;; + --run-subtest) + shift + if [ -n "${1:-}" ]; then + TEST_ARGS="--run-subtest '$1'" + else + log_error "Missing value for --run-subtest parameter" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 + fi + ;; + --help|-h) + log_info "Usage: $0 [--kms-vblank-path BINARY_PATH] [--run-subtest PATTERN]" + log_info "Default binary path: $DEFAULT_IGT_PATH/$TESTNAME" + log_info "Default subtest filter: $DEFAULT_ARGS" + exit 0 + ;; + -*) + log_warn "Unknown argument: $1" + ;; + *) + KMS_VBLANK_CMD="$1" + ;; + esac + shift +done + +if ! cd "$test_path"; then + log_error "cd failed: $test_path" + echo "$TESTNAME FAIL" >"$result_file" + exit 1 +fi + +log_info "-------------------Starting $TESTNAME Testcase-----------------------------" + +# Check if the binary exists and is executable +if [ ! -x "$KMS_VBLANK_CMD" ]; then + log_error "FAIL: kms_vblank binary not found or not executable at: $KMS_VBLANK_CMD" + log_error "Please ensure IGT GPU tools are installed or specify the binary path with --kms-vblank-path" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_info "Using kms_vblank binary at: $KMS_VBLANK_CMD" + +if ! weston_stop; then + log_error "Failed to stop Weston" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +fi + +log_file="$test_path/${TESTNAME}_log.txt" +log_info "Running with arguments: $TEST_ARGS" +eval "$KMS_VBLANK_CMD $TEST_ARGS" > "$log_file" 2>&1 +RC="$?" + +log_info "Logs written to: $log_file" + +success_count=$(grep -c "SUCCESS" "$log_file" 2>/dev/null || echo "0") +fail_count=$(grep -c "FAIL" "$log_file" 2>/dev/null || echo "0") +skip_count=$(grep -c "SKIP" "$log_file" 2>/dev/null || echo "0") + +success_count=${success_count:-0} +fail_count=${fail_count:-0} +skip_count=${skip_count:-0} + +case "$success_count" in ''|*[!0-9]*) success_count=0 ;; esac +case "$fail_count" in ''|*[!0-9]*) fail_count=0 ;; esac +case "$skip_count" in ''|*[!0-9]*) skip_count=0 ;; esac + +total_subtests=$((success_count + fail_count + skip_count)) + +log_info "Subtest Results: SUCCESS=$success_count, FAIL=$fail_count, SKIP=$skip_count, TOTAL=$total_subtests" +log_info "results will be written to \"$result_file\"" +log_info "-------------------Completed $TESTNAME Testcase----------------------------" + +if [ "$RC" -ne 0 ]; then + log_fail "$TESTNAME : Test Failed (exit code: $RC)" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$fail_count" -gt 0 ]; then + log_fail "$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests" + echo "$TESTNAME FAIL" > "$result_file" + exit 1 +elif [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ]; then + log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped" + echo "$TESTNAME SKIP" > "$result_file" + exit 0 +else + if [ "$success_count" -gt 0 ]; then + if [ "$skip_count" -gt 0 ]; then + log_pass "$TESTNAME : Test Passed - $success_count subtest(s) succeeded, $skip_count skipped" + else + log_pass "$TESTNAME : Test Passed - All $success_count subtest(s) succeeded" + fi + else + log_pass "$TESTNAME : Test Passed (return code $RC)" + fi + echo "$TESTNAME PASS" > "$result_file" + exit 0 +fi