public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ser, Simon" <simon.ser@intel.com>
To: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>
Subject: Re: [igt-dev] [PATCH i-g-t v2] lib/igt_eld: introduce eld_is_supported
Date: Thu, 12 Sep 2019 12:30:10 +0000	[thread overview]
Message-ID: <4a9ec5ca311a228f2885b01e0b4604a8f09611b2.camel@intel.com> (raw)
In-Reply-To: <156829108495.4926.6468878258635464543@skylake-alporthouse-com>

On Thu, 2019-09-12 at 13:24 +0100, Chris Wilson wrote:
> Quoting Simon Ser (2019-09-12 13:07:18)
> > We've seen cases in which /proc/asound doesn't exist (e.g. with the
> > new SOF
> > framework). We've also seen cases in which no soundcard is exposed
> > by ALSA (see
> > bugzilla link). Last, some audio drivers din't support ELDs (non-
> > Intel
> > drivers). In all of these cases, skipping the tests depending on
> > ELD support
> > makes more sense and makes it clearer what happens.
> > 
> > v2: also check that the driver supports ELDs entries in procfs
> > 
> > Signed-off-by: Simon Ser <simon.ser@intel.com>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102370
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  lib/igt_eld.c           | 17 +++++++++++++++++
> >  lib/igt_eld.h           |  1 +
> >  tests/kms_chamelium.c   |  2 ++
> >  tests/kms_hdmi_inject.c |  2 ++
> >  4 files changed, 22 insertions(+)
> > 
> > diff --git a/lib/igt_eld.c b/lib/igt_eld.c
> > index 16c4ac06c6f6..ab4307f1d289 100644
> > --- a/lib/igt_eld.c
> > +++ b/lib/igt_eld.c
> > @@ -26,6 +26,8 @@
> >  #include "config.h"
> > 
> >  #include <dirent.h>
> > +#include <errno.h>
> > +#include <glob.h>
> >  #include <stdint.h>
> >  #include <stdio.h>
> >  #include <string.h>
> > @@ -262,3 +264,18 @@ bool eld_has_igt(void)
> >         struct eld_entry eld;
> >         return eld_get_igt(&eld);
> >  }
> > +
> > +/** eld_is_supported: check whether the ALSA procfs is enabled,
> > audio cards
> > + * are found and ELDs are supported */
> > +bool eld_is_supported(void)
> > +{
> > +       glob_t glob_buf;
> > +       bool has_elds;
> > +
> > +       igt_assert_f(glob("/proc/asound/card*/" ELD_PREFIX "*",
> > +                         0, NULL, &glob_buf) == 0,
> > +                    "glob failed\n");
> 
> GLOB_NOSORT ?
> 
> While man doesn't explicitly say what the behaviour with an
> uninitialised glob_t is with no GLOB_APPEND set, I'd feel happier if
> glob_t glob_buf = {};
> 
> > +       has_elds = glob_buf.gl_pathc > 0;
> > +       globfree(&glob_buf);
> 
> Give us a new line here.

These are good points. Thanks for the review!

> The glob matches the existing fs walk, so
> 
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2019-09-12 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 12:07 [igt-dev] [PATCH i-g-t v2] lib/igt_eld: introduce eld_is_supported Simon Ser
2019-09-12 12:24 ` Chris Wilson
2019-09-12 12:30   ` Ser, Simon [this message]
2019-09-12 12:52 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_eld: introduce eld_is_supported (rev2) Patchwork
2019-09-12 22:55 ` [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=4a9ec5ca311a228f2885b01e0b4604a8f09611b2.camel@intel.com \
    --to=simon.ser@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /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