Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Cline <jcline@redhat.com>
To: Lyude Paul <lyude@redhat.com>
Cc: IGT GPU Tools <igt-dev@lists.freedesktop.org>
Subject: Re: [igt-dev] [PATCH i-g-t 2/2] tests/kms_addfb_basic: Relax errno assertions
Date: Fri, 13 Nov 2020 16:41:16 -0500	[thread overview]
Message-ID: <20201113214116.GA29161@xps13> (raw)
In-Reply-To: <0a3ff43f827bf1bda286ca5b6fc6fe627f25ecbf.camel@redhat.com>

On Fri, Nov 13, 2020 at 01:59:55PM -0500, Lyude Paul wrote:
> On Fri, 2020-11-13 at 11:49 -0500, Jeremy Cline wrote:
> > This adjusts the check on failed calls to DRM_IOCTL_MODE_ADDFB2 in
> > various scenarios. According to the kernel's
> > drm_mode_config_funcs.fb_create documentation, a negative return code is
> > all that is required to signal failure, and different drivers return
> > different errors in these scenarios.
> > 
> > Particularly, Nouveau returns -ERANGE rather than -EINVAL in scenarios
> > where the buffer is too small for the proposed configuration.
> > 
> > Signed-off-by: Jeremy Cline <jcline@redhat.com>
> > ---
> >  tests/kms_addfb_basic.c | 16 ++++++++--------
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
> > index 0ec583fe..b284bfc1 100644
> > --- a/tests/kms_addfb_basic.c
> > +++ b/tests/kms_addfb_basic.c
> > @@ -282,7 +282,7 @@ static void pitch_tests(int fd)
> >                 igt_subtest_f("bad-pitch-%i", bad_pitches[i]) {
> >                         f.pitches[0] = bad_pitches[i];
> >                         igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) ==
> > -1 &&
> > -                                  errno == EINVAL);
> > +                                  errno != 0);
> >                 }
> >         }
> >  
> > @@ -413,11 +413,11 @@ static void size_tests(int fd)
> >         f_8.width++;
> >         igt_subtest("too-wide") {
> >                 igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == -1 &&
> > -                          errno == EINVAL);
> > +                          errno != 0);
> >                 igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_16) == -1 &&
> > -                          errno == EINVAL);
> > +                          errno != 0);
> >                 igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_8) == -1 &&
> > -                          errno == EINVAL);
> > +                          errno != 0);
> >         }
> >         f.width--;
> >         f_16.width--;
> > @@ -427,17 +427,17 @@ static void size_tests(int fd)
> >         f_8.height++;
> >         igt_subtest("too-high") {
> >                 igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == -1 &&
> > -                          errno == EINVAL);
> > +                          errno != 0);
> >                 igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_16) == -1 &&
> > -                          errno == EINVAL);
> > +                          errno != 0);
> >                 igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f_8) == -1 &&
> > -                          errno == EINVAL);
> > +                          errno != 0);
> >         }
> >  
> >         f.handles[0] = gem_bo_small;
> >         igt_subtest("bo-too-small") {
> >                 igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == -1 &&
> > -                          errno == EINVAL);
> > +                          errno != 0);
> 
> Probably should be do_ioctl_err() instead. JFYI too, there's an old outdated
> cocci file for converting things like this automatically that I meant to update.
> I made some progress, but had to put it on the backburner because of time
> constraints.

Ah, neat, thanks for the pointer. It looks like the macro wants one to
provide the exact error. It seems like breaking this out into
vendor-specific tests where it checks for EINVAL for Intel and ERANGE
for Nouveau would be better in any case. Assuming I do that, would it be
good to leave this here for generic "at least don't succeed" testing for
any additional vendors?

- Jeremy

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-11-13 21:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 16:49 [igt-dev] [PATCH i-g-t 0/2] tests/kms_addfb_basic: Nouveau support Jeremy Cline
2020-11-13 16:49 ` [igt-dev] [PATCH i-g-t 1/2] tests/kms_addfb_basic: Mark Intel-only tests as such Jeremy Cline
2020-11-13 19:00   ` Lyude Paul
2020-11-13 16:49 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_addfb_basic: Relax errno assertions Jeremy Cline
2020-11-13 18:59   ` Lyude Paul
2020-11-13 21:41     ` Jeremy Cline [this message]
2020-11-16 11:14       ` Petri Latvala
2020-11-13 20:27 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_addfb_basic: Nouveau support Patchwork
2020-11-14  0:30 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-11-16 22:18 ` [igt-dev] [PATCH i-g-t v2 0/2] " Jeremy Cline
2020-11-16 22:18   ` [igt-dev] [PATCH i-g-t v2 1/2] tests/kms_addfb_basic: Mark Intel-only tests as such Jeremy Cline
2020-11-16 22:18   ` [igt-dev] [PATCH i-g-t v2 2/2] tests/kms_addfb_basic: add vendor-specific errno assertions Jeremy Cline
2020-11-17  7:31     ` Petri Latvala
2020-11-17 20:02   ` [igt-dev] [PATCH i-g-t v3 0/2] tests/kms_addfb_basic: Nouveau support Jeremy Cline
2020-11-17 20:02     ` [igt-dev] [PATCH i-g-t v3 1/2] tests/kms_addfb_basic: Mark Intel-only tests as such Jeremy Cline
2020-11-17 20:02     ` [igt-dev] [PATCH i-g-t v3 2/2] tests/kms_addfb_basic: add vendor-specific errno assertions Jeremy Cline
2020-11-18  9:12       ` Petri Latvala
2020-11-18 15:23     ` [igt-dev] [PATCH i-g-t v4 0/2] tests/kms_addfb_basic: Nouveau support Jeremy Cline
2020-11-18 15:23       ` [igt-dev] [PATCH i-g-t v4 1/2] tests/kms_addfb_basic: Mark Intel-only tests as such Jeremy Cline
2020-11-18 15:23       ` [igt-dev] [PATCH i-g-t v4 2/2] tests/kms_addfb_basic: add vendor-specific errno assertions Jeremy Cline
2020-11-18 21:23         ` Lyude Paul
2020-11-18 17:00     ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v4,1/2] tests/kms_addfb_basic: Mark Intel-only tests as such Patchwork
2020-11-19  1:39     ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2020-11-17 21:02   ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/2] " Patchwork
2020-11-18  1:14   ` [igt-dev] ✓ Fi.CI.IGT: " 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=20201113214116.GA29161@xps13 \
    --to=jcline@redhat.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lyude@redhat.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