From: Jani Nikula <jani.nikula@intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
igt-dev@lists.freedesktop.org
Cc: "Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Ashutosh Dixit" <ashutosh.dixit@intel.com>,
"Karthik B S" <karthik.b.s@intel.com>,
"Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Subject: Re: [PATCH i-g-t v2] lib/drmtest: Create proper error report when open driver fails
Date: Wed, 22 Apr 2026 10:44:14 +0300 [thread overview]
Message-ID: <9ad9cc9138328823892f7319c1e3bb2c2b879e0c@intel.com> (raw)
In-Reply-To: <20260421145950.55091-1-kamil.konieczny@linux.intel.com>
On Tue, 21 Apr 2026, Kamil Konieczny <kamil.konieczny@linux.intel.com> wrote:
> When first try for opening driver fails then opening function is
> searching for next available device. When that also fails
> reporting is printing last errno which could mislead developer:
>
> $ build/tests/kms_dp_aux_dev
> IGT-Version: 2.3-NO-GIT (x86_64) (Linux: 6.17.0-19-generic x86_64)
> Test requirement not met in function drm_open_driver, file ../lib/drmtest.c:754:
> Test requirement: !(fd<0)
> No known gpu found for chipset flags 0x4294965755 (any)
> Last errno: 2, No such file or directory
> SKIP (0.006s)
>
> ls /dev/dri
> by-path card1 renderD128
>
> The real problem here is lack of permissions as there was a card
> but program could not open it. Break looking for a card as soon
> as an error is different from ENOENT. It will create a proper
> error report which will print:
>
> Last errno: 13, Permission denied
Isn't it also a problem that errno is really only valid right after a
failed libc call, and unspecified later?
All asserts lead to __igt_fail_assert(), which logs the last errno, but
anything could've happened before then. Most crucially, the errno
could've happened and been handled a while back, but the subsequent libc
calls won't clear the previous errno on success. So errno at assert
might have nothing to do with the assert itself.
BR,
Jani.
>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Cc: Karthik B S <karthik.b.s@intel.com>
> Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
> Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> lib/drmtest.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 4a788ea7a..66982f653 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -443,6 +443,11 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset,
> fd = __drm_open_device(name, chipset);
> if (fd != -1)
> return fd;
> +
> + if (errno == ENOENT)
> + continue;
> +
> + break;
> }
>
> return -1;
--
Jani Nikula, Intel
next prev parent reply other threads:[~2026-04-22 7:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 14:59 [PATCH i-g-t v2] lib/drmtest: Create proper error report when open driver fails Kamil Konieczny
2026-04-21 15:42 ` Zbigniew Kempczyński
2026-04-22 16:58 ` Kamil Konieczny
2026-04-22 0:07 ` ✓ i915.CI.BAT: success for lib/drmtest: Create proper error report when open driver fails (rev2) Patchwork
2026-04-22 1:32 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-22 6:18 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-22 7:44 ` Jani Nikula [this message]
2026-04-22 16:41 ` [PATCH i-g-t v2] lib/drmtest: Create proper error report when open driver fails Zbigniew Kempczyński
2026-04-28 12:38 ` Kamil Konieczny
2026-04-28 9:04 ` Kamil Konieczny
2026-04-22 9:02 ` ✗ i915.CI.Full: failure for lib/drmtest: Create proper error report when open driver fails (rev2) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ad9cc9138328823892f7319c1e3bb2c2b879e0c@intel.com \
--to=jani.nikula@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=karthik.b.s@intel.com \
--cc=zbigniew.kempczynski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox