From 6b1f92d11898653ad886a0c150525ba8f46509b3 Mon Sep 17 00:00:00 2001 From: Jitta Vignan Date: Thu, 26 Nov 2026 07:14:45 +0530 Subject: [PATCH 1/3] utils: add reusable IGT execution and GPU state helpers Signed-off-by: Jitta Vignan --- Runner/utils/lib_display.sh | 184 +++++++++++++++++++++++++++++++++ Runner/utils/lib_igt.sh | 201 ++++++++++++++++++++++++++++++++++++ 2 files changed, 385 insertions(+) create mode 100755 Runner/utils/lib_igt.sh diff --git a/Runner/utils/lib_display.sh b/Runner/utils/lib_display.sh index c4d3e2d5b..b11f33722 100755 --- a/Runner/utils/lib_display.sh +++ b/Runner/utils/lib_display.sh @@ -6711,3 +6711,187 @@ display_kmscube_has_initialization_evidence() { END { exit(have_egl && have_gl ? 0 : 1) } ' "$dkhie_log" } + +# display_drm_node_minor +# Print the DRM minor of /dev/dri/cardN or /dev/dri/renderDN. +display_drm_node_minor() { + ddnm_name="${1##*/}" + case "$ddnm_name" in + card[0-9]*) + ddnm_minor="${ddnm_name#card}" + ;; + renderD[0-9]*) + ddnm_minor="${ddnm_name#renderD}" + ;; + *) + return 1 + ;; + esac + case "$ddnm_minor" in + ''|*[!0-9]*) + return 1 + ;; + esac + printf '%s\n' "$ddnm_minor" +} + +# display_drm_sysfs_root +# Print the DRM class directory. DISPLAY_DRM_SYSFS overrides it for fixtures. +display_drm_sysfs_root() { + printf '%s\n' "${DISPLAY_DRM_SYSFS:-/sys/class/drm}" +} + +# display_drm_sibling_node +# Print the card or render node of the DRM device that owns dev-node. +display_drm_sibling_node() { + ddsn_name="${1##*/}" + ddsn_root="$(display_drm_sysfs_root)" + display_drm_node_minor "$1" >/dev/null || return 1 + [ -e "$ddsn_root/$ddsn_name" ] || return 1 + case "$ddsn_name" in + "$2"[0-9]*) + printf '/dev/dri/%s\n' "$ddsn_name" + return 0 + ;; + esac + for ddsn_node in "$ddsn_root/$ddsn_name/device/drm/$2"[0-9]*; do + [ -e "$ddsn_node" ] || continue + printf '/dev/dri/%s\n' "${ddsn_node##*/}" + return 0 + done + return 1 +} + +# display_drm_debugfs_dirs +# Print the DRM debugfs directories of the device that owns dev-node, +# render node first, then the primary node. +display_drm_debugfs_dirs() { + debugfs_try_mount >/dev/null 2>&1 || true + for dddd_kind in renderD card; do + dddd_node="$(display_drm_sibling_node "$1" "$dddd_kind" 2>/dev/null)" || continue + dddd_minor="$(display_drm_node_minor "$dddd_node")" || continue + if [ -r "/sys/kernel/debug/dri/$dddd_minor/name" ]; then + printf '/sys/kernel/debug/dri/%s\n' "$dddd_minor" + fi + done +} + +# display_drm_driver_name +# Print the driver of the DRM device that owns dev-node, without debugfs when +# possible: the module name for modular drivers (for example msm), otherwise +# the bound driver name for built-in drivers (for example msm_dpu). The +# debugfs name file is only a last fallback. +display_drm_driver_name() { + dddn_node="${1##*/}" + dddn_root="$(display_drm_sysfs_root)" + display_drm_node_minor "$1" >/dev/null || return 1 + dddn_module="$(cd -P "$dddn_root/$dddn_node/device/driver/module" 2>/dev/null && pwd)" + if [ -n "$dddn_module" ]; then + printf '%s\n' "${dddn_module##*/}" + return 0 + fi + dddn_driver="$(cd -P "$dddn_root/$dddn_node/device/driver" 2>/dev/null && pwd)" + if [ -n "$dddn_driver" ]; then + printf '%s\n' "${dddn_driver##*/}" + return 0 + fi + for dddn_dir in $(display_drm_debugfs_dirs "$1"); do + dddn_name="$(cat "$dddn_dir/name" 2>/dev/null)" || continue + [ -n "$dddn_name" ] || continue + printf '%s\n' "${dddn_name%% *}" + return 0 + done + return 1 +} + +# display_drm_driver_matches ... +# Succeed when the driver of dev-node is one of the given names, or one of +# their bound sub-drivers such as msm_dpu or msm-mdss for msm. +display_drm_driver_matches() { + dddm_name="$(display_drm_driver_name "$1" 2>/dev/null)" || return 1 + shift + for dddm_want in "$@"; do + case "$dddm_name" in + "$dddm_want"|"$dddm_want"_*|"$dddm_want"-*) + return 0 + ;; + esac + done + return 1 +} + +# display_drm_first_render_node ... +# Print the first render node, in minor order, whose driver matches. +display_drm_first_render_node() { + ddfrn_root="$(display_drm_sysfs_root)" + for ddfrn_minor in $( + for ddfrn_entry in "$ddfrn_root"/renderD[0-9]*; do + [ -e "$ddfrn_entry" ] || continue + ddfrn_value="${ddfrn_entry##*/renderD}" + case "$ddfrn_value" in + *[!0-9]*) + continue + ;; + esac + printf '%s\n' "$ddfrn_value" + done | sort -n + ); do + if display_drm_driver_matches "/dev/dri/renderD$ddfrn_minor" "$@"; then + printf '/dev/dri/renderD%s\n' "$ddfrn_minor" + return 0 + fi + done + return 1 +} +# display_gpu_err_irq_snapshot +# Save the disable_err_irq path and value of the DRM device that owns dev-node. +# Returns: 0 when saved, 1 when the control is absent, 2 on read or write failure. +display_gpu_err_irq_snapshot() { + dgeis_state="$1" + rm -f "$dgeis_state" + + dgeis_path="" + for dgeis_dir in $(display_drm_debugfs_dirs "$2"); do + if [ -e "$dgeis_dir/disable_err_irq" ]; then + dgeis_path="$dgeis_dir/disable_err_irq" + break + fi + done + [ -n "$dgeis_path" ] || return 1 + + dgeis_value="$(cat "$dgeis_path" 2>/dev/null)" || return 2 + [ -n "$dgeis_value" ] || return 2 + + printf 'node=%s\npath=%s\nvalue=%s\n' "$2" "$dgeis_path" "$dgeis_value" >"$dgeis_state" || return 2 + return 0 +} + +# display_gpu_err_irq_restore +# Restore and verify the value saved by display_gpu_err_irq_snapshot. +# The state file is removed only after a verified restore. +# Returns: 0 when restored or nothing was saved, 1 when restoration failed. +display_gpu_err_irq_restore() { + dgeir_state="$1" + [ -f "$dgeir_state" ] || return 0 + + dgeir_path="$(sed -n 's/^path=//p' "$dgeir_state")" + dgeir_value="$(sed -n 's/^value=//p' "$dgeir_state")" + if [ -z "$dgeir_path" ] || [ -z "$dgeir_value" ]; then + log_fail "GPU error-interrupt state file is incomplete: $dgeir_state" + return 1 + fi + + dgeir_current="$(cat "$dgeir_path" 2>/dev/null || true)" + if [ "$dgeir_current" != "$dgeir_value" ]; then + printf '%s\n' "$dgeir_value" >"$dgeir_path" 2>/dev/null || true + dgeir_current="$(cat "$dgeir_path" 2>/dev/null || true)" + fi + if [ "$dgeir_current" != "$dgeir_value" ]; then + log_fail "Failed to restore $dgeir_path to $dgeir_value, current=${dgeir_current:-unreadable}" + return 1 + fi + + rm -f "$dgeir_state" + log_info "GPU error-interrupt state restored, $dgeir_path=$dgeir_value" + return 0 +} \ No newline at end of file diff --git a/Runner/utils/lib_igt.sh b/Runner/utils/lib_igt.sh new file mode 100755 index 000000000..90120df94 --- /dev/null +++ b/Runner/utils/lib_igt.sh @@ -0,0 +1,201 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause +# +# Reusable IGT GPU tools operations for the msm_* runners. +# Requires functestlib.sh, lib_display.sh for DRM node mapping, and +# lib_module_reload.sh for GPU boot-mode detection. +# Function variables use per-function prefixes, POSIX sh has no local. + +# Kernel error lines from the msm DRM device, its GPU and DRM core. +IGT_KLOG_MODULES='msm_dpu|msm_drm|msm_gpu|adreno[^:]*|\[drm' +# IGT writes its own "[IGT] : starting/finished subtest" markers to the kernel log. +IGT_KLOG_EXCLUDE='dummy regulator|supply [^ ]+ not found|using dummy regulator|\[IGT\] ' +# Fault attribution: the msm module token, the msm DRM source path, and +# GPU/DRM symbols. A bare "msm" would also match other Qualcomm drivers. +IGT_KLOG_FAULT_MODULES='\[msm\]|drivers/gpu/drm/msm/|adreno|a[2-8]xx_|msm_(gpu|gem|ioctl|ringbuffer|fence|iommu|mmu|job|submitqueue|devfreq|drv)|drm_sched_' +IGT_KLOG_FAULT_HEADERS='BUG:|WARNING:|Oops|Internal error:|Kernel panic|kernel BUG at|Unable to handle|Unhandled fault|invalid opcode:' + +# igt_gpu_owner +# Print the GPU owner selected at boot: kgsl, msm or unknown. +igt_gpu_owner() { + igo_mode="unknown" + if command -v mrv_qcom_gpu_boot_mode >/dev/null 2>&1; then + igo_mode="$(mrv_qcom_gpu_boot_mode 2>/dev/null || true)" + [ -n "$igo_mode" ] || igo_mode="unknown" + fi + if [ -e /dev/kgsl-3d0 ]; then + igo_mode="kgsl" + fi + printf '%s\n' "$igo_mode" +} + +# igt_select_msm_device +# Print the msm render node IGT must use. IGT_DEVICE is honoured when it is a +# drm:/dev/dri/ filter, otherwise the first msm render node is used. +# The msm module, its bound sub-drivers (msm_dpu, msm_mdp, ...) and the adreno +# GPU driver all identify an msm device. +# The runner passes the node to IGT with --device, which overrides .igtrc. +# Returns: 0 with the node, 1 when no msm node exists, 2 for an unsupported +# or non-msm IGT_DEVICE filter. +igt_select_msm_device() { + if [ -n "${IGT_DEVICE:-}" ]; then + case "$IGT_DEVICE" in + drm:/dev/dri/card[0-9]*|drm:/dev/dri/renderD[0-9]*) + ;; + *) + return 2 + ;; + esac + isd_node="$(display_drm_sibling_node "${IGT_DEVICE#drm:}" renderD)" || return 2 + display_drm_driver_matches "$isd_node" msm adreno || return 2 + printf '%s\n' "$isd_node" + return 0 + fi + display_drm_first_render_node msm adreno +} + +# igt_opened_devices_match +# Check every "Opened device:" line in the IGT log against the selected device. +# Returns: 0 when all match, 1 on a mismatch, 2 when the log reports no device. +igt_opened_devices_match() { + iodm_nodes="$(sed -n 's/^Opened device: //p' "$1" 2>/dev/null)" + [ -n "$iodm_nodes" ] || return 2 + iodm_rc=0 + # A here-document keeps the loop in this shell so iodm_rc survives it. + while IFS= read -r iodm_node; do + [ -n "$iodm_node" ] || continue + iodm_render="$(display_drm_sibling_node "$iodm_node" renderD 2>/dev/null || true)" + if [ "$iodm_render" != "$2" ]; then + log_fail "IGT opened $iodm_node, expected the device of $2" + iodm_rc=1 + fi + done < [args...] +# Run an IGT binary under the shared managed timeout with output in log-file. +# Only the IGT process is redirected, so caller traps keep the runner stdout. +# Set MANAGED_TIMEOUT_USE_SESSION=1 in the caller to own the whole process group. +# Returns the IGT exit status, or 124 when the deadline expired. +igt_run_binary() { + irb_timeout="$1" + irb_log="$2" + shift 2 + irb_dir="${irb_log%/*}" + irb_label="${1##*/}" + : >"$irb_log" || return 1 + # shellcheck disable=SC2016 # Expanded by the IGT launcher shell. + run_with_managed_timeout "$irb_timeout" "$irb_dir" "$irb_label" \ + sh -c 'irb_out="$1"; shift; exec "$@" >>"$irb_out" 2>&1' sh "$irb_log" "$@" +} + +# igt_count_subtests +# Print the number of "Subtest : " lines in the IGT log. +igt_count_subtests() { + ics_count=$(grep -Ec "^Subtest [^:]+: ($2)" "$1" 2>/dev/null) + case "$ics_count" in + ''|*[!0-9]*) + ics_count=0 + ;; + esac + printf '%s\n' "$ics_count" +} + +# igt_list_subtests +# Print the "Subtest : " lines matching status-regex. +igt_list_subtests() { + grep -E "^Subtest [^:]+: ($2)" "$1" 2>/dev/null || true +} + +# igt_log_version +# Print the IGT version reported in the log, or unknown. +igt_log_version() { + ilv_version="$(sed -n 's/^IGT-Version: //p' "$1" 2>/dev/null | head -n 1)" + printf '%s\n' "${ilv_version:-unknown}" +} + +# igt_kernel_log_capture +# Capture the kernel log and msm/adreno/drm error lines into dir. +# Sets IGT_KLOG_STATUS (available or unavailable) and IGT_KLOG_ACCESS_LOG. +# Returns: 0 when the capture is usable, 1 when the kernel log was unavailable. +igt_kernel_log_capture() { + # The scan runs in a subshell so a signal trap never inherits its redirection. + IGT_KLOG_STATUS="$( + scan_dmesg_errors "$1" "$IGT_KLOG_MODULES" "$IGT_KLOG_EXCLUDE" >/dev/null 2>&1 + printf '%s' "${DMESG_ACCESS_STATUS:-unknown}" + )" + [ -n "$IGT_KLOG_STATUS" ] || IGT_KLOG_STATUS="unknown" + # shellcheck disable=SC2034 # Read by the runners for the evidence-unavailable warning. + IGT_KLOG_ACCESS_LOG="$1/dmesg_access.log" + [ "$IGT_KLOG_STATUS" = "available" ] +} + +# igt_new_lines +# Write lines of current that are absent from baseline to out. +# Returns: 0 on success, 1 when the comparison itself failed. +igt_new_lines() { + if [ ! -s "$1" ]; then + cp "$2" "$3" 2>/dev/null + return + fi + grep -vxF -f "$1" "$2" >"$3" 2>/dev/null + [ "$?" -le 1 ] +} + +# igt_kernel_log_compare +# Write error lines and attributed GPU fault blocks that are new in the post +# capture to out-dir/dmesg_errors.log and out-dir/dmesg_faults.log. +# Sets IGT_KLOG_NEW_ERRORS and IGT_KLOG_NEW_FAULTS (fault block headers). +# Returns: 0 on success, 1 when a scan or comparison failed, so the result +# must be treated as unavailable evidence rather than a clean log. +igt_kernel_log_compare() { + iklc_pre="$1" + iklc_post="$2" + iklc_out="$3" + iklc_rc=0 + IGT_KLOG_NEW_ERRORS=0 + IGT_KLOG_NEW_FAULTS=0 + + igt_new_lines "$iklc_pre/dmesg_errors.log" "$iklc_post/dmesg_errors.log" \ + "$iklc_out/dmesg_errors.log" || iklc_rc=1 + + for iklc_dir in "$iklc_pre" "$iklc_post"; do + if ! kernel_log_filter_faults "$iklc_dir/dmesg_snapshot.log" "$IGT_KLOG_FAULT_MODULES" \ + >"$iklc_dir/dmesg_faults.log" 2>/dev/null; then + iklc_rc=1 + fi + done + igt_new_lines "$iklc_pre/dmesg_faults.log" "$iklc_post/dmesg_faults.log" \ + "$iklc_out/dmesg_faults.log" || iklc_rc=1 + + if [ -f "$iklc_out/dmesg_errors.log" ]; then + IGT_KLOG_NEW_ERRORS=$(wc -l <"$iklc_out/dmesg_errors.log" | tr -d '[:space:]') + fi + if [ -f "$iklc_out/dmesg_faults.log" ]; then + IGT_KLOG_NEW_FAULTS=$(grep -cE -- "$IGT_KLOG_FAULT_HEADERS" "$iklc_out/dmesg_faults.log") + fi + case "$IGT_KLOG_NEW_ERRORS" in ''|*[!0-9]*) IGT_KLOG_NEW_ERRORS=0 ;; esac + case "$IGT_KLOG_NEW_FAULTS" in ''|*[!0-9]*) IGT_KLOG_NEW_FAULTS=0 ;; esac + return "$iklc_rc" +} + +# igt_log_file_lines +# Log up to max-lines of file with the given log level (info, warn, fail). +igt_log_file_lines() { + head -n "$4" "$3" 2>/dev/null | while IFS= read -r iflf_line; do + "log_$1" "$2 $iflf_line" + done +} + +# igt_log_fault_headers +# Log the header line of every classified fault block, so each block that +# contributes to FAIL is visible on stdout even when its detail is not printed. +igt_log_fault_headers() { + grep -E -- "$IGT_KLOG_FAULT_HEADERS" "$1" 2>/dev/null | while IFS= read -r ilfh_line; do + log_fail "[fault] $ilfh_line" + done +} \ No newline at end of file From 963e2ed555ff63e230041cb6252fbbd440f91364 Mon Sep 17 00:00:00 2001 From: Jitta Vignan Date: Thu, 26 Nov 2026 07:14:45 +0530 Subject: [PATCH 2/3] Graphics: add six IGT msm validation suites Signed-off-by: Jitta Vignan --- .../Graphics/igt-gpu-tools/msm_bo/msm_bo.yaml | 20 + .../msm_bo/msm_bo_TestValidation_Readme.md | 185 ++++++++ .../Graphics/igt-gpu-tools/msm_bo/run.sh | 359 ++++++++++++++++ .../msm_mapping/msm_mapping.yaml | 20 + .../msm_mapping_TestValidation_Readme.md | 182 ++++++++ .../Graphics/igt-gpu-tools/msm_mapping/run.sh | 359 ++++++++++++++++ .../msm_perfcntrs/msm_perfcntrs.yaml | 20 + .../msm_perfcntrs_TestValidation_Readme.md | 176 ++++++++ .../igt-gpu-tools/msm_perfcntrs/run.sh | 359 ++++++++++++++++ .../msm_recovery/msm_recovery.yaml | 20 + .../msm_recovery_TestValidation_Readme.md | 183 ++++++++ .../igt-gpu-tools/msm_recovery/run.sh | 394 ++++++++++++++++++ .../igt-gpu-tools/msm_submit/msm_submit.yaml | 20 + .../msm_submit_TestValidation_Readme.md | 176 ++++++++ .../Graphics/igt-gpu-tools/msm_submit/run.sh | 359 ++++++++++++++++ .../msm_submitoverhead.yaml | 20 + ...sm_submitoverhead_TestValidation_Readme.md | 177 ++++++++ .../igt-gpu-tools/msm_submitoverhead/run.sh | 359 ++++++++++++++++ 18 files changed, 3388 insertions(+) create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/msm_bo.yaml create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/msm_bo_TestValidation_Readme.md create mode 100755 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/msm_mapping.yaml create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/msm_mapping_TestValidation_Readme.md create mode 100755 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/msm_perfcntrs.yaml create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/msm_perfcntrs_TestValidation_Readme.md create mode 100755 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/msm_recovery.yaml create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/msm_recovery_TestValidation_Readme.md create mode 100755 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/msm_submit.yaml create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/msm_submit_TestValidation_Readme.md create mode 100755 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/msm_submitoverhead.yaml create mode 100644 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/msm_submitoverhead_TestValidation_Readme.md create mode 100755 Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/run.sh diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/msm_bo.yaml b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/msm_bo.yaml new file mode 100644 index 000000000..b4d034507 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/msm_bo.yaml @@ -0,0 +1,20 @@ +metadata: + name: msm_bo + format: "Lava-Test Test Definition 1.0" + description: "Validates msm GEM buffer object ioctls with the subtests provided by the installed IGT build: allocation and cache modes, offset/IOVA/flags queries, madvise, and free, including invalid arguments. Builds that provide bo-map-* subtests also cover mmap and CPU write/read consistency. Uses the IGT msm_bo test." + os: + - linux + scope: + - functional + +params: + IGT_BIN_PATH: "/usr/libexec/igt-gpu-tools/msm_bo" + IGT_TIMEOUT: "300" + +run: + steps: + - REPO_PATH=$PWD + - cd Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo + - export IGT_TIMEOUT="${IGT_TIMEOUT}" + - ./run.sh --bin-path "${IGT_BIN_PATH}" || true + - $REPO_PATH/Runner/utils/send-to-lava.sh msm_bo.res || true diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/msm_bo_TestValidation_Readme.md b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/msm_bo_TestValidation_Readme.md new file mode 100644 index 000000000..ba53fd8d0 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/msm_bo_TestValidation_Readme.md @@ -0,0 +1,185 @@ +# License +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause +# IGT MSM BO Test Script + +## Overview + +This script automates the validation of msm GEM buffer object ioctls (allocation and cache modes, offset/IOVA/flags queries, madvise and free, including invalid arguments) using the IGT `msm_bo` test. It captures detailed logs and provides a summary of the test results with subtest-level analysis. + +## Features + +- Runs the IGT `msm_bo` test with all subtests or a single selected subtest +- GPU ownership check, the test is skipped when KGSL owns the GPU +- Timeout protection for the IGT run +- Detailed logging of test progress and results +- Reports msm/adreno/drm kernel errors raised during the run +- Output stored in the current working directory +- Selects one msm device and passes it to IGT, so execution and diagnostics use the same GPU +- Help system with usage information + +## Prerequisites + +Ensure the following components are present in the target environment: + +- IGT binary (`msm_bo`) - must be executable, default path `/usr/libexec/igt-gpu-tools/msm_bo` +- `setsid` (util-linux) - used to stop all IGT processes on timeout or interruption +- Write access to the filesystem (for logging) + +## Directory Structure +```bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Graphics/ +│ │ │ ├── igt-gpu-tools/ +│ │ │ │ ├── msm_bo/ +│ │ │ │ │ ├── run.sh +│ │ │ │ │ ├── msm_bo.yaml +│ │ │ │ │ └── msm_bo_TestValidation_Readme.md +├── utils/ +│ └── lib_igt.sh +``` + +## Usage + +1. Copy the script to your target system and make it executable: + +```bash +chmod +x run.sh +``` + +2. Run the script using one of the following methods: + +**Method 1: Default binary path** +```bash +./run.sh +``` + +**Method 2: Custom binary path** +```bash +./run.sh --bin-path +``` + +**Method 3: Single subtest** +```bash +./run.sh --subtest +``` + +**Method 4: Custom timeout** +```bash +./run.sh --timeout +``` + +**Method 5: Get help** +```bash +./run.sh --help +./run.sh -h +``` + +Examples: +```bash +./run.sh --bin-path /usr/libexec/igt-gpu-tools/msm_bo +./run.sh --timeout 600 +/usr/libexec/igt-gpu-tools/msm_bo --list-subtests +``` + +3. The result file is written to the current working directory (the suite directory when started through `run-test.sh` or LAVA). Logs of each run are kept in a separate `results/msm_bo/run-./` directory there: + - `msm_bo.res` - Test result (PASS/FAIL/SKIP), in the working directory + - `msm_bo_log.txt` - Detailed IGT output with subtest results + - `dmesg/dmesg_errors.log` - msm/adreno/drm kernel errors raised during the run + - `dmesg/dmesg_faults.log` - new GPU kernel fault blocks (Oops, BUG, panic) raised during the run + +## Output + +- **Console Output**: Real-time display of test configuration, execution and results with structured logging +- **Log File**: `msm_bo_log.txt` - Contains detailed output from the msm_bo binary including all subtests +- **Result File**: `msm_bo.res` - Contains final test status (PASS/FAIL/SKIP) +- **Kernel Log**: `dmesg/dmesg_errors.log` - Kernel errors raised during the run, reported as warnings only +- **Kernel Faults**: `dmesg/dmesg_faults.log` - New GPU kernel fault blocks raised during the run, reported as FAIL +- **Subtest Analysis**: Parsing and counting of individual subtest results, failed and skipped subtests are listed +- **Test Status Determination**: + - **FAIL**: Timeout, IGT processes not stopped after cleanup, IGT opened a device other than the selected one, any subtest FAIL/CRASH/TIMEOUT, new GPU kernel fault block, return code other than 0 or 77, invalid argument, or binary name not matching the testcase + - **SKIP**: Binary not found, KGSL owns the GPU, no msm DRM render node, `setsid` not available, return code 77, or all subtests skipped + - **PASS**: Return code 0 AND no failures (success_count > 0 OR mixed results with no failures) + +## Notes + +- The default timeout is 300 seconds, it can also be set with the `IGT_TIMEOUT` environment variable. +- Exit code 77 indicates a SKIP condition (standard IGT behavior). +- Subtest coverage depends on the installed IGT build. List the available subtests with `msm_bo --list-subtests`. + + | IGT version | msm_bo subtests | Coverage | + |---|---|---| + | v2.6 and earlier | 16 | Allocation and info queries | + | Upstream master from commit `a946c7a25` (2026-11-03), expected in IGT v2.7 | 51 | Adds `bo-alloc-cached-coherent`, `bo-madvise-*`, `bo-map-*` (mmap and CPU write/read consistency) and `bo-free-*` | + + The new subtests were added upstream by the series `8179dd770`..`a946c7a25` (tests/msm/msm_bo). Yocto images built with the IGT v2.6 recipe (SRCREV `916c79cf`) run the 16-subtest set. +- The msm device is `IGT_DEVICE` when it is a `drm:/dev/dri/` filter, otherwise the first msm render node. It is passed to IGT with `--device`, which takes precedence over `.igtrc`. Other `IGT_DEVICE` filters report FAIL. +- When the kernel log or its comparison is unavailable, a warning is printed and the result is based on the IGT output only. +- Kernel errors are printed on the console capped at 20 lines, the complete list is kept in `dmesg/dmesg_errors.log`. +- Only new GPU kernel fault blocks (Oops, BUG, panic) make the test FAIL, expected `*ERROR*` lines stay warnings. +- On failure the last 200 lines of the IGT log are printed on the console. + +## Maintenance + +- Keep the IGT binary version compatible with the kernel msm driver. +- Update the test when IGT adds or removes msm subtests. + +## Run test using: +```bash +git clone +cd +scp -r Runner user@target_device_ip: +ssh user@target_device_ip +``` + +- **Using Unified Runner** +```bash +cd /Runner +``` + +- **Run msm_bo testcase** +```bash +./run-test.sh msm_bo +./run-test.sh msm_bo --bin-path +``` + +Example: +```bash +./run-test.sh msm_bo --bin-path /usr/libexec/igt-gpu-tools/msm_bo +``` + +## EXAMPLE OUTPUT + +```text +[Executing test case: msm_bo] 2026-11-19 05:35:31 - +[INFO] 2026-11-19 05:35:31 - -------------------------------------------------------------------------- +[INFO] 2026-11-19 05:35:31 - ------------------- Starting msm_bo Testcase -------------------------- +[INFO] 2026-11-19 05:35:31 - Detected OS, qcom-distro-catchall +[INFO] 2026-11-19 05:35:31 - Kernel, 7.3.0-g17bbb4b37bbc +[INFO] 2026-11-19 05:35:31 - GPU boot mode, msm +[INFO] 2026-11-19 05:35:31 - Config, BIN=/usr/libexec/igt-gpu-tools/msm_bo SUBTEST=all TIMEOUT=300s +[INFO] 2026-11-19 05:35:31 - Evidence, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/results/msm_bo/run-. +[INFO] 2026-11-19 05:35:31 - Using IGT binary, /usr/libexec/igt-gpu-tools/msm_bo +[INFO] 2026-11-19 05:35:31 - Launching /usr/libexec/igt-gpu-tools/msm_bo with timeout 300s +[INFO] 2026-11-19 05:35:32 - IGT version, 2.6-2.6 (aarch64) (Linux: 7.3.0-g17bbb4b37bbc aarch64) +[INFO] 2026-11-19 05:35:32 - IGT log, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/results/msm_bo/run-./msm_bo_log.txt +[WARN] 2026-11-19 05:35:32 - Kernel errors raised during msm_bo, count=1 (capped at 20 lines), /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/results/msm_bo/run-./dmesg/dmesg_errors.log +[WARN] 2026-11-19 05:35:32 - [dmesg] [ 2339.727321] [drm:msm_ioctl_gem_new [msm]] *ERROR* invalid flags: 02000000 +[INFO] 2026-11-19 05:35:32 - Subtest results, SUCCESS=51 FAIL=0 SKIP=0 TOTAL=51 rc=0 +[INFO] 2026-11-19 05:35:32 - ------------------- Completed msm_bo Testcase ------------------------- +[PASS] 2026-11-19 05:35:32 - msm_bo PASS - 51 subtest(s) passed, 0 skipped +[PASS] 2026-11-19 05:35:32 - msm_bo passed + +[INFO] 2026-11-19 05:35:32 - ========== Test Summary ========== +PASSED: +msm_bo + +FAILED: + None + +SKIPPED: + None +[INFO] 2026-11-19 05:35:32 - ================================== +``` diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh new file mode 100755 index 000000000..7e598445d --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh @@ -0,0 +1,359 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause + +# usage +# Print the supported command-line options. +usage() { + cat < filter selecting the msm device +EOF +} + +# parse_args ARG... +# Parse options into runner globals, setting PARSE_ERROR on invalid input. +parse_args() { + while [ "$#" -gt 0 ]; do + case "$1" in + --bin-path|--subtest|--timeout) + if [ "$#" -lt 2 ] || [ -z "$2" ]; then + PARSE_ERROR="$1 requires a value" + return 1 + fi + case "$1" in + --bin-path) + IGT_BIN="$2" + ;; + --subtest) + IGT_SUBTEST="$2" + ;; + *) + IGT_RUN_TIMEOUT="$2" + ;; + esac + shift 2 + ;; + -h|--help) + SHOW_HELP=1 + shift + ;; + *) + PARSE_ERROR="unknown argument: $1" + return 1 + ;; + esac + done + return 0 +} + +WORK_DIR="$(pwd -P)" +IGT_BIN="/usr/libexec/igt-gpu-tools/msm_bo" +IGT_SUBTEST="" +IGT_RUN_TIMEOUT="${IGT_TIMEOUT:-300}" +SHOW_HELP=0 +PARSE_ERROR="" + +parse_args "$@" +PARSE_RC=$? + +if [ "$SHOW_HELP" -eq 1 ]; then + usage + exit 0 +fi + +if [ ! -w "$WORK_DIR" ]; then + echo "[ERROR] Current directory is not writable for results: $WORK_DIR" >&2 + exit 1 +fi + +# ---------- Repo env + helpers ---------- +SCRIPT_DIR="$( + cd "$(dirname "$0")" || exit 1 + pwd +)" +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 + +if [ -z "${__INIT_ENV_LOADED:-}" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" + __INIT_ENV_LOADED=1 +fi + +# shellcheck disable=SC1090 +. "$INIT_ENV" +# shellcheck disable=SC1091 +. "$TOOLS/functestlib.sh" +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/lib_display.sh" +if [ -r "$TOOLS/lib_pkg_provider.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_pkg_provider.sh" +fi +if [ -r "$TOOLS/lib_module_reload.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_module_reload.sh" +fi +# shellcheck disable=SC1091 +. "$TOOLS/lib_igt.sh" + +TESTNAME="msm_bo" +RES_FILE="$WORK_DIR/$TESTNAME.res" +test_result_init "$TESTNAME" "$RES_FILE" || exit 1 + +if [ "$PARSE_RC" -ne 0 ]; then + usage >&2 + test_result_finish FAIL "$TESTNAME FAIL - $PARSE_ERROR" +fi + +case "$IGT_RUN_TIMEOUT" in + ''|*[!0-9]*|0*) + test_result_finish FAIL "$TESTNAME FAIL - timeout must be a positive integer, value=$IGT_RUN_TIMEOUT" + ;; +esac +if [ "${#IGT_RUN_TIMEOUT}" -gt 9 ]; then + test_result_finish FAIL "$TESTNAME FAIL - timeout exceeds the supported seconds range" +fi + +OUT_DIR=$(test_create_run_directory "$WORK_DIR/results/$TESTNAME") || + test_result_finish FAIL "$TESTNAME FAIL - cannot create a run directory in $WORK_DIR/results/$TESTNAME" +IGT_LOG="$OUT_DIR/${TESTNAME}_log.txt" +KLOG_DIR="$OUT_DIR/dmesg" +mkdir -p "$KLOG_DIR" || test_result_finish FAIL "$TESTNAME FAIL - cannot create $KLOG_DIR" + +# cleanup +# Stop the owned IGT process group. +cleanup() { + managed_timeout_cancel_bounded 5 && return 0 + log_fail "$TESTNAME IGT processes are still running after cleanup" + return 1 +} + +# interrupt_test +# Clean up, publish FAIL and preserve the signal exit status. +interrupt_test() { + # A repeated signal must not re-enter cleanup or the state restore. + trap '' HUP INT TERM + if ! cleanup; then + test_result_record FAIL "$TESTNAME cleanup failed during interruption" + fi + ( + TEST_RESULT_CLEANUP="" + test_result_finish FAIL "$TESTNAME FAIL - interrupted" + ) + exit "$1" +} + +# exit_test +# Clean up on every exit, publish FAIL if that fails, then hand over to the +# init_env stdout handler. +exit_test() { + exit_status=$? + if ! cleanup; then + log_fail "$TESTNAME cleanup failed at exit" + printf '%s FAIL\n' "$TESTNAME" >"$RES_FILE" 2>/dev/null || true + fi + if [ -n "${__RUN_STDOUT_ACTIVE:-}" ] && + command -v _runner_stdout_cleanup >/dev/null 2>&1; then + _runner_stdout_cleanup "$exit_status" + fi + exit "$exit_status" +} + +# shellcheck disable=SC2034 # Consumed by the shared managed timeout helpers. +MANAGED_TIMEOUT_USE_SESSION=1 +# shellcheck disable=SC2034 # Consumed by the shared result finalizer. +TEST_RESULT_CLEANUP=cleanup +trap exit_test EXIT +trap 'interrupt_test 129' HUP +trap 'interrupt_test 130' INT +trap 'interrupt_test 143' TERM + +OS_ID="unknown" +if command -v pkg_detect_os_id >/dev/null 2>&1; then + OS_ID="$(pkg_detect_os_id 2>/dev/null || true)" +fi +[ -n "$OS_ID" ] || OS_ID="unknown" +GPU_OWNER="$(igt_gpu_owner)" + +log_info "--------------------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase --------------------------" +log_info "Detected OS, $OS_ID" +log_info "Kernel, $(uname -r)" +log_info "GPU boot mode, $GPU_OWNER" +log_info "Config, BIN=$IGT_BIN SUBTEST=${IGT_SUBTEST:-all} TIMEOUT=${IGT_RUN_TIMEOUT}s" +log_info "Evidence, $OUT_DIR" + +if [ ! -x "$IGT_BIN" ]; then + test_result_finish SKIP "$TESTNAME SKIP - IGT binary is unavailable: $IGT_BIN" +fi + +if [ "$(basename "$IGT_BIN")" != "$TESTNAME" ]; then + test_result_finish FAIL "$TESTNAME FAIL - binary $(basename "$IGT_BIN") does not match testcase $TESTNAME" +fi + +if [ "$GPU_OWNER" = "kgsl" ]; then + test_result_finish SKIP "$TESTNAME SKIP - GPU is owned by KGSL, msm GPU driver is required" +fi + +if ! command -v setsid >/dev/null 2>&1; then + test_result_finish SKIP "$TESTNAME SKIP - image-provided setsid is required for owned IGT process cleanup" +fi + +# Owned-session timeouts and fault attribution come from the current functestlib.sh. +for required_helper in bounded_timeout_pid_running kernel_log_filter_faults; do + if ! command -v "$required_helper" >/dev/null 2>&1; then + test_result_finish FAIL "$TESTNAME FAIL - required helper is unavailable: $required_helper, functestlib.sh is older than this suite" + fi +done +IGT_DEVICE_NODE="$(igt_select_msm_device)" +case "$?" in + 0) + ;; + 1) + test_result_finish SKIP "$TESTNAME SKIP - no msm DRM render node is available" + ;; + *) + test_result_finish FAIL "$TESTNAME FAIL - IGT_DEVICE=$IGT_DEVICE is not a drm:/dev/dri/ filter for an msm device" + ;; +esac +log_info "IGT device, $IGT_DEVICE_NODE" + +KLOG_PRE_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/pre"; then + KLOG_PRE_STATUS="available" +fi +KLOG_PRE_ACCESS="$IGT_KLOG_ACCESS_LOG" + +set -- "$IGT_BIN" --device "drm:$IGT_DEVICE_NODE" +if [ -n "$IGT_SUBTEST" ]; then + set -- "$@" --run-subtest "$IGT_SUBTEST" +fi + +log_info "Using IGT binary, $IGT_BIN" +log_info "Launching $* with timeout ${IGT_RUN_TIMEOUT}s" +igt_run_binary "$IGT_RUN_TIMEOUT" "$IGT_LOG" "$@" +IGT_RC=$? +IGT_TIMED_OUT="${MANAGED_TIMEOUT_EXPIRED:-0}" +IGT_CLEANUP_FAILED=0 +if [ -n "${MANAGED_TIMEOUT_CMD_PID:-}${MANAGED_TIMEOUT_WATCHER_PID:-}" ]; then + IGT_CLEANUP_FAILED=1 +fi + +log_info "IGT version, $(igt_log_version "$IGT_LOG")" +log_info "IGT log, $IGT_LOG" + +DEVICE_MISMATCH=0 +igt_opened_devices_match "$IGT_LOG" "$IGT_DEVICE_NODE" +case "$?" in + 0) + log_info "IGT opened the selected device, $IGT_DEVICE_NODE" + ;; + 1) + DEVICE_MISMATCH=1 + ;; + *) + log_warn "IGT log does not report the opened device" + ;; +esac + +KLOG_POST_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/post"; then + KLOG_POST_STATUS="available" +fi +KLOG_POST_ACCESS="$IGT_KLOG_ACCESS_LOG" + +KLOG_FAULT=0 +if [ "$KLOG_PRE_STATUS" != "available" ] || [ "$KLOG_POST_STATUS" != "available" ]; then + log_warn "Kernel log evidence unavailable, pre=$KLOG_PRE_STATUS post=$KLOG_POST_STATUS, see $KLOG_PRE_ACCESS and $KLOG_POST_ACCESS" +elif ! igt_kernel_log_compare "$KLOG_DIR/pre" "$KLOG_DIR/post" "$KLOG_DIR"; then + log_warn "Kernel log evidence unavailable, the fault or error comparison failed in $KLOG_DIR" +else + if [ "$IGT_KLOG_NEW_ERRORS" -gt 0 ]; then + log_warn "Kernel errors raised during $TESTNAME, count=$IGT_KLOG_NEW_ERRORS (capped at 20 lines), $KLOG_DIR/dmesg_errors.log" + igt_log_file_lines warn "[dmesg]" "$KLOG_DIR/dmesg_errors.log" 20 + else + log_info "No new msm/adreno/drm kernel errors" + fi + if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then + KLOG_FAULT=1 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + fi +fi + +PASS_COUNT="$(igt_count_subtests "$IGT_LOG" "SUCCESS")" +FAIL_COUNT="$(igt_count_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT")" +SKIP_COUNT="$(igt_count_subtests "$IGT_LOG" "SKIP")" +TOTAL_COUNT=$((PASS_COUNT + FAIL_COUNT + SKIP_COUNT)) +log_info "Subtest results, SUCCESS=$PASS_COUNT FAIL=$FAIL_COUNT SKIP=$SKIP_COUNT TOTAL=$TOTAL_COUNT rc=$IGT_RC" + +igt_list_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT" | while IFS= read -r subtest_line; do + log_fail "$subtest_line" +done +igt_list_subtests "$IGT_LOG" "SKIP" | while IFS= read -r subtest_line; do + log_skip "$subtest_line" +done + +FINAL="PASS" +REASON="$PASS_COUNT subtest(s) passed, $SKIP_COUNT skipped" +if [ "$IGT_TIMED_OUT" = "1" ]; then + FINAL="FAIL" + REASON="timed out after ${IGT_RUN_TIMEOUT}s" +elif [ "$IGT_CLEANUP_FAILED" -eq 1 ]; then + FINAL="FAIL" + REASON="owned IGT processes remain after cleanup" +elif [ "$DEVICE_MISMATCH" -eq 1 ]; then + FINAL="FAIL" + REASON="IGT opened a device other than $IGT_DEVICE_NODE" +elif [ "$FAIL_COUNT" -gt 0 ]; then + FINAL="FAIL" + REASON="$FAIL_COUNT of $TOTAL_COUNT subtest(s) failed" +elif [ "$KLOG_FAULT" -eq 1 ]; then + FINAL="FAIL" + REASON="new GPU kernel fault, see $KLOG_DIR/dmesg_faults.log" +elif [ "$IGT_RC" -eq 77 ]; then + FINAL="SKIP" + REASON="IGT reported SKIP, exit code 77" +elif [ "$IGT_RC" -ne 0 ]; then + FINAL="FAIL" + REASON="IGT exited with code $IGT_RC" +elif [ "$PASS_COUNT" -eq 0 ] && [ "$SKIP_COUNT" -gt 0 ]; then + FINAL="SKIP" + REASON="all $SKIP_COUNT subtest(s) skipped" +fi + +if [ "$FINAL" = "FAIL" ]; then + log_info "----- Last 200 IGT log lines -----" + tail -n 200 "$IGT_LOG" 2>/dev/null | while IFS= read -r igt_line; do + log_info "[igt] $igt_line" + done + log_info "----- End IGT log -----" +fi + +log_info "------------------- Completed $TESTNAME Testcase -------------------------" +test_result_finish "$FINAL" "$TESTNAME $FINAL - $REASON" diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/msm_mapping.yaml b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/msm_mapping.yaml new file mode 100644 index 000000000..35d4bb84b --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/msm_mapping.yaml @@ -0,0 +1,20 @@ +metadata: + name: msm_mapping + format: "Lava-Test Test Definition 1.0" + description: "Validates GPU address-space mappings and that invalid GPU accesses raise IOMMU faults. Uses the IGT msm_mapping test." + os: + - linux + scope: + - functional + +params: + IGT_BIN_PATH: "/usr/libexec/igt-gpu-tools/msm_mapping" + IGT_TIMEOUT: "300" + +run: + steps: + - REPO_PATH=$PWD + - cd Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping + - export IGT_TIMEOUT="${IGT_TIMEOUT}" + - ./run.sh --bin-path "${IGT_BIN_PATH}" || true + - $REPO_PATH/Runner/utils/send-to-lava.sh msm_mapping.res || true diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/msm_mapping_TestValidation_Readme.md b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/msm_mapping_TestValidation_Readme.md new file mode 100644 index 000000000..f09ca00d8 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/msm_mapping_TestValidation_Readme.md @@ -0,0 +1,182 @@ +# License +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause +# IGT MSM Mapping Test Script + +## Overview + +This script automates the validation of GPU address-space mappings and IOMMU fault handling using the IGT `msm_mapping` test. It captures detailed logs and provides a summary of the test results with subtest-level analysis. + +## Features + +- Runs the IGT `msm_mapping` test with all subtests or a single selected subtest +- GPU ownership check, the test is skipped when KGSL owns the GPU +- Timeout protection for the IGT run +- Detailed logging of test progress and results +- Reports msm/adreno/drm kernel errors raised during the run +- Output stored in the current working directory +- Selects one msm device and passes it to IGT, so execution and diagnostics use the same GPU +- Help system with usage information + +## Prerequisites + +Ensure the following components are present in the target environment: + +- IGT binary (`msm_mapping`) - must be executable, default path `/usr/libexec/igt-gpu-tools/msm_mapping` +- `setsid` (util-linux) - used to stop all IGT processes on timeout or interruption +- Write access to the filesystem (for logging) + +## Directory Structure +```bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Graphics/ +│ │ │ ├── igt-gpu-tools/ +│ │ │ │ ├── msm_mapping/ +│ │ │ │ │ ├── run.sh +│ │ │ │ │ ├── msm_mapping.yaml +│ │ │ │ │ └── msm_mapping_TestValidation_Readme.md +├── utils/ +│ └── lib_igt.sh +``` + +## Usage + +1. Copy the script to your target system and make it executable: + +```bash +chmod +x run.sh +``` + +2. Run the script using one of the following methods: + +**Method 1: Default binary path** +```bash +./run.sh +``` + +**Method 2: Custom binary path** +```bash +./run.sh --bin-path +``` + +**Method 3: Single subtest** +```bash +./run.sh --subtest +``` + +**Method 4: Custom timeout** +```bash +./run.sh --timeout +``` + +**Method 5: Get help** +```bash +./run.sh --help +./run.sh -h +``` + +Examples: +```bash +./run.sh --bin-path /usr/libexec/igt-gpu-tools/msm_mapping +./run.sh --timeout 600 +/usr/libexec/igt-gpu-tools/msm_mapping --list-subtests +``` + +3. The result file is written to the current working directory (the suite directory when started through `run-test.sh` or LAVA). Logs of each run are kept in a separate `results/msm_mapping/run-./` directory there: + - `msm_mapping.res` - Test result (PASS/FAIL/SKIP), in the working directory + - `msm_mapping_log.txt` - Detailed IGT output with subtest results + - `dmesg/dmesg_errors.log` - msm/adreno/drm kernel errors raised during the run + - `dmesg/dmesg_faults.log` - new GPU kernel fault blocks (Oops, BUG, panic) raised during the run + +## Output + +- **Console Output**: Real-time display of test configuration, execution and results with structured logging +- **Log File**: `msm_mapping_log.txt` - Contains detailed output from the msm_mapping binary including all subtests +- **Result File**: `msm_mapping.res` - Contains final test status (PASS/FAIL/SKIP) +- **Kernel Log**: `dmesg/dmesg_errors.log` - Kernel errors raised during the run, reported as warnings only +- **Kernel Faults**: `dmesg/dmesg_faults.log` - New GPU kernel fault blocks raised during the run, reported as FAIL +- **Subtest Analysis**: Parsing and counting of individual subtest results, failed and skipped subtests are listed +- **Test Status Determination**: + - **FAIL**: Timeout, IGT processes not stopped after cleanup, IGT opened a device other than the selected one, any subtest FAIL/CRASH/TIMEOUT, new GPU kernel fault block, return code other than 0 or 77, invalid argument, or binary name not matching the testcase + - **SKIP**: Binary not found, KGSL owns the GPU, no msm DRM render node, `setsid` not available, return code 77, or all subtests skipped + - **PASS**: Return code 0 AND no failures (success_count > 0 OR mixed results with no failures) + +## Notes + +- The default timeout is 300 seconds, it can also be set with the `IGT_TIMEOUT` environment variable. +- Exit code 77 indicates a SKIP condition (standard IGT behavior). +- The msm device is `IGT_DEVICE` when it is a `drm:/dev/dri/` filter, otherwise the first msm render node. It is passed to IGT with `--device`, which takes precedence over `.igtrc`. Other `IGT_DEVICE` filters report FAIL. +- When the kernel log or its comparison is unavailable, a warning is printed and the result is based on the IGT output only. +- Kernel errors are printed on the console capped at 20 lines, the complete list is kept in `dmesg/dmesg_errors.log`. +- Only new GPU kernel fault blocks (Oops, BUG, panic) make the test FAIL, expected `*ERROR*` lines stay warnings. +- On failure the last 200 lines of the IGT log are printed on the console. +- The test deliberately triggers GPU faults. `gpu fault` and `hangcheck recover!` kernel messages naming `msm_mapping` are expected. + +## Maintenance + +- Keep the IGT binary version compatible with the kernel msm driver. +- Update the test when IGT adds or removes msm subtests. + +## Run test using: +```bash +git clone +cd +scp -r Runner user@target_device_ip: +ssh user@target_device_ip +``` + +- **Using Unified Runner** +```bash +cd /Runner +``` + +- **Run msm_mapping testcase** +```bash +./run-test.sh msm_mapping +./run-test.sh msm_mapping --bin-path +``` + +Example: +```bash +./run-test.sh msm_mapping --bin-path /usr/libexec/igt-gpu-tools/msm_mapping +``` + +## EXAMPLE OUTPUT + +```text +[Executing test case: msm_mapping] 2026-11-19 05:35:55 - +[INFO] 2026-11-19 05:35:55 - -------------------------------------------------------------------------- +[INFO] 2026-11-19 05:35:55 - ------------------- Starting msm_mapping Testcase -------------------------- +[INFO] 2026-11-19 05:35:55 - Detected OS, qcom-distro-catchall +[INFO] 2026-11-19 05:35:55 - Kernel, 7.3.0-g17bbb4b37bbc +[INFO] 2026-11-19 05:35:55 - GPU boot mode, msm +[INFO] 2026-11-19 05:35:55 - Config, BIN=/usr/libexec/igt-gpu-tools/msm_mapping SUBTEST=all TIMEOUT=300s +[INFO] 2026-11-19 05:35:55 - Evidence, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/results/msm_mapping/run-. +[INFO] 2026-11-19 05:35:55 - Using IGT binary, /usr/libexec/igt-gpu-tools/msm_mapping +[INFO] 2026-11-19 05:35:55 - Launching /usr/libexec/igt-gpu-tools/msm_mapping with timeout 300s +[INFO] 2026-11-19 05:36:01 - IGT version, 2.6-2.6 (aarch64) (Linux: 7.3.0-g17bbb4b37bbc aarch64) +[INFO] 2026-11-19 05:36:01 - IGT log, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/results/msm_mapping/run-./msm_mapping_log.txt +[WARN] 2026-11-19 05:36:01 - Kernel errors raised during msm_mapping, count=24 (capped at 20 lines), /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/results/msm_mapping/run-./dmesg/dmesg_errors.log +[WARN] 2026-11-19 05:36:01 - [dmesg] [ 2363.822876] adreno 5900000.gpu: [drm:a6xx_irq [msm]] *ERROR* gpu fault ring 0 fence 300d9f status 00800005 rb 0035/0044 ib1 0000000100000000/0000 ib2 0000000000000000/0000 +[WARN] 2026-11-19 05:36:01 - [dmesg] [ 2363.823471] msm_dpu 5e01000.display-controller: [drm:recover_worker [msm]] *ERROR* 07000400: hangcheck recover! +... +[INFO] 2026-11-19 05:36:01 - Subtest results, SUCCESS=5 FAIL=0 SKIP=2 TOTAL=7 rc=0 +[SKIP] 2026-11-19 05:36:02 - Subtest preempt_record_ring0: SKIP (0.103s) +[SKIP] 2026-11-19 05:36:02 - Subtest preempt_smmu_info_ring0: SKIP (0.102s) +[INFO] 2026-11-19 05:36:02 - ------------------- Completed msm_mapping Testcase ------------------------- +[PASS] 2026-11-19 05:36:02 - msm_mapping PASS - 5 subtest(s) passed, 2 skipped +[PASS] 2026-11-19 05:36:02 - msm_mapping passed + +[INFO] 2026-11-19 05:36:02 - ========== Test Summary ========== +PASSED: +msm_mapping + +FAILED: + None + +SKIPPED: + None +[INFO] 2026-11-19 05:36:02 - ================================== +``` diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh new file mode 100755 index 000000000..6f49bff98 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh @@ -0,0 +1,359 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause + +# usage +# Print the supported command-line options. +usage() { + cat < filter selecting the msm device +EOF +} + +# parse_args ARG... +# Parse options into runner globals, setting PARSE_ERROR on invalid input. +parse_args() { + while [ "$#" -gt 0 ]; do + case "$1" in + --bin-path|--subtest|--timeout) + if [ "$#" -lt 2 ] || [ -z "$2" ]; then + PARSE_ERROR="$1 requires a value" + return 1 + fi + case "$1" in + --bin-path) + IGT_BIN="$2" + ;; + --subtest) + IGT_SUBTEST="$2" + ;; + *) + IGT_RUN_TIMEOUT="$2" + ;; + esac + shift 2 + ;; + -h|--help) + SHOW_HELP=1 + shift + ;; + *) + PARSE_ERROR="unknown argument: $1" + return 1 + ;; + esac + done + return 0 +} + +WORK_DIR="$(pwd -P)" +IGT_BIN="/usr/libexec/igt-gpu-tools/msm_mapping" +IGT_SUBTEST="" +IGT_RUN_TIMEOUT="${IGT_TIMEOUT:-300}" +SHOW_HELP=0 +PARSE_ERROR="" + +parse_args "$@" +PARSE_RC=$? + +if [ "$SHOW_HELP" -eq 1 ]; then + usage + exit 0 +fi + +if [ ! -w "$WORK_DIR" ]; then + echo "[ERROR] Current directory is not writable for results: $WORK_DIR" >&2 + exit 1 +fi + +# ---------- Repo env + helpers ---------- +SCRIPT_DIR="$( + cd "$(dirname "$0")" || exit 1 + pwd +)" +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 + +if [ -z "${__INIT_ENV_LOADED:-}" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" + __INIT_ENV_LOADED=1 +fi + +# shellcheck disable=SC1090 +. "$INIT_ENV" +# shellcheck disable=SC1091 +. "$TOOLS/functestlib.sh" +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/lib_display.sh" +if [ -r "$TOOLS/lib_pkg_provider.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_pkg_provider.sh" +fi +if [ -r "$TOOLS/lib_module_reload.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_module_reload.sh" +fi +# shellcheck disable=SC1091 +. "$TOOLS/lib_igt.sh" + +TESTNAME="msm_mapping" +RES_FILE="$WORK_DIR/$TESTNAME.res" +test_result_init "$TESTNAME" "$RES_FILE" || exit 1 + +if [ "$PARSE_RC" -ne 0 ]; then + usage >&2 + test_result_finish FAIL "$TESTNAME FAIL - $PARSE_ERROR" +fi + +case "$IGT_RUN_TIMEOUT" in + ''|*[!0-9]*|0*) + test_result_finish FAIL "$TESTNAME FAIL - timeout must be a positive integer, value=$IGT_RUN_TIMEOUT" + ;; +esac +if [ "${#IGT_RUN_TIMEOUT}" -gt 9 ]; then + test_result_finish FAIL "$TESTNAME FAIL - timeout exceeds the supported seconds range" +fi + +OUT_DIR=$(test_create_run_directory "$WORK_DIR/results/$TESTNAME") || + test_result_finish FAIL "$TESTNAME FAIL - cannot create a run directory in $WORK_DIR/results/$TESTNAME" +IGT_LOG="$OUT_DIR/${TESTNAME}_log.txt" +KLOG_DIR="$OUT_DIR/dmesg" +mkdir -p "$KLOG_DIR" || test_result_finish FAIL "$TESTNAME FAIL - cannot create $KLOG_DIR" + +# cleanup +# Stop the owned IGT process group. +cleanup() { + managed_timeout_cancel_bounded 5 && return 0 + log_fail "$TESTNAME IGT processes are still running after cleanup" + return 1 +} + +# interrupt_test +# Clean up, publish FAIL and preserve the signal exit status. +interrupt_test() { + # A repeated signal must not re-enter cleanup or the state restore. + trap '' HUP INT TERM + if ! cleanup; then + test_result_record FAIL "$TESTNAME cleanup failed during interruption" + fi + ( + TEST_RESULT_CLEANUP="" + test_result_finish FAIL "$TESTNAME FAIL - interrupted" + ) + exit "$1" +} + +# exit_test +# Clean up on every exit, publish FAIL if that fails, then hand over to the +# init_env stdout handler. +exit_test() { + exit_status=$? + if ! cleanup; then + log_fail "$TESTNAME cleanup failed at exit" + printf '%s FAIL\n' "$TESTNAME" >"$RES_FILE" 2>/dev/null || true + fi + if [ -n "${__RUN_STDOUT_ACTIVE:-}" ] && + command -v _runner_stdout_cleanup >/dev/null 2>&1; then + _runner_stdout_cleanup "$exit_status" + fi + exit "$exit_status" +} + +# shellcheck disable=SC2034 # Consumed by the shared managed timeout helpers. +MANAGED_TIMEOUT_USE_SESSION=1 +# shellcheck disable=SC2034 # Consumed by the shared result finalizer. +TEST_RESULT_CLEANUP=cleanup +trap exit_test EXIT +trap 'interrupt_test 129' HUP +trap 'interrupt_test 130' INT +trap 'interrupt_test 143' TERM + +OS_ID="unknown" +if command -v pkg_detect_os_id >/dev/null 2>&1; then + OS_ID="$(pkg_detect_os_id 2>/dev/null || true)" +fi +[ -n "$OS_ID" ] || OS_ID="unknown" +GPU_OWNER="$(igt_gpu_owner)" + +log_info "--------------------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase --------------------------" +log_info "Detected OS, $OS_ID" +log_info "Kernel, $(uname -r)" +log_info "GPU boot mode, $GPU_OWNER" +log_info "Config, BIN=$IGT_BIN SUBTEST=${IGT_SUBTEST:-all} TIMEOUT=${IGT_RUN_TIMEOUT}s" +log_info "Evidence, $OUT_DIR" + +if [ ! -x "$IGT_BIN" ]; then + test_result_finish SKIP "$TESTNAME SKIP - IGT binary is unavailable: $IGT_BIN" +fi + +if [ "$(basename "$IGT_BIN")" != "$TESTNAME" ]; then + test_result_finish FAIL "$TESTNAME FAIL - binary $(basename "$IGT_BIN") does not match testcase $TESTNAME" +fi + +if [ "$GPU_OWNER" = "kgsl" ]; then + test_result_finish SKIP "$TESTNAME SKIP - GPU is owned by KGSL, msm GPU driver is required" +fi + +if ! command -v setsid >/dev/null 2>&1; then + test_result_finish SKIP "$TESTNAME SKIP - image-provided setsid is required for owned IGT process cleanup" +fi + +# Owned-session timeouts and fault attribution come from the current functestlib.sh. +for required_helper in bounded_timeout_pid_running kernel_log_filter_faults; do + if ! command -v "$required_helper" >/dev/null 2>&1; then + test_result_finish FAIL "$TESTNAME FAIL - required helper is unavailable: $required_helper, functestlib.sh is older than this suite" + fi +done +IGT_DEVICE_NODE="$(igt_select_msm_device)" +case "$?" in + 0) + ;; + 1) + test_result_finish SKIP "$TESTNAME SKIP - no msm DRM render node is available" + ;; + *) + test_result_finish FAIL "$TESTNAME FAIL - IGT_DEVICE=$IGT_DEVICE is not a drm:/dev/dri/ filter for an msm device" + ;; +esac +log_info "IGT device, $IGT_DEVICE_NODE" + +KLOG_PRE_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/pre"; then + KLOG_PRE_STATUS="available" +fi +KLOG_PRE_ACCESS="$IGT_KLOG_ACCESS_LOG" + +set -- "$IGT_BIN" --device "drm:$IGT_DEVICE_NODE" +if [ -n "$IGT_SUBTEST" ]; then + set -- "$@" --run-subtest "$IGT_SUBTEST" +fi + +log_info "Using IGT binary, $IGT_BIN" +log_info "Launching $* with timeout ${IGT_RUN_TIMEOUT}s" +igt_run_binary "$IGT_RUN_TIMEOUT" "$IGT_LOG" "$@" +IGT_RC=$? +IGT_TIMED_OUT="${MANAGED_TIMEOUT_EXPIRED:-0}" +IGT_CLEANUP_FAILED=0 +if [ -n "${MANAGED_TIMEOUT_CMD_PID:-}${MANAGED_TIMEOUT_WATCHER_PID:-}" ]; then + IGT_CLEANUP_FAILED=1 +fi + +log_info "IGT version, $(igt_log_version "$IGT_LOG")" +log_info "IGT log, $IGT_LOG" + +DEVICE_MISMATCH=0 +igt_opened_devices_match "$IGT_LOG" "$IGT_DEVICE_NODE" +case "$?" in + 0) + log_info "IGT opened the selected device, $IGT_DEVICE_NODE" + ;; + 1) + DEVICE_MISMATCH=1 + ;; + *) + log_warn "IGT log does not report the opened device" + ;; +esac + +KLOG_POST_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/post"; then + KLOG_POST_STATUS="available" +fi +KLOG_POST_ACCESS="$IGT_KLOG_ACCESS_LOG" + +KLOG_FAULT=0 +if [ "$KLOG_PRE_STATUS" != "available" ] || [ "$KLOG_POST_STATUS" != "available" ]; then + log_warn "Kernel log evidence unavailable, pre=$KLOG_PRE_STATUS post=$KLOG_POST_STATUS, see $KLOG_PRE_ACCESS and $KLOG_POST_ACCESS" +elif ! igt_kernel_log_compare "$KLOG_DIR/pre" "$KLOG_DIR/post" "$KLOG_DIR"; then + log_warn "Kernel log evidence unavailable, the fault or error comparison failed in $KLOG_DIR" +else + if [ "$IGT_KLOG_NEW_ERRORS" -gt 0 ]; then + log_warn "Kernel errors raised during $TESTNAME, count=$IGT_KLOG_NEW_ERRORS (capped at 20 lines), $KLOG_DIR/dmesg_errors.log" + igt_log_file_lines warn "[dmesg]" "$KLOG_DIR/dmesg_errors.log" 20 + else + log_info "No new msm/adreno/drm kernel errors" + fi + if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then + KLOG_FAULT=1 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + fi +fi + +PASS_COUNT="$(igt_count_subtests "$IGT_LOG" "SUCCESS")" +FAIL_COUNT="$(igt_count_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT")" +SKIP_COUNT="$(igt_count_subtests "$IGT_LOG" "SKIP")" +TOTAL_COUNT=$((PASS_COUNT + FAIL_COUNT + SKIP_COUNT)) +log_info "Subtest results, SUCCESS=$PASS_COUNT FAIL=$FAIL_COUNT SKIP=$SKIP_COUNT TOTAL=$TOTAL_COUNT rc=$IGT_RC" + +igt_list_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT" | while IFS= read -r subtest_line; do + log_fail "$subtest_line" +done +igt_list_subtests "$IGT_LOG" "SKIP" | while IFS= read -r subtest_line; do + log_skip "$subtest_line" +done + +FINAL="PASS" +REASON="$PASS_COUNT subtest(s) passed, $SKIP_COUNT skipped" +if [ "$IGT_TIMED_OUT" = "1" ]; then + FINAL="FAIL" + REASON="timed out after ${IGT_RUN_TIMEOUT}s" +elif [ "$IGT_CLEANUP_FAILED" -eq 1 ]; then + FINAL="FAIL" + REASON="owned IGT processes remain after cleanup" +elif [ "$DEVICE_MISMATCH" -eq 1 ]; then + FINAL="FAIL" + REASON="IGT opened a device other than $IGT_DEVICE_NODE" +elif [ "$FAIL_COUNT" -gt 0 ]; then + FINAL="FAIL" + REASON="$FAIL_COUNT of $TOTAL_COUNT subtest(s) failed" +elif [ "$KLOG_FAULT" -eq 1 ]; then + FINAL="FAIL" + REASON="new GPU kernel fault, see $KLOG_DIR/dmesg_faults.log" +elif [ "$IGT_RC" -eq 77 ]; then + FINAL="SKIP" + REASON="IGT reported SKIP, exit code 77" +elif [ "$IGT_RC" -ne 0 ]; then + FINAL="FAIL" + REASON="IGT exited with code $IGT_RC" +elif [ "$PASS_COUNT" -eq 0 ] && [ "$SKIP_COUNT" -gt 0 ]; then + FINAL="SKIP" + REASON="all $SKIP_COUNT subtest(s) skipped" +fi + +if [ "$FINAL" = "FAIL" ]; then + log_info "----- Last 200 IGT log lines -----" + tail -n 200 "$IGT_LOG" 2>/dev/null | while IFS= read -r igt_line; do + log_info "[igt] $igt_line" + done + log_info "----- End IGT log -----" +fi + +log_info "------------------- Completed $TESTNAME Testcase -------------------------" +test_result_finish "$FINAL" "$TESTNAME $FINAL - $REASON" diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/msm_perfcntrs.yaml b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/msm_perfcntrs.yaml new file mode 100644 index 000000000..c91255166 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/msm_perfcntrs.yaml @@ -0,0 +1,20 @@ +metadata: + name: msm_perfcntrs + format: "Lava-Test Test Definition 1.0" + description: "Validates msm GPU performance counter group discovery, reservation and conflict handling. Counter samples are not read. Uses the IGT msm_perfcntrs test." + os: + - linux + scope: + - functional + +params: + IGT_BIN_PATH: "/usr/libexec/igt-gpu-tools/msm_perfcntrs" + IGT_TIMEOUT: "300" + +run: + steps: + - REPO_PATH=$PWD + - cd Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs + - export IGT_TIMEOUT="${IGT_TIMEOUT}" + - ./run.sh --bin-path "${IGT_BIN_PATH}" || true + - $REPO_PATH/Runner/utils/send-to-lava.sh msm_perfcntrs.res || true diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/msm_perfcntrs_TestValidation_Readme.md b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/msm_perfcntrs_TestValidation_Readme.md new file mode 100644 index 000000000..524c87511 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/msm_perfcntrs_TestValidation_Readme.md @@ -0,0 +1,176 @@ +# License +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause +# IGT MSM Perfcntrs Test Script + +## Overview + +This script automates the validation of msm GPU performance counter configuration and allocation (group discovery, reservation and conflict handling; counter samples are not read) using the IGT `msm_perfcntrs` test. It captures detailed logs and provides a summary of the test results with subtest-level analysis. + +## Features + +- Runs the IGT `msm_perfcntrs` test with all subtests or a single selected subtest +- GPU ownership check, the test is skipped when KGSL owns the GPU +- Timeout protection for the IGT run +- Detailed logging of test progress and results +- Reports msm/adreno/drm kernel errors raised during the run +- Output stored in the current working directory +- Selects one msm device and passes it to IGT, so execution and diagnostics use the same GPU +- Help system with usage information + +## Prerequisites + +Ensure the following components are present in the target environment: + +- IGT binary (`msm_perfcntrs`) - must be executable, default path `/usr/libexec/igt-gpu-tools/msm_perfcntrs` +- `setsid` (util-linux) - used to stop all IGT processes on timeout or interruption +- Write access to the filesystem (for logging) + +## Directory Structure +```bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Graphics/ +│ │ │ ├── igt-gpu-tools/ +│ │ │ │ ├── msm_perfcntrs/ +│ │ │ │ │ ├── run.sh +│ │ │ │ │ ├── msm_perfcntrs.yaml +│ │ │ │ │ └── msm_perfcntrs_TestValidation_Readme.md +├── utils/ +│ └── lib_igt.sh +``` + +## Usage + +1. Copy the script to your target system and make it executable: + +```bash +chmod +x run.sh +``` + +2. Run the script using one of the following methods: + +**Method 1: Default binary path** +```bash +./run.sh +``` + +**Method 2: Custom binary path** +```bash +./run.sh --bin-path +``` + +**Method 3: Single subtest** +```bash +./run.sh --subtest +``` + +**Method 4: Custom timeout** +```bash +./run.sh --timeout +``` + +**Method 5: Get help** +```bash +./run.sh --help +./run.sh -h +``` + +Examples: +```bash +./run.sh --bin-path /usr/libexec/igt-gpu-tools/msm_perfcntrs +./run.sh --timeout 600 +/usr/libexec/igt-gpu-tools/msm_perfcntrs --list-subtests +``` + +3. The result file is written to the current working directory (the suite directory when started through `run-test.sh` or LAVA). Logs of each run are kept in a separate `results/msm_perfcntrs/run-./` directory there: + - `msm_perfcntrs.res` - Test result (PASS/FAIL/SKIP), in the working directory + - `msm_perfcntrs_log.txt` - Detailed IGT output with subtest results + - `dmesg/dmesg_errors.log` - msm/adreno/drm kernel errors raised during the run + - `dmesg/dmesg_faults.log` - new GPU kernel fault blocks (Oops, BUG, panic) raised during the run + +## Output + +- **Console Output**: Real-time display of test configuration, execution and results with structured logging +- **Log File**: `msm_perfcntrs_log.txt` - Contains detailed output from the msm_perfcntrs binary including all subtests +- **Result File**: `msm_perfcntrs.res` - Contains final test status (PASS/FAIL/SKIP) +- **Kernel Log**: `dmesg/dmesg_errors.log` - Kernel errors raised during the run, reported as warnings only +- **Kernel Faults**: `dmesg/dmesg_faults.log` - New GPU kernel fault blocks raised during the run, reported as FAIL +- **Subtest Analysis**: Parsing and counting of individual subtest results, failed and skipped subtests are listed +- **Test Status Determination**: + - **FAIL**: Timeout, IGT processes not stopped after cleanup, IGT opened a device other than the selected one, any subtest FAIL/CRASH/TIMEOUT, new GPU kernel fault block, return code other than 0 or 77, invalid argument, or binary name not matching the testcase + - **SKIP**: Binary not found, KGSL owns the GPU, no msm DRM render node, `setsid` not available, return code 77, or all subtests skipped + - **PASS**: Return code 0 AND no failures (success_count > 0 OR mixed results with no failures) + +## Notes + +- The default timeout is 300 seconds, it can also be set with the `IGT_TIMEOUT` environment variable. +- Exit code 77 indicates a SKIP condition (standard IGT behavior). +- The msm device is `IGT_DEVICE` when it is a `drm:/dev/dri/` filter, otherwise the first msm render node. It is passed to IGT with `--device`, which takes precedence over `.igtrc`. Other `IGT_DEVICE` filters report FAIL. +- When the kernel log or its comparison is unavailable, a warning is printed and the result is based on the IGT output only. +- Kernel errors are printed on the console capped at 20 lines, the complete list is kept in `dmesg/dmesg_errors.log`. +- Only new GPU kernel fault blocks (Oops, BUG, panic) make the test FAIL, expected `*ERROR*` lines stay warnings. +- On failure the last 200 lines of the IGT log are printed on the console. + +## Maintenance + +- Keep the IGT binary version compatible with the kernel msm driver. +- Update the test when IGT adds or removes msm subtests. + +## Run test using: +```bash +git clone +cd +scp -r Runner user@target_device_ip: +ssh user@target_device_ip +``` + +- **Using Unified Runner** +```bash +cd /Runner +``` + +- **Run msm_perfcntrs testcase** +```bash +./run-test.sh msm_perfcntrs +./run-test.sh msm_perfcntrs --bin-path +``` + +Example: +```bash +./run-test.sh msm_perfcntrs --bin-path /usr/libexec/igt-gpu-tools/msm_perfcntrs +``` + +## EXAMPLE OUTPUT + +```text +[Executing test case: msm_perfcntrs] 2026-11-19 05:36:15 - +[INFO] 2026-11-19 05:36:15 - -------------------------------------------------------------------------- +[INFO] 2026-11-19 05:36:15 - ------------------- Starting msm_perfcntrs Testcase -------------------------- +[INFO] 2026-11-19 05:36:15 - Detected OS, qcom-distro-catchall +[INFO] 2026-11-19 05:36:15 - Kernel, 7.3.0-g17bbb4b37bbc +[INFO] 2026-11-19 05:36:15 - GPU boot mode, msm +[INFO] 2026-11-19 05:36:15 - Config, BIN=/usr/libexec/igt-gpu-tools/msm_perfcntrs SUBTEST=all TIMEOUT=300s +[INFO] 2026-11-19 05:36:15 - Evidence, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/results/msm_perfcntrs/run-. +[INFO] 2026-11-19 05:36:15 - Using IGT binary, /usr/libexec/igt-gpu-tools/msm_perfcntrs +[INFO] 2026-11-19 05:36:15 - Launching /usr/libexec/igt-gpu-tools/msm_perfcntrs with timeout 300s +[INFO] 2026-11-19 05:36:16 - IGT version, 2.6-2.6 (aarch64) (Linux: 7.3.0-g17bbb4b37bbc aarch64) +[INFO] 2026-11-19 05:36:16 - IGT log, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/results/msm_perfcntrs/run-./msm_perfcntrs_log.txt +[INFO] 2026-11-19 05:36:16 - No new msm/adreno/drm kernel errors +[INFO] 2026-11-19 05:36:16 - Subtest results, SUCCESS=6 FAIL=0 SKIP=0 TOTAL=6 rc=0 +[INFO] 2026-11-19 05:36:17 - ------------------- Completed msm_perfcntrs Testcase ------------------------- +[PASS] 2026-11-19 05:36:17 - msm_perfcntrs PASS - 6 subtest(s) passed, 0 skipped +[PASS] 2026-11-19 05:36:17 - msm_perfcntrs passed + +[INFO] 2026-11-19 05:36:17 - ========== Test Summary ========== +PASSED: +msm_perfcntrs + +FAILED: + None + +SKIPPED: + None +[INFO] 2026-11-19 05:36:17 - ================================== +``` diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh new file mode 100755 index 000000000..d4ee51627 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh @@ -0,0 +1,359 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause + +# usage +# Print the supported command-line options. +usage() { + cat < filter selecting the msm device +EOF +} + +# parse_args ARG... +# Parse options into runner globals, setting PARSE_ERROR on invalid input. +parse_args() { + while [ "$#" -gt 0 ]; do + case "$1" in + --bin-path|--subtest|--timeout) + if [ "$#" -lt 2 ] || [ -z "$2" ]; then + PARSE_ERROR="$1 requires a value" + return 1 + fi + case "$1" in + --bin-path) + IGT_BIN="$2" + ;; + --subtest) + IGT_SUBTEST="$2" + ;; + *) + IGT_RUN_TIMEOUT="$2" + ;; + esac + shift 2 + ;; + -h|--help) + SHOW_HELP=1 + shift + ;; + *) + PARSE_ERROR="unknown argument: $1" + return 1 + ;; + esac + done + return 0 +} + +WORK_DIR="$(pwd -P)" +IGT_BIN="/usr/libexec/igt-gpu-tools/msm_perfcntrs" +IGT_SUBTEST="" +IGT_RUN_TIMEOUT="${IGT_TIMEOUT:-300}" +SHOW_HELP=0 +PARSE_ERROR="" + +parse_args "$@" +PARSE_RC=$? + +if [ "$SHOW_HELP" -eq 1 ]; then + usage + exit 0 +fi + +if [ ! -w "$WORK_DIR" ]; then + echo "[ERROR] Current directory is not writable for results: $WORK_DIR" >&2 + exit 1 +fi + +# ---------- Repo env + helpers ---------- +SCRIPT_DIR="$( + cd "$(dirname "$0")" || exit 1 + pwd +)" +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 + +if [ -z "${__INIT_ENV_LOADED:-}" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" + __INIT_ENV_LOADED=1 +fi + +# shellcheck disable=SC1090 +. "$INIT_ENV" +# shellcheck disable=SC1091 +. "$TOOLS/functestlib.sh" +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/lib_display.sh" +if [ -r "$TOOLS/lib_pkg_provider.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_pkg_provider.sh" +fi +if [ -r "$TOOLS/lib_module_reload.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_module_reload.sh" +fi +# shellcheck disable=SC1091 +. "$TOOLS/lib_igt.sh" + +TESTNAME="msm_perfcntrs" +RES_FILE="$WORK_DIR/$TESTNAME.res" +test_result_init "$TESTNAME" "$RES_FILE" || exit 1 + +if [ "$PARSE_RC" -ne 0 ]; then + usage >&2 + test_result_finish FAIL "$TESTNAME FAIL - $PARSE_ERROR" +fi + +case "$IGT_RUN_TIMEOUT" in + ''|*[!0-9]*|0*) + test_result_finish FAIL "$TESTNAME FAIL - timeout must be a positive integer, value=$IGT_RUN_TIMEOUT" + ;; +esac +if [ "${#IGT_RUN_TIMEOUT}" -gt 9 ]; then + test_result_finish FAIL "$TESTNAME FAIL - timeout exceeds the supported seconds range" +fi + +OUT_DIR=$(test_create_run_directory "$WORK_DIR/results/$TESTNAME") || + test_result_finish FAIL "$TESTNAME FAIL - cannot create a run directory in $WORK_DIR/results/$TESTNAME" +IGT_LOG="$OUT_DIR/${TESTNAME}_log.txt" +KLOG_DIR="$OUT_DIR/dmesg" +mkdir -p "$KLOG_DIR" || test_result_finish FAIL "$TESTNAME FAIL - cannot create $KLOG_DIR" + +# cleanup +# Stop the owned IGT process group. +cleanup() { + managed_timeout_cancel_bounded 5 && return 0 + log_fail "$TESTNAME IGT processes are still running after cleanup" + return 1 +} + +# interrupt_test +# Clean up, publish FAIL and preserve the signal exit status. +interrupt_test() { + # A repeated signal must not re-enter cleanup or the state restore. + trap '' HUP INT TERM + if ! cleanup; then + test_result_record FAIL "$TESTNAME cleanup failed during interruption" + fi + ( + TEST_RESULT_CLEANUP="" + test_result_finish FAIL "$TESTNAME FAIL - interrupted" + ) + exit "$1" +} + +# exit_test +# Clean up on every exit, publish FAIL if that fails, then hand over to the +# init_env stdout handler. +exit_test() { + exit_status=$? + if ! cleanup; then + log_fail "$TESTNAME cleanup failed at exit" + printf '%s FAIL\n' "$TESTNAME" >"$RES_FILE" 2>/dev/null || true + fi + if [ -n "${__RUN_STDOUT_ACTIVE:-}" ] && + command -v _runner_stdout_cleanup >/dev/null 2>&1; then + _runner_stdout_cleanup "$exit_status" + fi + exit "$exit_status" +} + +# shellcheck disable=SC2034 # Consumed by the shared managed timeout helpers. +MANAGED_TIMEOUT_USE_SESSION=1 +# shellcheck disable=SC2034 # Consumed by the shared result finalizer. +TEST_RESULT_CLEANUP=cleanup +trap exit_test EXIT +trap 'interrupt_test 129' HUP +trap 'interrupt_test 130' INT +trap 'interrupt_test 143' TERM + +OS_ID="unknown" +if command -v pkg_detect_os_id >/dev/null 2>&1; then + OS_ID="$(pkg_detect_os_id 2>/dev/null || true)" +fi +[ -n "$OS_ID" ] || OS_ID="unknown" +GPU_OWNER="$(igt_gpu_owner)" + +log_info "--------------------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase --------------------------" +log_info "Detected OS, $OS_ID" +log_info "Kernel, $(uname -r)" +log_info "GPU boot mode, $GPU_OWNER" +log_info "Config, BIN=$IGT_BIN SUBTEST=${IGT_SUBTEST:-all} TIMEOUT=${IGT_RUN_TIMEOUT}s" +log_info "Evidence, $OUT_DIR" + +if [ ! -x "$IGT_BIN" ]; then + test_result_finish SKIP "$TESTNAME SKIP - IGT binary is unavailable: $IGT_BIN" +fi + +if [ "$(basename "$IGT_BIN")" != "$TESTNAME" ]; then + test_result_finish FAIL "$TESTNAME FAIL - binary $(basename "$IGT_BIN") does not match testcase $TESTNAME" +fi + +if [ "$GPU_OWNER" = "kgsl" ]; then + test_result_finish SKIP "$TESTNAME SKIP - GPU is owned by KGSL, msm GPU driver is required" +fi + +if ! command -v setsid >/dev/null 2>&1; then + test_result_finish SKIP "$TESTNAME SKIP - image-provided setsid is required for owned IGT process cleanup" +fi + +# Owned-session timeouts and fault attribution come from the current functestlib.sh. +for required_helper in bounded_timeout_pid_running kernel_log_filter_faults; do + if ! command -v "$required_helper" >/dev/null 2>&1; then + test_result_finish FAIL "$TESTNAME FAIL - required helper is unavailable: $required_helper, functestlib.sh is older than this suite" + fi +done +IGT_DEVICE_NODE="$(igt_select_msm_device)" +case "$?" in + 0) + ;; + 1) + test_result_finish SKIP "$TESTNAME SKIP - no msm DRM render node is available" + ;; + *) + test_result_finish FAIL "$TESTNAME FAIL - IGT_DEVICE=$IGT_DEVICE is not a drm:/dev/dri/ filter for an msm device" + ;; +esac +log_info "IGT device, $IGT_DEVICE_NODE" + +KLOG_PRE_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/pre"; then + KLOG_PRE_STATUS="available" +fi +KLOG_PRE_ACCESS="$IGT_KLOG_ACCESS_LOG" + +set -- "$IGT_BIN" --device "drm:$IGT_DEVICE_NODE" +if [ -n "$IGT_SUBTEST" ]; then + set -- "$@" --run-subtest "$IGT_SUBTEST" +fi + +log_info "Using IGT binary, $IGT_BIN" +log_info "Launching $* with timeout ${IGT_RUN_TIMEOUT}s" +igt_run_binary "$IGT_RUN_TIMEOUT" "$IGT_LOG" "$@" +IGT_RC=$? +IGT_TIMED_OUT="${MANAGED_TIMEOUT_EXPIRED:-0}" +IGT_CLEANUP_FAILED=0 +if [ -n "${MANAGED_TIMEOUT_CMD_PID:-}${MANAGED_TIMEOUT_WATCHER_PID:-}" ]; then + IGT_CLEANUP_FAILED=1 +fi + +log_info "IGT version, $(igt_log_version "$IGT_LOG")" +log_info "IGT log, $IGT_LOG" + +DEVICE_MISMATCH=0 +igt_opened_devices_match "$IGT_LOG" "$IGT_DEVICE_NODE" +case "$?" in + 0) + log_info "IGT opened the selected device, $IGT_DEVICE_NODE" + ;; + 1) + DEVICE_MISMATCH=1 + ;; + *) + log_warn "IGT log does not report the opened device" + ;; +esac + +KLOG_POST_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/post"; then + KLOG_POST_STATUS="available" +fi +KLOG_POST_ACCESS="$IGT_KLOG_ACCESS_LOG" + +KLOG_FAULT=0 +if [ "$KLOG_PRE_STATUS" != "available" ] || [ "$KLOG_POST_STATUS" != "available" ]; then + log_warn "Kernel log evidence unavailable, pre=$KLOG_PRE_STATUS post=$KLOG_POST_STATUS, see $KLOG_PRE_ACCESS and $KLOG_POST_ACCESS" +elif ! igt_kernel_log_compare "$KLOG_DIR/pre" "$KLOG_DIR/post" "$KLOG_DIR"; then + log_warn "Kernel log evidence unavailable, the fault or error comparison failed in $KLOG_DIR" +else + if [ "$IGT_KLOG_NEW_ERRORS" -gt 0 ]; then + log_warn "Kernel errors raised during $TESTNAME, count=$IGT_KLOG_NEW_ERRORS (capped at 20 lines), $KLOG_DIR/dmesg_errors.log" + igt_log_file_lines warn "[dmesg]" "$KLOG_DIR/dmesg_errors.log" 20 + else + log_info "No new msm/adreno/drm kernel errors" + fi + if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then + KLOG_FAULT=1 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + fi +fi + +PASS_COUNT="$(igt_count_subtests "$IGT_LOG" "SUCCESS")" +FAIL_COUNT="$(igt_count_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT")" +SKIP_COUNT="$(igt_count_subtests "$IGT_LOG" "SKIP")" +TOTAL_COUNT=$((PASS_COUNT + FAIL_COUNT + SKIP_COUNT)) +log_info "Subtest results, SUCCESS=$PASS_COUNT FAIL=$FAIL_COUNT SKIP=$SKIP_COUNT TOTAL=$TOTAL_COUNT rc=$IGT_RC" + +igt_list_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT" | while IFS= read -r subtest_line; do + log_fail "$subtest_line" +done +igt_list_subtests "$IGT_LOG" "SKIP" | while IFS= read -r subtest_line; do + log_skip "$subtest_line" +done + +FINAL="PASS" +REASON="$PASS_COUNT subtest(s) passed, $SKIP_COUNT skipped" +if [ "$IGT_TIMED_OUT" = "1" ]; then + FINAL="FAIL" + REASON="timed out after ${IGT_RUN_TIMEOUT}s" +elif [ "$IGT_CLEANUP_FAILED" -eq 1 ]; then + FINAL="FAIL" + REASON="owned IGT processes remain after cleanup" +elif [ "$DEVICE_MISMATCH" -eq 1 ]; then + FINAL="FAIL" + REASON="IGT opened a device other than $IGT_DEVICE_NODE" +elif [ "$FAIL_COUNT" -gt 0 ]; then + FINAL="FAIL" + REASON="$FAIL_COUNT of $TOTAL_COUNT subtest(s) failed" +elif [ "$KLOG_FAULT" -eq 1 ]; then + FINAL="FAIL" + REASON="new GPU kernel fault, see $KLOG_DIR/dmesg_faults.log" +elif [ "$IGT_RC" -eq 77 ]; then + FINAL="SKIP" + REASON="IGT reported SKIP, exit code 77" +elif [ "$IGT_RC" -ne 0 ]; then + FINAL="FAIL" + REASON="IGT exited with code $IGT_RC" +elif [ "$PASS_COUNT" -eq 0 ] && [ "$SKIP_COUNT" -gt 0 ]; then + FINAL="SKIP" + REASON="all $SKIP_COUNT subtest(s) skipped" +fi + +if [ "$FINAL" = "FAIL" ]; then + log_info "----- Last 200 IGT log lines -----" + tail -n 200 "$IGT_LOG" 2>/dev/null | while IFS= read -r igt_line; do + log_info "[igt] $igt_line" + done + log_info "----- End IGT log -----" +fi + +log_info "------------------- Completed $TESTNAME Testcase -------------------------" +test_result_finish "$FINAL" "$TESTNAME $FINAL - $REASON" diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/msm_recovery.yaml b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/msm_recovery.yaml new file mode 100644 index 000000000..b3dcac623 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/msm_recovery.yaml @@ -0,0 +1,20 @@ +metadata: + name: msm_recovery + format: "Lava-Test Test Definition 1.0" + description: "Validates GPU hang detection and recovery. Uses the IGT msm_recovery test." + os: + - linux + scope: + - functional + +params: + IGT_BIN_PATH: "/usr/libexec/igt-gpu-tools/msm_recovery" + IGT_TIMEOUT: "600" + +run: + steps: + - REPO_PATH=$PWD + - cd Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery + - export IGT_TIMEOUT="${IGT_TIMEOUT}" + - ./run.sh --bin-path "${IGT_BIN_PATH}" || true + - $REPO_PATH/Runner/utils/send-to-lava.sh msm_recovery.res || true diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/msm_recovery_TestValidation_Readme.md b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/msm_recovery_TestValidation_Readme.md new file mode 100644 index 000000000..d5292016e --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/msm_recovery_TestValidation_Readme.md @@ -0,0 +1,183 @@ +# License +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause +# IGT MSM Recovery Test Script + +## Overview + +This script automates the validation of GPU hang detection and recovery using the IGT `msm_recovery` test. It captures detailed logs and provides a summary of the test results with subtest-level analysis. + +## Features + +- Runs the IGT `msm_recovery` test with all subtests or a single selected subtest +- GPU ownership check, the test is skipped when KGSL owns the GPU +- Timeout protection for the IGT run +- Detailed logging of test progress and results +- Reports msm/adreno/drm kernel errors raised during the run +- Output stored in the current working directory +- Selects one msm device and passes it to IGT, so execution and diagnostics use the same GPU +- Help system with usage information + +## Prerequisites + +Ensure the following components are present in the target environment: + +- IGT binary (`msm_recovery`) - must be executable, default path `/usr/libexec/igt-gpu-tools/msm_recovery` +- `setsid` (util-linux) - used to stop all IGT processes on timeout or interruption +- Write access to the filesystem (for logging) + +## Directory Structure +```bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Graphics/ +│ │ │ ├── igt-gpu-tools/ +│ │ │ │ ├── msm_recovery/ +│ │ │ │ │ ├── run.sh +│ │ │ │ │ ├── msm_recovery.yaml +│ │ │ │ │ └── msm_recovery_TestValidation_Readme.md +├── utils/ +│ └── lib_igt.sh +``` + +## Usage + +1. Copy the script to your target system and make it executable: + +```bash +chmod +x run.sh +``` + +2. Run the script using one of the following methods: + +**Method 1: Default binary path** +```bash +./run.sh +``` + +**Method 2: Custom binary path** +```bash +./run.sh --bin-path +``` + +**Method 3: Single subtest** +```bash +./run.sh --subtest +``` + +**Method 4: Custom timeout** +```bash +./run.sh --timeout +``` + +**Method 5: Get help** +```bash +./run.sh --help +./run.sh -h +``` + +Examples: +```bash +./run.sh --bin-path /usr/libexec/igt-gpu-tools/msm_recovery +./run.sh --timeout 900 +/usr/libexec/igt-gpu-tools/msm_recovery --list-subtests +``` + +3. The result file is written to the current working directory (the suite directory when started through `run-test.sh` or LAVA). Logs of each run are kept in a separate `results/msm_recovery/run-./` directory there: + - `msm_recovery.res` - Test result (PASS/FAIL/SKIP), in the working directory + - `msm_recovery_log.txt` - Detailed IGT output with subtest results + - `dmesg/dmesg_errors.log` - msm/adreno/drm kernel errors raised during the run + - `dmesg/dmesg_faults.log` - new GPU kernel fault blocks (Oops, BUG, panic) raised during the run + +## Output + +- **Console Output**: Real-time display of test configuration, execution and results with structured logging +- **Log File**: `msm_recovery_log.txt` - Contains detailed output from the msm_recovery binary including all subtests +- **Result File**: `msm_recovery.res` - Contains final test status (PASS/FAIL/SKIP) +- **Kernel Log**: `dmesg/dmesg_errors.log` - Kernel errors raised during the run, reported as warnings only +- **Kernel Faults**: `dmesg/dmesg_faults.log` - New GPU kernel fault blocks raised during the run, reported as FAIL +- **Subtest Analysis**: Parsing and counting of individual subtest results, failed and skipped subtests are listed +- **Test Status Determination**: + - **FAIL**: Timeout, IGT processes not stopped after cleanup, IGT opened a device other than the selected one, any subtest FAIL/CRASH/TIMEOUT, new GPU kernel fault block, return code other than 0 or 77, invalid argument, or binary name not matching the testcase + - **SKIP**: Binary not found, KGSL owns the GPU, no msm DRM render node, `setsid` not available, return code 77, or all subtests skipped + - **PASS**: Return code 0 AND no failures (success_count > 0 OR mixed results with no failures) + +## Notes + +- The default timeout is 600 seconds, it can also be set with the `IGT_TIMEOUT` environment variable. +- Exit code 77 indicates a SKIP condition (standard IGT behavior). +- The msm device is `IGT_DEVICE` when it is a `drm:/dev/dri/` filter, otherwise the first msm render node. It is passed to IGT with `--device`, which takes precedence over `.igtrc`. Other `IGT_DEVICE` filters report FAIL. +- When the kernel log or its comparison is unavailable, a warning is printed and the result is based on the IGT output only. +- Kernel errors are printed on the console capped at 20 lines, the complete list is kept in `dmesg/dmesg_errors.log`. +- Only new GPU kernel fault blocks (Oops, BUG, panic) make the test FAIL, expected `*ERROR*` lines stay warnings. +- On failure the last 200 lines of the IGT log are printed on the console. +- The test deliberately hangs the GPU. `hangcheck` and `gpu fault` kernel messages naming `msm_recovery` are expected. +- Only the `hangcheck` subtest changes the GPU `disable_err_irq` debugfs value. When the selected subtests can run it (all subtests, `hangcheck` or a wildcard), the value of the selected device is saved before the run and restored and verified afterwards, including on timeout and interruption. If the control does not exist, IGT skips `hangcheck` and the other subtests still run. If IGT processes survive cleanup, the saved state is kept for the next run and the result is FAIL. + +## Maintenance + +- Keep the IGT binary version compatible with the kernel msm driver. +- Update the test when IGT adds or removes msm subtests. + +## Run test using: +```bash +git clone +cd +scp -r Runner user@target_device_ip: +ssh user@target_device_ip +``` + +- **Using Unified Runner** +```bash +cd /Runner +``` + +- **Run msm_recovery testcase** +```bash +./run-test.sh msm_recovery +./run-test.sh msm_recovery --bin-path +``` + +Example: +```bash +./run-test.sh msm_recovery --bin-path /usr/libexec/igt-gpu-tools/msm_recovery +``` + +## EXAMPLE OUTPUT + +```text +[Executing test case: msm_recovery] 2026-11-24 16:50:50 - +[INFO] 2026-11-24 16:50:50 - -------------------------------------------------------------------------- +[INFO] 2026-11-24 16:50:50 - ------------------- Starting msm_recovery Testcase -------------------------- +[INFO] 2026-11-24 16:50:50 - Detected OS, qcom-distro +[INFO] 2026-11-24 16:50:50 - Kernel, 7.3.0-rc2-ge428097a36d2 +[INFO] 2026-11-24 16:50:50 - GPU boot mode, msm +[INFO] 2026-11-24 16:50:50 - Config, BIN=/usr/libexec/igt-gpu-tools/msm_recovery SUBTEST=all TIMEOUT=600s +[INFO] 2026-11-24 16:50:50 - Evidence, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/results/msm_recovery/run-. +[INFO] 2026-11-24 16:50:50 - GPU error-interrupt state saved, /sys/kernel/debug/dri/0/disable_err_irq=N +[INFO] 2026-11-24 16:50:50 - Using IGT binary, /usr/libexec/igt-gpu-tools/msm_recovery +[INFO] 2026-11-24 16:50:50 - Launching /usr/libexec/igt-gpu-tools/msm_recovery with timeout 600s +[INFO] 2026-11-24 16:51:12 - IGT version, 2.6-2.6 (aarch64) (Linux: 7.3.0-rc2-ge428097a36d2 aarch64) +[INFO] 2026-11-24 16:51:12 - IGT log, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/results/msm_recovery/run-./msm_recovery_log.txt +[WARN] 2026-11-24 16:51:13 - Kernel errors raised during msm_recovery, count=128 (capped at 20 lines), /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/results/msm_recovery/run-./dmesg/dmesg_errors.log +[WARN] 2026-11-24 16:51:13 - [dmesg] [ 701.815186] msm_dpu ae01000.display-controller: [drm:hangcheck_handler [msm]] *ERROR* 06020300: hangcheck detected gpu lockup rb 0! +[WARN] 2026-11-24 16:51:14 - [dmesg] [ 701.827653] msm_dpu ae01000.display-controller: [drm:recover_worker [msm]] *ERROR* 06020300: hangcheck recover! +... +[INFO] 2026-11-24 16:51:14 - Subtest results, SUCCESS=5 FAIL=0 SKIP=0 TOTAL=5 rc=0 +[INFO] 2026-11-24 16:51:14 - ------------------- Completed msm_recovery Testcase ------------------------- +[INFO] 2026-11-24 16:51:14 - GPU error-interrupt state restored, /sys/kernel/debug/dri/0/disable_err_irq=N +[PASS] 2026-11-24 16:51:14 - msm_recovery PASS - 5 subtest(s) passed, 0 skipped +[PASS] 2026-11-24 16:51:15 - msm_recovery passed + +[INFO] 2026-11-24 16:51:15 - ========== Test Summary ========== +PASSED: +msm_recovery + +FAILED: + None + +SKIPPED: + None +[INFO] 2026-11-24 16:51:15 - ================================== +``` diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh new file mode 100755 index 000000000..9076e852f --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh @@ -0,0 +1,394 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause + +# usage +# Print the supported command-line options. +usage() { + cat < filter selecting the msm device +EOF +} + +# parse_args ARG... +# Parse options into runner globals, setting PARSE_ERROR on invalid input. +parse_args() { + while [ "$#" -gt 0 ]; do + case "$1" in + --bin-path|--subtest|--timeout) + if [ "$#" -lt 2 ] || [ -z "$2" ]; then + PARSE_ERROR="$1 requires a value" + return 1 + fi + case "$1" in + --bin-path) + IGT_BIN="$2" + ;; + --subtest) + IGT_SUBTEST="$2" + ;; + *) + IGT_RUN_TIMEOUT="$2" + ;; + esac + shift 2 + ;; + -h|--help) + SHOW_HELP=1 + shift + ;; + *) + PARSE_ERROR="unknown argument: $1" + return 1 + ;; + esac + done + return 0 +} + +WORK_DIR="$(pwd -P)" +IGT_BIN="/usr/libexec/igt-gpu-tools/msm_recovery" +IGT_SUBTEST="" +IGT_RUN_TIMEOUT="${IGT_TIMEOUT:-600}" +SHOW_HELP=0 +PARSE_ERROR="" + +parse_args "$@" +PARSE_RC=$? + +if [ "$SHOW_HELP" -eq 1 ]; then + usage + exit 0 +fi + +if [ ! -w "$WORK_DIR" ]; then + echo "[ERROR] Current directory is not writable for results: $WORK_DIR" >&2 + exit 1 +fi + +# ---------- Repo env + helpers ---------- +SCRIPT_DIR="$( + cd "$(dirname "$0")" || exit 1 + pwd +)" +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 + +if [ -z "${__INIT_ENV_LOADED:-}" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" + __INIT_ENV_LOADED=1 +fi + +# shellcheck disable=SC1090 +. "$INIT_ENV" +# shellcheck disable=SC1091 +. "$TOOLS/functestlib.sh" +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/lib_display.sh" +if [ -r "$TOOLS/lib_pkg_provider.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_pkg_provider.sh" +fi +if [ -r "$TOOLS/lib_module_reload.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_module_reload.sh" +fi +# shellcheck disable=SC1091 +. "$TOOLS/lib_igt.sh" + +TESTNAME="msm_recovery" +RES_FILE="$WORK_DIR/$TESTNAME.res" +test_result_init "$TESTNAME" "$RES_FILE" || exit 1 + +if [ "$PARSE_RC" -ne 0 ]; then + usage >&2 + test_result_finish FAIL "$TESTNAME FAIL - $PARSE_ERROR" +fi + +case "$IGT_RUN_TIMEOUT" in + ''|*[!0-9]*|0*) + test_result_finish FAIL "$TESTNAME FAIL - timeout must be a positive integer, value=$IGT_RUN_TIMEOUT" + ;; +esac +if [ "${#IGT_RUN_TIMEOUT}" -gt 9 ]; then + test_result_finish FAIL "$TESTNAME FAIL - timeout exceeds the supported seconds range" +fi + +OUT_DIR=$(test_create_run_directory "$WORK_DIR/results/$TESTNAME") || + test_result_finish FAIL "$TESTNAME FAIL - cannot create a run directory in $WORK_DIR/results/$TESTNAME" +IGT_LOG="$OUT_DIR/${TESTNAME}_log.txt" +KLOG_DIR="$OUT_DIR/dmesg" +ERR_IRQ_STATE="$WORK_DIR/.${TESTNAME}-err-irq.state" +mkdir -p "$KLOG_DIR" || test_result_finish FAIL "$TESTNAME FAIL - cannot create $KLOG_DIR" + +# cleanup +# Stop the owned IGT process group, then restore the GPU error-interrupt state. +# The saved state is kept when owned processes survive, so they cannot +# change the GPU again after a restore. +cleanup() { + if ! managed_timeout_cancel_bounded 5; then + log_fail "$TESTNAME IGT processes are still running, GPU error-interrupt state kept in $ERR_IRQ_STATE" + return 1 + fi + display_gpu_err_irq_restore "$ERR_IRQ_STATE" +} + +# interrupt_test +# Clean up, publish FAIL and preserve the signal exit status. +interrupt_test() { + # A repeated signal must not re-enter cleanup or the state restore. + trap '' HUP INT TERM + if ! cleanup; then + test_result_record FAIL "$TESTNAME cleanup failed during interruption" + fi + ( + TEST_RESULT_CLEANUP="" + test_result_finish FAIL "$TESTNAME FAIL - interrupted" + ) + exit "$1" +} + +# exit_test +# Clean up on every exit, publish FAIL if that fails, then hand over to the +# init_env stdout handler. +exit_test() { + exit_status=$? + if ! cleanup; then + log_fail "$TESTNAME cleanup failed at exit" + printf '%s FAIL\n' "$TESTNAME" >"$RES_FILE" 2>/dev/null || true + fi + if [ -n "${__RUN_STDOUT_ACTIVE:-}" ] && + command -v _runner_stdout_cleanup >/dev/null 2>&1; then + _runner_stdout_cleanup "$exit_status" + fi + exit "$exit_status" +} + +# shellcheck disable=SC2034 # Consumed by the shared managed timeout helpers. +MANAGED_TIMEOUT_USE_SESSION=1 +# shellcheck disable=SC2034 # Consumed by the shared result finalizer. +TEST_RESULT_CLEANUP=cleanup +trap exit_test EXIT +trap 'interrupt_test 129' HUP +trap 'interrupt_test 130' INT +trap 'interrupt_test 143' TERM + +OS_ID="unknown" +if command -v pkg_detect_os_id >/dev/null 2>&1; then + OS_ID="$(pkg_detect_os_id 2>/dev/null || true)" +fi +[ -n "$OS_ID" ] || OS_ID="unknown" +GPU_OWNER="$(igt_gpu_owner)" + +log_info "--------------------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase --------------------------" +log_info "Detected OS, $OS_ID" +log_info "Kernel, $(uname -r)" +log_info "GPU boot mode, $GPU_OWNER" +log_info "Config, BIN=$IGT_BIN SUBTEST=${IGT_SUBTEST:-all} TIMEOUT=${IGT_RUN_TIMEOUT}s" +log_info "Evidence, $OUT_DIR" + +if [ ! -x "$IGT_BIN" ]; then + test_result_finish SKIP "$TESTNAME SKIP - IGT binary is unavailable: $IGT_BIN" +fi + +if [ "$(basename "$IGT_BIN")" != "$TESTNAME" ]; then + test_result_finish FAIL "$TESTNAME FAIL - binary $(basename "$IGT_BIN") does not match testcase $TESTNAME" +fi + +if [ "$GPU_OWNER" = "kgsl" ]; then + test_result_finish SKIP "$TESTNAME SKIP - GPU is owned by KGSL, msm GPU driver is required" +fi + +if ! command -v setsid >/dev/null 2>&1; then + test_result_finish SKIP "$TESTNAME SKIP - image-provided setsid is required for owned IGT process cleanup" +fi + +# Owned-session timeouts and fault attribution come from the current functestlib.sh. +for required_helper in bounded_timeout_pid_running kernel_log_filter_faults; do + if ! command -v "$required_helper" >/dev/null 2>&1; then + test_result_finish FAIL "$TESTNAME FAIL - required helper is unavailable: $required_helper, functestlib.sh is older than this suite" + fi +done +IGT_DEVICE_NODE="$(igt_select_msm_device)" +case "$?" in + 0) + ;; + 1) + test_result_finish SKIP "$TESTNAME SKIP - no msm DRM render node is available" + ;; + *) + test_result_finish FAIL "$TESTNAME FAIL - IGT_DEVICE=$IGT_DEVICE is not a drm:/dev/dri/ filter for an msm device" + ;; +esac +log_info "IGT device, $IGT_DEVICE_NODE" + +# Only the native hangcheck subtest changes disable_err_irq, and IGT restores it +# only on a clean return. Save the selected device's value before any run that +# can execute hangcheck. A state file left by an interrupted earlier run holds +# the original value and is restored first. +if [ -f "$ERR_IRQ_STATE" ] && ! display_gpu_err_irq_restore "$ERR_IRQ_STATE"; then + test_result_finish FAIL "$TESTNAME FAIL - cannot restore the GPU error-interrupt state left by an earlier run" +fi +ERR_IRQ_NEEDED=0 +case "$IGT_SUBTEST" in + ''|*hangcheck*|*'*'*|*'?'*|*'['*) + ERR_IRQ_NEEDED=1 + ;; +esac +if [ "$ERR_IRQ_NEEDED" -eq 0 ]; then + log_info "Selected subtests do not change disable_err_irq, its state is not saved" +else + display_gpu_err_irq_snapshot "$ERR_IRQ_STATE" "$IGT_DEVICE_NODE" + case "$?" in + 0) + log_info "GPU error-interrupt state saved, $(sed -n 's/^path=//p' "$ERR_IRQ_STATE")=$(sed -n 's/^value=//p' "$ERR_IRQ_STATE")" + ;; + 1) + log_info "disable_err_irq is unavailable for $IGT_DEVICE_NODE, IGT skips hangcheck without it" + ;; + *) + test_result_finish FAIL "$TESTNAME FAIL - cannot save the GPU error-interrupt state of $IGT_DEVICE_NODE" + ;; + esac +fi + +KLOG_PRE_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/pre"; then + KLOG_PRE_STATUS="available" +fi +KLOG_PRE_ACCESS="$IGT_KLOG_ACCESS_LOG" + +set -- "$IGT_BIN" --device "drm:$IGT_DEVICE_NODE" +if [ -n "$IGT_SUBTEST" ]; then + set -- "$@" --run-subtest "$IGT_SUBTEST" +fi + +log_info "Using IGT binary, $IGT_BIN" +log_info "Launching $* with timeout ${IGT_RUN_TIMEOUT}s" +igt_run_binary "$IGT_RUN_TIMEOUT" "$IGT_LOG" "$@" +IGT_RC=$? +IGT_TIMED_OUT="${MANAGED_TIMEOUT_EXPIRED:-0}" +IGT_CLEANUP_FAILED=0 +if [ -n "${MANAGED_TIMEOUT_CMD_PID:-}${MANAGED_TIMEOUT_WATCHER_PID:-}" ]; then + IGT_CLEANUP_FAILED=1 +fi + +log_info "IGT version, $(igt_log_version "$IGT_LOG")" +log_info "IGT log, $IGT_LOG" + +DEVICE_MISMATCH=0 +igt_opened_devices_match "$IGT_LOG" "$IGT_DEVICE_NODE" +case "$?" in + 0) + log_info "IGT opened the selected device, $IGT_DEVICE_NODE" + ;; + 1) + DEVICE_MISMATCH=1 + ;; + *) + log_warn "IGT log does not report the opened device" + ;; +esac + +KLOG_POST_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/post"; then + KLOG_POST_STATUS="available" +fi +KLOG_POST_ACCESS="$IGT_KLOG_ACCESS_LOG" + +KLOG_FAULT=0 +if [ "$KLOG_PRE_STATUS" != "available" ] || [ "$KLOG_POST_STATUS" != "available" ]; then + log_warn "Kernel log evidence unavailable, pre=$KLOG_PRE_STATUS post=$KLOG_POST_STATUS, see $KLOG_PRE_ACCESS and $KLOG_POST_ACCESS" +elif ! igt_kernel_log_compare "$KLOG_DIR/pre" "$KLOG_DIR/post" "$KLOG_DIR"; then + log_warn "Kernel log evidence unavailable, the fault or error comparison failed in $KLOG_DIR" +else + if [ "$IGT_KLOG_NEW_ERRORS" -gt 0 ]; then + log_warn "Kernel errors raised during $TESTNAME, count=$IGT_KLOG_NEW_ERRORS (capped at 20 lines), $KLOG_DIR/dmesg_errors.log" + igt_log_file_lines warn "[dmesg]" "$KLOG_DIR/dmesg_errors.log" 20 + else + log_info "No new msm/adreno/drm kernel errors" + fi + if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then + KLOG_FAULT=1 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + fi +fi + +PASS_COUNT="$(igt_count_subtests "$IGT_LOG" "SUCCESS")" +FAIL_COUNT="$(igt_count_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT")" +SKIP_COUNT="$(igt_count_subtests "$IGT_LOG" "SKIP")" +TOTAL_COUNT=$((PASS_COUNT + FAIL_COUNT + SKIP_COUNT)) +log_info "Subtest results, SUCCESS=$PASS_COUNT FAIL=$FAIL_COUNT SKIP=$SKIP_COUNT TOTAL=$TOTAL_COUNT rc=$IGT_RC" + +igt_list_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT" | while IFS= read -r subtest_line; do + log_fail "$subtest_line" +done +igt_list_subtests "$IGT_LOG" "SKIP" | while IFS= read -r subtest_line; do + log_skip "$subtest_line" +done + +FINAL="PASS" +REASON="$PASS_COUNT subtest(s) passed, $SKIP_COUNT skipped" +if [ "$IGT_TIMED_OUT" = "1" ]; then + FINAL="FAIL" + REASON="timed out after ${IGT_RUN_TIMEOUT}s" +elif [ "$IGT_CLEANUP_FAILED" -eq 1 ]; then + FINAL="FAIL" + REASON="owned IGT processes remain after cleanup" +elif [ "$DEVICE_MISMATCH" -eq 1 ]; then + FINAL="FAIL" + REASON="IGT opened a device other than $IGT_DEVICE_NODE" +elif [ "$FAIL_COUNT" -gt 0 ]; then + FINAL="FAIL" + REASON="$FAIL_COUNT of $TOTAL_COUNT subtest(s) failed" +elif [ "$KLOG_FAULT" -eq 1 ]; then + FINAL="FAIL" + REASON="new GPU kernel fault, see $KLOG_DIR/dmesg_faults.log" +elif [ "$IGT_RC" -eq 77 ]; then + FINAL="SKIP" + REASON="IGT reported SKIP, exit code 77" +elif [ "$IGT_RC" -ne 0 ]; then + FINAL="FAIL" + REASON="IGT exited with code $IGT_RC" +elif [ "$PASS_COUNT" -eq 0 ] && [ "$SKIP_COUNT" -gt 0 ]; then + FINAL="SKIP" + REASON="all $SKIP_COUNT subtest(s) skipped" +fi + +if [ "$FINAL" = "FAIL" ]; then + log_info "----- Last 200 IGT log lines -----" + tail -n 200 "$IGT_LOG" 2>/dev/null | while IFS= read -r igt_line; do + log_info "[igt] $igt_line" + done + log_info "----- End IGT log -----" +fi + +log_info "------------------- Completed $TESTNAME Testcase -------------------------" +test_result_finish "$FINAL" "$TESTNAME $FINAL - $REASON" diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/msm_submit.yaml b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/msm_submit.yaml new file mode 100644 index 000000000..38dfc9733 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/msm_submit.yaml @@ -0,0 +1,20 @@ +metadata: + name: msm_submit + format: "Lava-Test Test Definition 1.0" + description: "Validates the msm GEM submit ioctl with valid and invalid command submissions. Uses the IGT msm_submit test." + os: + - linux + scope: + - functional + +params: + IGT_BIN_PATH: "/usr/libexec/igt-gpu-tools/msm_submit" + IGT_TIMEOUT: "300" + +run: + steps: + - REPO_PATH=$PWD + - cd Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit + - export IGT_TIMEOUT="${IGT_TIMEOUT}" + - ./run.sh --bin-path "${IGT_BIN_PATH}" || true + - $REPO_PATH/Runner/utils/send-to-lava.sh msm_submit.res || true diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/msm_submit_TestValidation_Readme.md b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/msm_submit_TestValidation_Readme.md new file mode 100644 index 000000000..02ae5ae55 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/msm_submit_TestValidation_Readme.md @@ -0,0 +1,176 @@ +# License +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause +# IGT MSM Submit Test Script + +## Overview + +This script automates the validation of the msm GEM submit ioctl using the IGT `msm_submit` test. It captures detailed logs and provides a summary of the test results with subtest-level analysis. + +## Features + +- Runs the IGT `msm_submit` test with all subtests or a single selected subtest +- GPU ownership check, the test is skipped when KGSL owns the GPU +- Timeout protection for the IGT run +- Detailed logging of test progress and results +- Reports msm/adreno/drm kernel errors raised during the run +- Output stored in the current working directory +- Selects one msm device and passes it to IGT, so execution and diagnostics use the same GPU +- Help system with usage information + +## Prerequisites + +Ensure the following components are present in the target environment: + +- IGT binary (`msm_submit`) - must be executable, default path `/usr/libexec/igt-gpu-tools/msm_submit` +- `setsid` (util-linux) - used to stop all IGT processes on timeout or interruption +- Write access to the filesystem (for logging) + +## Directory Structure +```bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Graphics/ +│ │ │ ├── igt-gpu-tools/ +│ │ │ │ ├── msm_submit/ +│ │ │ │ │ ├── run.sh +│ │ │ │ │ ├── msm_submit.yaml +│ │ │ │ │ └── msm_submit_TestValidation_Readme.md +├── utils/ +│ └── lib_igt.sh +``` + +## Usage + +1. Copy the script to your target system and make it executable: + +```bash +chmod +x run.sh +``` + +2. Run the script using one of the following methods: + +**Method 1: Default binary path** +```bash +./run.sh +``` + +**Method 2: Custom binary path** +```bash +./run.sh --bin-path +``` + +**Method 3: Single subtest** +```bash +./run.sh --subtest +``` + +**Method 4: Custom timeout** +```bash +./run.sh --timeout +``` + +**Method 5: Get help** +```bash +./run.sh --help +./run.sh -h +``` + +Examples: +```bash +./run.sh --bin-path /usr/libexec/igt-gpu-tools/msm_submit +./run.sh --timeout 600 +/usr/libexec/igt-gpu-tools/msm_submit --list-subtests +``` + +3. The result file is written to the current working directory (the suite directory when started through `run-test.sh` or LAVA). Logs of each run are kept in a separate `results/msm_submit/run-./` directory there: + - `msm_submit.res` - Test result (PASS/FAIL/SKIP), in the working directory + - `msm_submit_log.txt` - Detailed IGT output with subtest results + - `dmesg/dmesg_errors.log` - msm/adreno/drm kernel errors raised during the run + - `dmesg/dmesg_faults.log` - new GPU kernel fault blocks (Oops, BUG, panic) raised during the run + +## Output + +- **Console Output**: Real-time display of test configuration, execution and results with structured logging +- **Log File**: `msm_submit_log.txt` - Contains detailed output from the msm_submit binary including all subtests +- **Result File**: `msm_submit.res` - Contains final test status (PASS/FAIL/SKIP) +- **Kernel Log**: `dmesg/dmesg_errors.log` - Kernel errors raised during the run, reported as warnings only +- **Kernel Faults**: `dmesg/dmesg_faults.log` - New GPU kernel fault blocks raised during the run, reported as FAIL +- **Subtest Analysis**: Parsing and counting of individual subtest results, failed and skipped subtests are listed +- **Test Status Determination**: + - **FAIL**: Timeout, IGT processes not stopped after cleanup, IGT opened a device other than the selected one, any subtest FAIL/CRASH/TIMEOUT, new GPU kernel fault block, return code other than 0 or 77, invalid argument, or binary name not matching the testcase + - **SKIP**: Binary not found, KGSL owns the GPU, no msm DRM render node, `setsid` not available, return code 77, or all subtests skipped + - **PASS**: Return code 0 AND no failures (success_count > 0 OR mixed results with no failures) + +## Notes + +- The default timeout is 300 seconds, it can also be set with the `IGT_TIMEOUT` environment variable. +- Exit code 77 indicates a SKIP condition (standard IGT behavior). +- The msm device is `IGT_DEVICE` when it is a `drm:/dev/dri/` filter, otherwise the first msm render node. It is passed to IGT with `--device`, which takes precedence over `.igtrc`. Other `IGT_DEVICE` filters report FAIL. +- When the kernel log or its comparison is unavailable, a warning is printed and the result is based on the IGT output only. +- Kernel errors are printed on the console capped at 20 lines, the complete list is kept in `dmesg/dmesg_errors.log`. +- Only new GPU kernel fault blocks (Oops, BUG, panic) make the test FAIL, expected `*ERROR*` lines stay warnings. +- On failure the last 200 lines of the IGT log are printed on the console. + +## Maintenance + +- Keep the IGT binary version compatible with the kernel msm driver. +- Update the test when IGT adds or removes msm subtests. + +## Run test using: +```bash +git clone +cd +scp -r Runner user@target_device_ip: +ssh user@target_device_ip +``` + +- **Using Unified Runner** +```bash +cd /Runner +``` + +- **Run msm_submit testcase** +```bash +./run-test.sh msm_submit +./run-test.sh msm_submit --bin-path +``` + +Example: +```bash +./run-test.sh msm_submit --bin-path /usr/libexec/igt-gpu-tools/msm_submit +``` + +## EXAMPLE OUTPUT + +```text +[Executing test case: msm_submit] 2026-11-19 05:36:24 - +[INFO] 2026-11-19 05:36:24 - -------------------------------------------------------------------------- +[INFO] 2026-11-19 05:36:24 - ------------------- Starting msm_submit Testcase -------------------------- +[INFO] 2026-11-19 05:36:24 - Detected OS, qcom-distro-catchall +[INFO] 2026-11-19 05:36:24 - Kernel, 7.3.0-g17bbb4b37bbc +[INFO] 2026-11-19 05:36:24 - GPU boot mode, msm +[INFO] 2026-11-19 05:36:24 - Config, BIN=/usr/libexec/igt-gpu-tools/msm_submit SUBTEST=all TIMEOUT=300s +[INFO] 2026-11-19 05:36:24 - Evidence, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/results/msm_submit/run-. +[INFO] 2026-11-19 05:36:24 - Using IGT binary, /usr/libexec/igt-gpu-tools/msm_submit +[INFO] 2026-11-19 05:36:24 - Launching /usr/libexec/igt-gpu-tools/msm_submit with timeout 300s +[INFO] 2026-11-19 05:36:25 - IGT version, 2.6-2.6 (aarch64) (Linux: 7.3.0-g17bbb4b37bbc aarch64) +[INFO] 2026-11-19 05:36:25 - IGT log, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/results/msm_submit/run-./msm_submit_log.txt +[INFO] 2026-11-19 05:36:26 - No new msm/adreno/drm kernel errors +[INFO] 2026-11-19 05:36:26 - Subtest results, SUCCESS=8 FAIL=0 SKIP=0 TOTAL=8 rc=0 +[INFO] 2026-11-19 05:36:26 - ------------------- Completed msm_submit Testcase ------------------------- +[PASS] 2026-11-19 05:36:26 - msm_submit PASS - 8 subtest(s) passed, 0 skipped +[PASS] 2026-11-19 05:36:26 - msm_submit passed + +[INFO] 2026-11-19 05:36:26 - ========== Test Summary ========== +PASSED: +msm_submit + +FAILED: + None + +SKIPPED: + None +[INFO] 2026-11-19 05:36:26 - ================================== +``` diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh new file mode 100755 index 000000000..0d4545fb4 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh @@ -0,0 +1,359 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause + +# usage +# Print the supported command-line options. +usage() { + cat < filter selecting the msm device +EOF +} + +# parse_args ARG... +# Parse options into runner globals, setting PARSE_ERROR on invalid input. +parse_args() { + while [ "$#" -gt 0 ]; do + case "$1" in + --bin-path|--subtest|--timeout) + if [ "$#" -lt 2 ] || [ -z "$2" ]; then + PARSE_ERROR="$1 requires a value" + return 1 + fi + case "$1" in + --bin-path) + IGT_BIN="$2" + ;; + --subtest) + IGT_SUBTEST="$2" + ;; + *) + IGT_RUN_TIMEOUT="$2" + ;; + esac + shift 2 + ;; + -h|--help) + SHOW_HELP=1 + shift + ;; + *) + PARSE_ERROR="unknown argument: $1" + return 1 + ;; + esac + done + return 0 +} + +WORK_DIR="$(pwd -P)" +IGT_BIN="/usr/libexec/igt-gpu-tools/msm_submit" +IGT_SUBTEST="" +IGT_RUN_TIMEOUT="${IGT_TIMEOUT:-300}" +SHOW_HELP=0 +PARSE_ERROR="" + +parse_args "$@" +PARSE_RC=$? + +if [ "$SHOW_HELP" -eq 1 ]; then + usage + exit 0 +fi + +if [ ! -w "$WORK_DIR" ]; then + echo "[ERROR] Current directory is not writable for results: $WORK_DIR" >&2 + exit 1 +fi + +# ---------- Repo env + helpers ---------- +SCRIPT_DIR="$( + cd "$(dirname "$0")" || exit 1 + pwd +)" +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 + +if [ -z "${__INIT_ENV_LOADED:-}" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" + __INIT_ENV_LOADED=1 +fi + +# shellcheck disable=SC1090 +. "$INIT_ENV" +# shellcheck disable=SC1091 +. "$TOOLS/functestlib.sh" +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/lib_display.sh" +if [ -r "$TOOLS/lib_pkg_provider.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_pkg_provider.sh" +fi +if [ -r "$TOOLS/lib_module_reload.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_module_reload.sh" +fi +# shellcheck disable=SC1091 +. "$TOOLS/lib_igt.sh" + +TESTNAME="msm_submit" +RES_FILE="$WORK_DIR/$TESTNAME.res" +test_result_init "$TESTNAME" "$RES_FILE" || exit 1 + +if [ "$PARSE_RC" -ne 0 ]; then + usage >&2 + test_result_finish FAIL "$TESTNAME FAIL - $PARSE_ERROR" +fi + +case "$IGT_RUN_TIMEOUT" in + ''|*[!0-9]*|0*) + test_result_finish FAIL "$TESTNAME FAIL - timeout must be a positive integer, value=$IGT_RUN_TIMEOUT" + ;; +esac +if [ "${#IGT_RUN_TIMEOUT}" -gt 9 ]; then + test_result_finish FAIL "$TESTNAME FAIL - timeout exceeds the supported seconds range" +fi + +OUT_DIR=$(test_create_run_directory "$WORK_DIR/results/$TESTNAME") || + test_result_finish FAIL "$TESTNAME FAIL - cannot create a run directory in $WORK_DIR/results/$TESTNAME" +IGT_LOG="$OUT_DIR/${TESTNAME}_log.txt" +KLOG_DIR="$OUT_DIR/dmesg" +mkdir -p "$KLOG_DIR" || test_result_finish FAIL "$TESTNAME FAIL - cannot create $KLOG_DIR" + +# cleanup +# Stop the owned IGT process group. +cleanup() { + managed_timeout_cancel_bounded 5 && return 0 + log_fail "$TESTNAME IGT processes are still running after cleanup" + return 1 +} + +# interrupt_test +# Clean up, publish FAIL and preserve the signal exit status. +interrupt_test() { + # A repeated signal must not re-enter cleanup or the state restore. + trap '' HUP INT TERM + if ! cleanup; then + test_result_record FAIL "$TESTNAME cleanup failed during interruption" + fi + ( + TEST_RESULT_CLEANUP="" + test_result_finish FAIL "$TESTNAME FAIL - interrupted" + ) + exit "$1" +} + +# exit_test +# Clean up on every exit, publish FAIL if that fails, then hand over to the +# init_env stdout handler. +exit_test() { + exit_status=$? + if ! cleanup; then + log_fail "$TESTNAME cleanup failed at exit" + printf '%s FAIL\n' "$TESTNAME" >"$RES_FILE" 2>/dev/null || true + fi + if [ -n "${__RUN_STDOUT_ACTIVE:-}" ] && + command -v _runner_stdout_cleanup >/dev/null 2>&1; then + _runner_stdout_cleanup "$exit_status" + fi + exit "$exit_status" +} + +# shellcheck disable=SC2034 # Consumed by the shared managed timeout helpers. +MANAGED_TIMEOUT_USE_SESSION=1 +# shellcheck disable=SC2034 # Consumed by the shared result finalizer. +TEST_RESULT_CLEANUP=cleanup +trap exit_test EXIT +trap 'interrupt_test 129' HUP +trap 'interrupt_test 130' INT +trap 'interrupt_test 143' TERM + +OS_ID="unknown" +if command -v pkg_detect_os_id >/dev/null 2>&1; then + OS_ID="$(pkg_detect_os_id 2>/dev/null || true)" +fi +[ -n "$OS_ID" ] || OS_ID="unknown" +GPU_OWNER="$(igt_gpu_owner)" + +log_info "--------------------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase --------------------------" +log_info "Detected OS, $OS_ID" +log_info "Kernel, $(uname -r)" +log_info "GPU boot mode, $GPU_OWNER" +log_info "Config, BIN=$IGT_BIN SUBTEST=${IGT_SUBTEST:-all} TIMEOUT=${IGT_RUN_TIMEOUT}s" +log_info "Evidence, $OUT_DIR" + +if [ ! -x "$IGT_BIN" ]; then + test_result_finish SKIP "$TESTNAME SKIP - IGT binary is unavailable: $IGT_BIN" +fi + +if [ "$(basename "$IGT_BIN")" != "$TESTNAME" ]; then + test_result_finish FAIL "$TESTNAME FAIL - binary $(basename "$IGT_BIN") does not match testcase $TESTNAME" +fi + +if [ "$GPU_OWNER" = "kgsl" ]; then + test_result_finish SKIP "$TESTNAME SKIP - GPU is owned by KGSL, msm GPU driver is required" +fi + +if ! command -v setsid >/dev/null 2>&1; then + test_result_finish SKIP "$TESTNAME SKIP - image-provided setsid is required for owned IGT process cleanup" +fi + +# Owned-session timeouts and fault attribution come from the current functestlib.sh. +for required_helper in bounded_timeout_pid_running kernel_log_filter_faults; do + if ! command -v "$required_helper" >/dev/null 2>&1; then + test_result_finish FAIL "$TESTNAME FAIL - required helper is unavailable: $required_helper, functestlib.sh is older than this suite" + fi +done +IGT_DEVICE_NODE="$(igt_select_msm_device)" +case "$?" in + 0) + ;; + 1) + test_result_finish SKIP "$TESTNAME SKIP - no msm DRM render node is available" + ;; + *) + test_result_finish FAIL "$TESTNAME FAIL - IGT_DEVICE=$IGT_DEVICE is not a drm:/dev/dri/ filter for an msm device" + ;; +esac +log_info "IGT device, $IGT_DEVICE_NODE" + +KLOG_PRE_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/pre"; then + KLOG_PRE_STATUS="available" +fi +KLOG_PRE_ACCESS="$IGT_KLOG_ACCESS_LOG" + +set -- "$IGT_BIN" --device "drm:$IGT_DEVICE_NODE" +if [ -n "$IGT_SUBTEST" ]; then + set -- "$@" --run-subtest "$IGT_SUBTEST" +fi + +log_info "Using IGT binary, $IGT_BIN" +log_info "Launching $* with timeout ${IGT_RUN_TIMEOUT}s" +igt_run_binary "$IGT_RUN_TIMEOUT" "$IGT_LOG" "$@" +IGT_RC=$? +IGT_TIMED_OUT="${MANAGED_TIMEOUT_EXPIRED:-0}" +IGT_CLEANUP_FAILED=0 +if [ -n "${MANAGED_TIMEOUT_CMD_PID:-}${MANAGED_TIMEOUT_WATCHER_PID:-}" ]; then + IGT_CLEANUP_FAILED=1 +fi + +log_info "IGT version, $(igt_log_version "$IGT_LOG")" +log_info "IGT log, $IGT_LOG" + +DEVICE_MISMATCH=0 +igt_opened_devices_match "$IGT_LOG" "$IGT_DEVICE_NODE" +case "$?" in + 0) + log_info "IGT opened the selected device, $IGT_DEVICE_NODE" + ;; + 1) + DEVICE_MISMATCH=1 + ;; + *) + log_warn "IGT log does not report the opened device" + ;; +esac + +KLOG_POST_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/post"; then + KLOG_POST_STATUS="available" +fi +KLOG_POST_ACCESS="$IGT_KLOG_ACCESS_LOG" + +KLOG_FAULT=0 +if [ "$KLOG_PRE_STATUS" != "available" ] || [ "$KLOG_POST_STATUS" != "available" ]; then + log_warn "Kernel log evidence unavailable, pre=$KLOG_PRE_STATUS post=$KLOG_POST_STATUS, see $KLOG_PRE_ACCESS and $KLOG_POST_ACCESS" +elif ! igt_kernel_log_compare "$KLOG_DIR/pre" "$KLOG_DIR/post" "$KLOG_DIR"; then + log_warn "Kernel log evidence unavailable, the fault or error comparison failed in $KLOG_DIR" +else + if [ "$IGT_KLOG_NEW_ERRORS" -gt 0 ]; then + log_warn "Kernel errors raised during $TESTNAME, count=$IGT_KLOG_NEW_ERRORS (capped at 20 lines), $KLOG_DIR/dmesg_errors.log" + igt_log_file_lines warn "[dmesg]" "$KLOG_DIR/dmesg_errors.log" 20 + else + log_info "No new msm/adreno/drm kernel errors" + fi + if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then + KLOG_FAULT=1 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + fi +fi + +PASS_COUNT="$(igt_count_subtests "$IGT_LOG" "SUCCESS")" +FAIL_COUNT="$(igt_count_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT")" +SKIP_COUNT="$(igt_count_subtests "$IGT_LOG" "SKIP")" +TOTAL_COUNT=$((PASS_COUNT + FAIL_COUNT + SKIP_COUNT)) +log_info "Subtest results, SUCCESS=$PASS_COUNT FAIL=$FAIL_COUNT SKIP=$SKIP_COUNT TOTAL=$TOTAL_COUNT rc=$IGT_RC" + +igt_list_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT" | while IFS= read -r subtest_line; do + log_fail "$subtest_line" +done +igt_list_subtests "$IGT_LOG" "SKIP" | while IFS= read -r subtest_line; do + log_skip "$subtest_line" +done + +FINAL="PASS" +REASON="$PASS_COUNT subtest(s) passed, $SKIP_COUNT skipped" +if [ "$IGT_TIMED_OUT" = "1" ]; then + FINAL="FAIL" + REASON="timed out after ${IGT_RUN_TIMEOUT}s" +elif [ "$IGT_CLEANUP_FAILED" -eq 1 ]; then + FINAL="FAIL" + REASON="owned IGT processes remain after cleanup" +elif [ "$DEVICE_MISMATCH" -eq 1 ]; then + FINAL="FAIL" + REASON="IGT opened a device other than $IGT_DEVICE_NODE" +elif [ "$FAIL_COUNT" -gt 0 ]; then + FINAL="FAIL" + REASON="$FAIL_COUNT of $TOTAL_COUNT subtest(s) failed" +elif [ "$KLOG_FAULT" -eq 1 ]; then + FINAL="FAIL" + REASON="new GPU kernel fault, see $KLOG_DIR/dmesg_faults.log" +elif [ "$IGT_RC" -eq 77 ]; then + FINAL="SKIP" + REASON="IGT reported SKIP, exit code 77" +elif [ "$IGT_RC" -ne 0 ]; then + FINAL="FAIL" + REASON="IGT exited with code $IGT_RC" +elif [ "$PASS_COUNT" -eq 0 ] && [ "$SKIP_COUNT" -gt 0 ]; then + FINAL="SKIP" + REASON="all $SKIP_COUNT subtest(s) skipped" +fi + +if [ "$FINAL" = "FAIL" ]; then + log_info "----- Last 200 IGT log lines -----" + tail -n 200 "$IGT_LOG" 2>/dev/null | while IFS= read -r igt_line; do + log_info "[igt] $igt_line" + done + log_info "----- End IGT log -----" +fi + +log_info "------------------- Completed $TESTNAME Testcase -------------------------" +test_result_finish "$FINAL" "$TESTNAME $FINAL - $REASON" diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/msm_submitoverhead.yaml b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/msm_submitoverhead.yaml new file mode 100644 index 000000000..cc2405772 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/msm_submitoverhead.yaml @@ -0,0 +1,20 @@ +metadata: + name: msm_submitoverhead + format: "Lava-Test Test Definition 1.0" + description: "Measures msm submit ioctl overhead with varying buffer object counts. Uses the IGT msm_submitoverhead test." + os: + - linux + scope: + - functional + +params: + IGT_BIN_PATH: "/usr/libexec/igt-gpu-tools/msm_submitoverhead" + IGT_TIMEOUT: "600" + +run: + steps: + - REPO_PATH=$PWD + - cd Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead + - export IGT_TIMEOUT="${IGT_TIMEOUT}" + - ./run.sh --bin-path "${IGT_BIN_PATH}" || true + - $REPO_PATH/Runner/utils/send-to-lava.sh msm_submitoverhead.res || true diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/msm_submitoverhead_TestValidation_Readme.md b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/msm_submitoverhead_TestValidation_Readme.md new file mode 100644 index 000000000..bc70924cd --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/msm_submitoverhead_TestValidation_Readme.md @@ -0,0 +1,177 @@ +# License +Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +SPDX-License-Identifier: BSD-3-Clause +# IGT MSM Submit Overhead Test Script + +## Overview + +This script automates the validation of msm submit ioctl overhead using the IGT `msm_submitoverhead` test. It captures detailed logs and provides a summary of the test results with subtest-level analysis. + +## Features + +- Runs the IGT `msm_submitoverhead` test with all subtests or a single selected subtest +- GPU ownership check, the test is skipped when KGSL owns the GPU +- Timeout protection for the IGT run +- Detailed logging of test progress and results +- Reports msm/adreno/drm kernel errors raised during the run +- Output stored in the current working directory +- Selects one msm device and passes it to IGT, so execution and diagnostics use the same GPU +- Help system with usage information + +## Prerequisites + +Ensure the following components are present in the target environment: + +- IGT binary (`msm_submitoverhead`) - must be executable, default path `/usr/libexec/igt-gpu-tools/msm_submitoverhead` +- `setsid` (util-linux) - used to stop all IGT processes on timeout or interruption +- Write access to the filesystem (for logging) + +## Directory Structure +```bash +Runner/ +├── suites/ +│ ├── Multimedia/ +│ │ ├── Graphics/ +│ │ │ ├── igt-gpu-tools/ +│ │ │ │ ├── msm_submitoverhead/ +│ │ │ │ │ ├── run.sh +│ │ │ │ │ ├── msm_submitoverhead.yaml +│ │ │ │ │ └── msm_submitoverhead_TestValidation_Readme.md +├── utils/ +│ └── lib_igt.sh +``` + +## Usage + +1. Copy the script to your target system and make it executable: + +```bash +chmod +x run.sh +``` + +2. Run the script using one of the following methods: + +**Method 1: Default binary path** +```bash +./run.sh +``` + +**Method 2: Custom binary path** +```bash +./run.sh --bin-path +``` + +**Method 3: Single subtest** +```bash +./run.sh --subtest +``` + +**Method 4: Custom timeout** +```bash +./run.sh --timeout +``` + +**Method 5: Get help** +```bash +./run.sh --help +./run.sh -h +``` + +Examples: +```bash +./run.sh --bin-path /usr/libexec/igt-gpu-tools/msm_submitoverhead +./run.sh --timeout 900 +/usr/libexec/igt-gpu-tools/msm_submitoverhead --list-subtests +``` + +3. The result file is written to the current working directory (the suite directory when started through `run-test.sh` or LAVA). Logs of each run are kept in a separate `results/msm_submitoverhead/run-./` directory there: + - `msm_submitoverhead.res` - Test result (PASS/FAIL/SKIP), in the working directory + - `msm_submitoverhead_log.txt` - Detailed IGT output with subtest results + - `dmesg/dmesg_errors.log` - msm/adreno/drm kernel errors raised during the run + - `dmesg/dmesg_faults.log` - new GPU kernel fault blocks (Oops, BUG, panic) raised during the run + +## Output + +- **Console Output**: Real-time display of test configuration, execution and results with structured logging +- **Log File**: `msm_submitoverhead_log.txt` - Contains detailed output from the msm_submitoverhead binary including all subtests +- **Result File**: `msm_submitoverhead.res` - Contains final test status (PASS/FAIL/SKIP) +- **Kernel Log**: `dmesg/dmesg_errors.log` - Kernel errors raised during the run, reported as warnings only +- **Kernel Faults**: `dmesg/dmesg_faults.log` - New GPU kernel fault blocks raised during the run, reported as FAIL +- **Subtest Analysis**: Parsing and counting of individual subtest results, failed and skipped subtests are listed +- **Test Status Determination**: + - **FAIL**: Timeout, IGT processes not stopped after cleanup, IGT opened a device other than the selected one, any subtest FAIL/CRASH/TIMEOUT, new GPU kernel fault block, return code other than 0 or 77, invalid argument, or binary name not matching the testcase + - **SKIP**: Binary not found, KGSL owns the GPU, no msm DRM render node, `setsid` not available, return code 77, or all subtests skipped + - **PASS**: Return code 0 AND no failures (success_count > 0 OR mixed results with no failures) + +## Notes + +- The default timeout is 600 seconds, it can also be set with the `IGT_TIMEOUT` environment variable. +- Exit code 77 indicates a SKIP condition (standard IGT behavior). +- The msm device is `IGT_DEVICE` when it is a `drm:/dev/dri/` filter, otherwise the first msm render node. It is passed to IGT with `--device`, which takes precedence over `.igtrc`. Other `IGT_DEVICE` filters report FAIL. +- When the kernel log or its comparison is unavailable, a warning is printed and the result is based on the IGT output only. +- Kernel errors are printed on the console capped at 20 lines, the complete list is kept in `dmesg/dmesg_errors.log`. +- Only new GPU kernel fault blocks (Oops, BUG, panic) make the test FAIL, expected `*ERROR*` lines stay warnings. +- On failure the last 200 lines of the IGT log are printed on the console. +- This is a performance measurement. The result reflects whether the subtests ran, not a performance threshold. + +## Maintenance + +- Keep the IGT binary version compatible with the kernel msm driver. +- Update the test when IGT adds or removes msm subtests. + +## Run test using: +```bash +git clone +cd +scp -r Runner user@target_device_ip: +ssh user@target_device_ip +``` + +- **Using Unified Runner** +```bash +cd /Runner +``` + +- **Run msm_submitoverhead testcase** +```bash +./run-test.sh msm_submitoverhead +./run-test.sh msm_submitoverhead --bin-path +``` + +Example: +```bash +./run-test.sh msm_submitoverhead --bin-path /usr/libexec/igt-gpu-tools/msm_submitoverhead +``` + +## EXAMPLE OUTPUT + +```text +[Executing test case: msm_submitoverhead] 1970-01-01 04:37:56 - +[INFO] 1970-01-01 04:37:57 - -------------------------------------------------------------------------- +[INFO] 1970-01-01 04:37:57 - ------------------- Starting msm_submitoverhead Testcase -------------------------- +[INFO] 1970-01-01 04:37:57 - Detected OS, qcom-distro +[INFO] 1970-01-01 04:37:57 - Kernel, 7.3.0-rc2-ge428097a36d2 +[INFO] 1970-01-01 04:37:57 - GPU boot mode, msm +[INFO] 1970-01-01 04:37:57 - Config, BIN=/usr/libexec/igt-gpu-tools/msm_submitoverhead SUBTEST=all TIMEOUT=600s +[INFO] 1970-01-01 04:37:57 - Evidence, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/results/msm_submitoverhead/run-. +[INFO] 1970-01-01 04:37:57 - Using IGT binary, /usr/libexec/igt-gpu-tools/msm_submitoverhead +[INFO] 1970-01-01 04:37:57 - Launching /usr/libexec/igt-gpu-tools/msm_submitoverhead with timeout 600s +[INFO] 1970-01-01 04:38:20 - IGT version, 2.6-2.6 (aarch64) (Linux: 7.3.0-rc2-ge428097a36d2 aarch64) +[INFO] 1970-01-01 04:38:20 - IGT log, /var/qcom-linux-testkit/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/results/msm_submitoverhead/run-./msm_submitoverhead_log.txt +[INFO] 1970-01-01 04:38:21 - No new msm/adreno/drm kernel errors +[INFO] 1970-01-01 04:38:21 - Subtest results, SUCCESS=10 FAIL=0 SKIP=0 TOTAL=10 rc=0 +[INFO] 1970-01-01 04:38:21 - ------------------- Completed msm_submitoverhead Testcase ------------------------- +[PASS] 1970-01-01 04:38:21 - msm_submitoverhead PASS - 10 subtest(s) passed, 0 skipped +[PASS] 1970-01-01 04:38:21 - msm_submitoverhead passed + +[INFO] 1970-01-01 04:38:21 - ========== Test Summary ========== +PASSED: +msm_submitoverhead + +FAILED: + None + +SKIPPED: + None +[INFO] 1970-01-01 04:38:21 - ================================== +``` diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/run.sh new file mode 100755 index 000000000..f211173f3 --- /dev/null +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/run.sh @@ -0,0 +1,359 @@ +#!/bin/sh +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +# SPDX-License-Identifier: BSD-3-Clause + +# usage +# Print the supported command-line options. +usage() { + cat < filter selecting the msm device +EOF +} + +# parse_args ARG... +# Parse options into runner globals, setting PARSE_ERROR on invalid input. +parse_args() { + while [ "$#" -gt 0 ]; do + case "$1" in + --bin-path|--subtest|--timeout) + if [ "$#" -lt 2 ] || [ -z "$2" ]; then + PARSE_ERROR="$1 requires a value" + return 1 + fi + case "$1" in + --bin-path) + IGT_BIN="$2" + ;; + --subtest) + IGT_SUBTEST="$2" + ;; + *) + IGT_RUN_TIMEOUT="$2" + ;; + esac + shift 2 + ;; + -h|--help) + SHOW_HELP=1 + shift + ;; + *) + PARSE_ERROR="unknown argument: $1" + return 1 + ;; + esac + done + return 0 +} + +WORK_DIR="$(pwd -P)" +IGT_BIN="/usr/libexec/igt-gpu-tools/msm_submitoverhead" +IGT_SUBTEST="" +IGT_RUN_TIMEOUT="${IGT_TIMEOUT:-600}" +SHOW_HELP=0 +PARSE_ERROR="" + +parse_args "$@" +PARSE_RC=$? + +if [ "$SHOW_HELP" -eq 1 ]; then + usage + exit 0 +fi + +if [ ! -w "$WORK_DIR" ]; then + echo "[ERROR] Current directory is not writable for results: $WORK_DIR" >&2 + exit 1 +fi + +# ---------- Repo env + helpers ---------- +SCRIPT_DIR="$( + cd "$(dirname "$0")" || exit 1 + pwd +)" +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 + +if [ -z "${__INIT_ENV_LOADED:-}" ]; then + # shellcheck disable=SC1090 + . "$INIT_ENV" + __INIT_ENV_LOADED=1 +fi + +# shellcheck disable=SC1090 +. "$INIT_ENV" +# shellcheck disable=SC1091 +. "$TOOLS/functestlib.sh" +# shellcheck disable=SC1090,SC1091 +. "$TOOLS/lib_display.sh" +if [ -r "$TOOLS/lib_pkg_provider.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_pkg_provider.sh" +fi +if [ -r "$TOOLS/lib_module_reload.sh" ]; then + # shellcheck disable=SC1090,SC1091 + . "$TOOLS/lib_module_reload.sh" +fi +# shellcheck disable=SC1091 +. "$TOOLS/lib_igt.sh" + +TESTNAME="msm_submitoverhead" +RES_FILE="$WORK_DIR/$TESTNAME.res" +test_result_init "$TESTNAME" "$RES_FILE" || exit 1 + +if [ "$PARSE_RC" -ne 0 ]; then + usage >&2 + test_result_finish FAIL "$TESTNAME FAIL - $PARSE_ERROR" +fi + +case "$IGT_RUN_TIMEOUT" in + ''|*[!0-9]*|0*) + test_result_finish FAIL "$TESTNAME FAIL - timeout must be a positive integer, value=$IGT_RUN_TIMEOUT" + ;; +esac +if [ "${#IGT_RUN_TIMEOUT}" -gt 9 ]; then + test_result_finish FAIL "$TESTNAME FAIL - timeout exceeds the supported seconds range" +fi + +OUT_DIR=$(test_create_run_directory "$WORK_DIR/results/$TESTNAME") || + test_result_finish FAIL "$TESTNAME FAIL - cannot create a run directory in $WORK_DIR/results/$TESTNAME" +IGT_LOG="$OUT_DIR/${TESTNAME}_log.txt" +KLOG_DIR="$OUT_DIR/dmesg" +mkdir -p "$KLOG_DIR" || test_result_finish FAIL "$TESTNAME FAIL - cannot create $KLOG_DIR" + +# cleanup +# Stop the owned IGT process group. +cleanup() { + managed_timeout_cancel_bounded 5 && return 0 + log_fail "$TESTNAME IGT processes are still running after cleanup" + return 1 +} + +# interrupt_test +# Clean up, publish FAIL and preserve the signal exit status. +interrupt_test() { + # A repeated signal must not re-enter cleanup or the state restore. + trap '' HUP INT TERM + if ! cleanup; then + test_result_record FAIL "$TESTNAME cleanup failed during interruption" + fi + ( + TEST_RESULT_CLEANUP="" + test_result_finish FAIL "$TESTNAME FAIL - interrupted" + ) + exit "$1" +} + +# exit_test +# Clean up on every exit, publish FAIL if that fails, then hand over to the +# init_env stdout handler. +exit_test() { + exit_status=$? + if ! cleanup; then + log_fail "$TESTNAME cleanup failed at exit" + printf '%s FAIL\n' "$TESTNAME" >"$RES_FILE" 2>/dev/null || true + fi + if [ -n "${__RUN_STDOUT_ACTIVE:-}" ] && + command -v _runner_stdout_cleanup >/dev/null 2>&1; then + _runner_stdout_cleanup "$exit_status" + fi + exit "$exit_status" +} + +# shellcheck disable=SC2034 # Consumed by the shared managed timeout helpers. +MANAGED_TIMEOUT_USE_SESSION=1 +# shellcheck disable=SC2034 # Consumed by the shared result finalizer. +TEST_RESULT_CLEANUP=cleanup +trap exit_test EXIT +trap 'interrupt_test 129' HUP +trap 'interrupt_test 130' INT +trap 'interrupt_test 143' TERM + +OS_ID="unknown" +if command -v pkg_detect_os_id >/dev/null 2>&1; then + OS_ID="$(pkg_detect_os_id 2>/dev/null || true)" +fi +[ -n "$OS_ID" ] || OS_ID="unknown" +GPU_OWNER="$(igt_gpu_owner)" + +log_info "--------------------------------------------------------------------------" +log_info "------------------- Starting $TESTNAME Testcase --------------------------" +log_info "Detected OS, $OS_ID" +log_info "Kernel, $(uname -r)" +log_info "GPU boot mode, $GPU_OWNER" +log_info "Config, BIN=$IGT_BIN SUBTEST=${IGT_SUBTEST:-all} TIMEOUT=${IGT_RUN_TIMEOUT}s" +log_info "Evidence, $OUT_DIR" + +if [ ! -x "$IGT_BIN" ]; then + test_result_finish SKIP "$TESTNAME SKIP - IGT binary is unavailable: $IGT_BIN" +fi + +if [ "$(basename "$IGT_BIN")" != "$TESTNAME" ]; then + test_result_finish FAIL "$TESTNAME FAIL - binary $(basename "$IGT_BIN") does not match testcase $TESTNAME" +fi + +if [ "$GPU_OWNER" = "kgsl" ]; then + test_result_finish SKIP "$TESTNAME SKIP - GPU is owned by KGSL, msm GPU driver is required" +fi + +if ! command -v setsid >/dev/null 2>&1; then + test_result_finish SKIP "$TESTNAME SKIP - image-provided setsid is required for owned IGT process cleanup" +fi + +# Owned-session timeouts and fault attribution come from the current functestlib.sh. +for required_helper in bounded_timeout_pid_running kernel_log_filter_faults; do + if ! command -v "$required_helper" >/dev/null 2>&1; then + test_result_finish FAIL "$TESTNAME FAIL - required helper is unavailable: $required_helper, functestlib.sh is older than this suite" + fi +done +IGT_DEVICE_NODE="$(igt_select_msm_device)" +case "$?" in + 0) + ;; + 1) + test_result_finish SKIP "$TESTNAME SKIP - no msm DRM render node is available" + ;; + *) + test_result_finish FAIL "$TESTNAME FAIL - IGT_DEVICE=$IGT_DEVICE is not a drm:/dev/dri/ filter for an msm device" + ;; +esac +log_info "IGT device, $IGT_DEVICE_NODE" + +KLOG_PRE_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/pre"; then + KLOG_PRE_STATUS="available" +fi +KLOG_PRE_ACCESS="$IGT_KLOG_ACCESS_LOG" + +set -- "$IGT_BIN" --device "drm:$IGT_DEVICE_NODE" +if [ -n "$IGT_SUBTEST" ]; then + set -- "$@" --run-subtest "$IGT_SUBTEST" +fi + +log_info "Using IGT binary, $IGT_BIN" +log_info "Launching $* with timeout ${IGT_RUN_TIMEOUT}s" +igt_run_binary "$IGT_RUN_TIMEOUT" "$IGT_LOG" "$@" +IGT_RC=$? +IGT_TIMED_OUT="${MANAGED_TIMEOUT_EXPIRED:-0}" +IGT_CLEANUP_FAILED=0 +if [ -n "${MANAGED_TIMEOUT_CMD_PID:-}${MANAGED_TIMEOUT_WATCHER_PID:-}" ]; then + IGT_CLEANUP_FAILED=1 +fi + +log_info "IGT version, $(igt_log_version "$IGT_LOG")" +log_info "IGT log, $IGT_LOG" + +DEVICE_MISMATCH=0 +igt_opened_devices_match "$IGT_LOG" "$IGT_DEVICE_NODE" +case "$?" in + 0) + log_info "IGT opened the selected device, $IGT_DEVICE_NODE" + ;; + 1) + DEVICE_MISMATCH=1 + ;; + *) + log_warn "IGT log does not report the opened device" + ;; +esac + +KLOG_POST_STATUS="unavailable" +if igt_kernel_log_capture "$KLOG_DIR/post"; then + KLOG_POST_STATUS="available" +fi +KLOG_POST_ACCESS="$IGT_KLOG_ACCESS_LOG" + +KLOG_FAULT=0 +if [ "$KLOG_PRE_STATUS" != "available" ] || [ "$KLOG_POST_STATUS" != "available" ]; then + log_warn "Kernel log evidence unavailable, pre=$KLOG_PRE_STATUS post=$KLOG_POST_STATUS, see $KLOG_PRE_ACCESS and $KLOG_POST_ACCESS" +elif ! igt_kernel_log_compare "$KLOG_DIR/pre" "$KLOG_DIR/post" "$KLOG_DIR"; then + log_warn "Kernel log evidence unavailable, the fault or error comparison failed in $KLOG_DIR" +else + if [ "$IGT_KLOG_NEW_ERRORS" -gt 0 ]; then + log_warn "Kernel errors raised during $TESTNAME, count=$IGT_KLOG_NEW_ERRORS (capped at 20 lines), $KLOG_DIR/dmesg_errors.log" + igt_log_file_lines warn "[dmesg]" "$KLOG_DIR/dmesg_errors.log" 20 + else + log_info "No new msm/adreno/drm kernel errors" + fi + if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then + KLOG_FAULT=1 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + fi +fi + +PASS_COUNT="$(igt_count_subtests "$IGT_LOG" "SUCCESS")" +FAIL_COUNT="$(igt_count_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT")" +SKIP_COUNT="$(igt_count_subtests "$IGT_LOG" "SKIP")" +TOTAL_COUNT=$((PASS_COUNT + FAIL_COUNT + SKIP_COUNT)) +log_info "Subtest results, SUCCESS=$PASS_COUNT FAIL=$FAIL_COUNT SKIP=$SKIP_COUNT TOTAL=$TOTAL_COUNT rc=$IGT_RC" + +igt_list_subtests "$IGT_LOG" "FAIL|CRASH|TIMEOUT" | while IFS= read -r subtest_line; do + log_fail "$subtest_line" +done +igt_list_subtests "$IGT_LOG" "SKIP" | while IFS= read -r subtest_line; do + log_skip "$subtest_line" +done + +FINAL="PASS" +REASON="$PASS_COUNT subtest(s) passed, $SKIP_COUNT skipped" +if [ "$IGT_TIMED_OUT" = "1" ]; then + FINAL="FAIL" + REASON="timed out after ${IGT_RUN_TIMEOUT}s" +elif [ "$IGT_CLEANUP_FAILED" -eq 1 ]; then + FINAL="FAIL" + REASON="owned IGT processes remain after cleanup" +elif [ "$DEVICE_MISMATCH" -eq 1 ]; then + FINAL="FAIL" + REASON="IGT opened a device other than $IGT_DEVICE_NODE" +elif [ "$FAIL_COUNT" -gt 0 ]; then + FINAL="FAIL" + REASON="$FAIL_COUNT of $TOTAL_COUNT subtest(s) failed" +elif [ "$KLOG_FAULT" -eq 1 ]; then + FINAL="FAIL" + REASON="new GPU kernel fault, see $KLOG_DIR/dmesg_faults.log" +elif [ "$IGT_RC" -eq 77 ]; then + FINAL="SKIP" + REASON="IGT reported SKIP, exit code 77" +elif [ "$IGT_RC" -ne 0 ]; then + FINAL="FAIL" + REASON="IGT exited with code $IGT_RC" +elif [ "$PASS_COUNT" -eq 0 ] && [ "$SKIP_COUNT" -gt 0 ]; then + FINAL="SKIP" + REASON="all $SKIP_COUNT subtest(s) skipped" +fi + +if [ "$FINAL" = "FAIL" ]; then + log_info "----- Last 200 IGT log lines -----" + tail -n 200 "$IGT_LOG" 2>/dev/null | while IFS= read -r igt_line; do + log_info "[igt] $igt_line" + done + log_info "----- End IGT log -----" +fi + +log_info "------------------- Completed $TESTNAME Testcase -------------------------" +test_result_finish "$FINAL" "$TESTNAME $FINAL - $REASON" From 554daada3f3262bf9d97a6a4271a299efd3764fb Mon Sep 17 00:00:00 2001 From: Jitta Vignan Date: Tue, 1 Dec 2026 09:56:28 +0530 Subject: [PATCH 3/3] fixup! index on graphics-igt-msm-validation: c2d449c Graphics: add six IGT msm validation suites --- .../suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh | 6 ++++-- .../Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh | 6 ++++-- .../Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh | 6 ++++-- .../Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh | 6 ++++-- .../Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh | 6 ++++-- .../Graphics/igt-gpu-tools/msm_submitoverhead/run.sh | 6 ++++-- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh index 7e598445d..99f9206f5 100755 --- a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_bo/run.sh @@ -301,8 +301,10 @@ else fi if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then KLOG_FAULT=1 - log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" - igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS, full blocks in $KLOG_DIR/dmesg_faults.log" + igt_log_fault_headers "$KLOG_DIR/dmesg_faults.log" + log_info "First 40 lines of the fault blocks, the rest is in $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines info "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 fi fi diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh index 6f49bff98..c5e1f0025 100755 --- a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_mapping/run.sh @@ -301,8 +301,10 @@ else fi if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then KLOG_FAULT=1 - log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" - igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS, full blocks in $KLOG_DIR/dmesg_faults.log" + igt_log_fault_headers "$KLOG_DIR/dmesg_faults.log" + log_info "First 40 lines of the fault blocks, the rest is in $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines info "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 fi fi diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh index d4ee51627..1cbd44c35 100755 --- a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_perfcntrs/run.sh @@ -301,8 +301,10 @@ else fi if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then KLOG_FAULT=1 - log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" - igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS, full blocks in $KLOG_DIR/dmesg_faults.log" + igt_log_fault_headers "$KLOG_DIR/dmesg_faults.log" + log_info "First 40 lines of the fault blocks, the rest is in $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines info "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 fi fi diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh index 9076e852f..85a8c303d 100755 --- a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_recovery/run.sh @@ -336,8 +336,10 @@ else fi if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then KLOG_FAULT=1 - log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" - igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS, full blocks in $KLOG_DIR/dmesg_faults.log" + igt_log_fault_headers "$KLOG_DIR/dmesg_faults.log" + log_info "First 40 lines of the fault blocks, the rest is in $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines info "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 fi fi diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh index 0d4545fb4..54fbed696 100755 --- a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submit/run.sh @@ -301,8 +301,10 @@ else fi if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then KLOG_FAULT=1 - log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" - igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS, full blocks in $KLOG_DIR/dmesg_faults.log" + igt_log_fault_headers "$KLOG_DIR/dmesg_faults.log" + log_info "First 40 lines of the fault blocks, the rest is in $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines info "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 fi fi diff --git a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/run.sh b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/run.sh index f211173f3..9ad97bb7b 100755 --- a/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/run.sh +++ b/Runner/suites/Multimedia/Graphics/igt-gpu-tools/msm_submitoverhead/run.sh @@ -301,8 +301,10 @@ else fi if [ "$IGT_KLOG_NEW_FAULTS" -gt 0 ]; then KLOG_FAULT=1 - log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS (capped at 40 lines), $KLOG_DIR/dmesg_faults.log" - igt_log_file_lines fail "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 + log_fail "New GPU kernel fault blocks during $TESTNAME, count=$IGT_KLOG_NEW_FAULTS, full blocks in $KLOG_DIR/dmesg_faults.log" + igt_log_fault_headers "$KLOG_DIR/dmesg_faults.log" + log_info "First 40 lines of the fault blocks, the rest is in $KLOG_DIR/dmesg_faults.log" + igt_log_file_lines info "[fault]" "$KLOG_DIR/dmesg_faults.log" 40 fi fi