Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions Runner/suites/Multimedia/Display/igt-gpu-tools/core_auth/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ if [ -z "$INIT_ENV" ]; then
fi

# Only source if not already loaded (idempotent)
if [ -z "$__INIT_ENV_LOADED" ]; then
if [ -z "${__INIT_ENV_LOADED:-}" ]; then
# shellcheck disable=SC1090
. "$INIT_ENV"
fi
# Always source functestlib.sh, using $TOOLS exported by init_env
# shellcheck disable=SC1090,SC1091
# shellcheck disable=SC1091
. "$TOOLS/functestlib.sh"
# shellcheck disable=SC1090,SC1091
. "$TOOLS/lib_display.sh"

TESTNAME="core_auth"
result_file="./${TESTNAME}.res"
Expand Down Expand Up @@ -91,6 +93,13 @@ fi

log_info "Using core_auth binary at: $CORE_AUTH_CMD"

dri_primary="$(get_drm_primary_node 2>/dev/null || true)"
if [ -n "$dri_primary" ]; then
log_info "Using DRM primary node: $dri_primary"
else
log_warn "$TESTNAME : DRM primary node /dev/dri/card* not present, continuing and letting core_auth determine outcome"
fi

if ! weston_stop; then
log_error "Failed to stop Weston"
echo "$TESTNAME FAIL" > "$result_file"
Expand Down Expand Up @@ -122,18 +131,18 @@ log_info "Subtest Results: SUCCESS=$success_count, FAIL=$fail_count, SKIP=$skip_
log_info "results will be written to \"$result_file\""
log_info "-------------------Completed $TESTNAME Testcase----------------------------"

if [ "$RC" -ne 0 ]; then
if [ "$RC" -eq 77 ] || { [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ] && [ "$fail_count" -eq 0 ]; }; then
log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped"
echo "$TESTNAME SKIP" > "$result_file"
exit 0
elif [ "$RC" -ne 0 ]; then
log_fail "$TESTNAME : Test Failed (exit code: $RC)"
echo "$TESTNAME FAIL" > "$result_file"
exit 1
elif [ "$fail_count" -gt 0 ]; then
log_fail "$TESTNAME : Test Failed - $fail_count subtest(s) failed out of $total_subtests"
echo "$TESTNAME FAIL" > "$result_file"
exit 1
elif [ "$skip_count" -gt 0 ] && [ "$success_count" -eq 0 ]; then
log_skip "$TESTNAME : Test Skipped - All $skip_count subtest(s) were skipped"
echo "$TESTNAME SKIP" > "$result_file"
exit 0
else
if [ "$success_count" -gt 0 ]; then
if [ "$skip_count" -gt 0 ]; then
Expand Down
36 changes: 36 additions & 0 deletions Runner/utils/lib_display.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,42 @@ display__debugfs_mode_for_crtc_name() {
' "$st" 2>/dev/null
}

# Return the first available DRM primary node (/dev/dri/card*).
# Prints the node path and returns 0 on success, 1 if no primary DRM node exists.
get_drm_primary_node() {
for node in /dev/dri/card*; do
case "$node" in
/dev/dri/card[0-9]*)
if [ -e "$node" ]; then
printf '%s\n' "$node"
return 0
fi
;;
esac
done
return 1
}

# Remove stale Wayland socket files only when Weston is not running.
# Best-effort cleanup for common Weston runtime paths; ignores missing files and permission errors.
weston_cleanup_stale_sockets() {
if weston_is_running; then
return 0
fi

for s in \
/dev/socket/weston/wayland-* \
/run/user/0/wayland-* \
/run/user/1000/wayland-* \
/tmp/wayland-* \
"${XDG_RUNTIME_DIR:-/nonexistent}"/wayland-*; do
[ -S "$s" ] || continue
rm -f "$s" 2>/dev/null || true
done

return 0
}

drm_card_index_from_dev() {
dev="$1"
case "$dev" in
Expand Down
Loading