Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Helen Koike <helen.koike@collabora.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	igt-dev@lists.freedesktop.org, Rob Clark <robdclark@gmail.com>,
	Rob Clark <robdclark@chromium.org>, Emma Anholt <emma@anholt.net>
Subject: Re: [igt-dev] [PATCH] core_getversion: Test for desired device
Date: Mon, 25 Sep 2023 09:36:38 -0300	[thread overview]
Message-ID: <da7c81c7-c370-8c1c-ba85-c46fbbee50ae@collabora.com> (raw)
In-Reply-To: <20230925121556.pyc2uunjbtm5hu27@kamilkon-desk.igk.intel.com>

Hi,

On 25/09/2023 09:15, Kamil Konieczny wrote:
> Hi,
> 
> On 2023-09-22 at 14:35:01 +0200, Kamil Konieczny wrote:
>> Hi Rob,
>>
>> On 2023-09-21 at 15:44:22 -0700, Rob Clark wrote:
>>> From: Rob Clark <robdclark@chromium.org>
>>>
>>> We discovered in drm/ci that if the drm device fails to probe, all the
>>> tests come back as "Skip", and the job is considered successful.  So fix
>> -------------------------- ^^^^^ ---------------------------------^
>> No comma before "and", s/, and/ and/, also use only one space separator
>> after end of statement,  s/.  So/. So/. As a side note, it is better to
>> avoid starting with "So", better:
>>
>> Fixed getversion test ...
>>
>>> the getversion test to fail if there is no drm device, or if the drm
>> ------------------------------------------------------ ^
>> s/, or/ or/
>>
>>> device does not match the expected device.
>>
>> Please write also that you used new enviroment var IGT_REQUIRED_DRIVERS
>> for that purpose.
>>
>>>
>>> Signed-off-by: Rob Clark <robdclark@chromium.org>
>>> ---
>>>   tests/core_getversion.c | 6 +++++-
>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tests/core_getversion.c b/tests/core_getversion.c
>>> index 32cb976e4923..e5416993d7a3 100644
>>> --- a/tests/core_getversion.c
>>> +++ b/tests/core_getversion.c
>>> @@ -48,14 +48,18 @@ igt_simple_main
>>>   {
>>>   	int fd;
>>>   	drmVersionPtr v;
>>> +	const char *name = getenv("IGT_REQUIRED_DRIVERS");
>>>   
>>> -	fd = drm_open_driver(DRIVER_ANY);
>>> +	fd = __drm_open_driver(DRIVER_ANY);
>>> +	igt_assert_fd(fd);
>>>   	v = drmGetVersion(fd);
>>>   	igt_assert_neq(strlen(v->name), 0);
>>>   	igt_assert_neq(strlen(v->date), 0);
>>>   	igt_assert_neq(strlen(v->desc), 0);
>>>   	if (is_i915_device(fd))
>>>   		igt_assert_lte(1, v->version_major);
>>> +	if (name)
>>> +		igt_assert_eq(strcmp(name, v->name), 0);
>> ------------------ ^
>> Better for debug would be:
>> 		igt_assert_f(!strcmp(name, v->name), "Expected driver: %s but got: %s\n", name, v->name);
> -------------------- ^
> 
> This should be:
>   		igt_assert_f(strcmp(name, v->name), "Expected driver: %s but got: %s\n", name, v->name);


According to 
https://drm.pages.freedesktop.org/igt-gpu-tools/igt-gpu-tools-Core.html#igt-assert-f

igt_assert_f "Fails (sub-)test if the condition is not met."

If we want name and v->name to match, strcmp returns 0, so it should be 
igt_assert_f(!strcmp.. no? Unless I'm missing something.

Regards,
Helen

> 
> Regards,
> Kamil
> 
>>
>> Regards,
>> Kamil
>>
>>>   
>>>   	drmFree(v);
>>>   	drm_close_driver(fd);
>>> -- 
>>> 2.41.0
>>>

  reply	other threads:[~2023-09-25 12:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 22:44 [igt-dev] [PATCH] core_getversion: Test for desired device Rob Clark
2023-09-22  0:11 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-09-22  0:35 ` [igt-dev] ✗ CI.xeBAT: failure " Patchwork
2023-09-22 12:34 ` [igt-dev] [PATCH] " Kamil Konieczny
2023-09-25 12:15   ` Kamil Konieczny
2023-09-25 12:36     ` Helen Koike [this message]
2023-09-22 19:05 ` [igt-dev] ✗ Fi.CI.IGT: failure for " 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=da7c81c7-c370-8c1c-ba85-c46fbbee50ae@collabora.com \
    --to=helen.koike@collabora.com \
    --cc=emma@anholt.net \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=robdclark@chromium.org \
    --cc=robdclark@gmail.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