All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
To: Lyude Paul <lyude@redhat.com>, intel-gfx@lists.freedesktop.org
Cc: contact@paulk.fr
Subject: Re: [PATCH i-g-t] lib/tests: Add audio selftest
Date: Thu, 31 Aug 2017 11:00:56 +0300	[thread overview]
Message-ID: <1504166456.1469.6.camel@linux.intel.com> (raw)
In-Reply-To: <1504119190.1959.9.camel@redhat.com>

Hi,

On Wed, 2017-08-30 at 14:53 -0400, Lyude Paul wrote:
> On Wed, 2017-08-30 at 17:45 +0300, Paul Kocialkowski wrote:
> > This introduces a selftest for the audio library.
> > 
> > It consists of generating a signal from a list of frequencies and
> > ensuring that the integrity checking function does detect these
> > frequencies (and only these frequencies).
> >
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
> > ---
> >  lib/tests/Makefile.am      |  2 +-
> >  lib/tests/Makefile.sources |  5 ++++
> >  lib/tests/igt_audio.c      | 57
> > ++++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 63 insertions(+), 1 deletion(-)
> >  create mode 100644 lib/tests/igt_audio.c
> > 
> > diff --git a/lib/tests/Makefile.am b/lib/tests/Makefile.am
> > index 5d14194a..b1caa628 100644
> > --- a/lib/tests/Makefile.am
> > +++ b/lib/tests/Makefile.am
> > @@ -14,7 +14,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS)
> > $(DEBUG_CFLAGS) \
> >  	-DIGT_DATADIR=\""$(abs_srcdir)"\" \
> >  	$(NULL)
> >  
> > -LDADD = ../libintel_tools.la $(PCIACCESS_LIBS) $(DRM_LIBS)
> > $(LIBUNWIND_LIBS)
> > $(TIMER_LIBS)
> > +LDADD = ../libintel_tools.la $(PCIACCESS_LIBS) $(DRM_LIBS)
> > $(GSL_CFLAGS)
> > $(LIBUNWIND_LIBS) $(TIMER_LIBS)
> >  
> >  LDADD += $(CAIRO_LIBS) $(LIBUDEV_LIBS) $(GLIB_LIBS) -lm
> >  AM_CFLAGS += $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) $(GLIB_CFLAGS)
> > diff --git a/lib/tests/Makefile.sources b/lib/tests/Makefile.sources
> > index 8d1a8dea..eb702844 100644
> > --- a/lib/tests/Makefile.sources
> > +++ b/lib/tests/Makefile.sources
> > @@ -18,6 +18,11 @@ check_prog_list = \
> >  	igt_can_fail_simple \
> >  	$(NULL)
> >  
> > +#if HAVE_GSL
> > +check_prog_list += \
> > +	igt_audio
> > +#endif
> > +
> >  TESTS = \
> >  	$(check_prog_list) \
> >  	$(check_script_list) \
> > diff --git a/lib/tests/igt_audio.c b/lib/tests/igt_audio.c
> > new file mode 100644
> > index 00000000..2354d5a0
> > --- /dev/null
> > +++ b/lib/tests/igt_audio.c
> > @@ -0,0 +1,57 @@
> > +/*
> > + * Copyright © 2017 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person
> > obtaining a
> > + * copy of this software and associated documentation files (the
> > "Software"),
> > + * to deal in the Software without restriction, including without
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute,
> > sublicense,
> > + * and/or sell copies of the Software, and to permit persons to
> > whom the
> > + * Software is furnished to do so, subject to the following
> > conditions:
> > + *
> > + * The above copyright notice and this permission notice (including
> > the next
> > + * paragraph) shall be included in all copies or substantial
> > portions of the
> > + * Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
> > EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
> > DAMAGES OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > OTHER
> > DEALINGS
> > + * IN THE SOFTWARE.
> > + *
> > + */
> > +
> > +#include "igt_core.h"
> > +#include "igt_audio.h"
> > +
> > +static int test_frequencies[] = {
> > +	300,
> > +	600,
> > +	1200,
> > +	80000,
> > +	10000,
> > +};
> > +
> > +static int test_frequencies_count = sizeof(test_frequencies) /
> > sizeof(int);
> > +
> > +igt_simple_main
> > +{
> > +	short buffer[2 * 1024];
> 
> And just specify the size here explicitly, no need to present it in
> units of 1024

Sure, will do in v2.

> > +	struct audio_signal *signal;
> > +	int i;
> > +
> > +	signal = audio_signal_init(2, 44800);
> > +	igt_assert(signal);
> > +
> > +	for (i = 0; i < test_frequencies_count; i++)
> 
> Just use ARRAY_SIZE(test_frequencies), no need for
> test_frequencies_count

Good point.

Thanks for the review!

> > +		audio_signal_add_frequency(signal,
> > test_frequencies[i]);
> > +
> > +	audio_signal_synthesize(signal);
> > +	audio_signal_fill(signal, buffer, 1024);
> > +
> > +	igt_assert(audio_signal_detect(signal, 2, 44800, buffer,
> > 1024));
> > +
> > +	audio_signal_clean(signal);
> > +	free(signal);
> > +}

-- 
Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo, Finland
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2017-08-31  8:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 14:45 [PATCH i-g-t] lib/tests: Add audio selftest Paul Kocialkowski
2017-08-30 15:02 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-08-30 15:44 ` [PATCH i-g-t] " Chris Wilson
2017-08-31  7:33   ` Paul Kocialkowski
2017-08-30 17:25 ` ✗ Fi.CI.IGT: failure for " Patchwork
2017-08-30 18:53 ` [PATCH i-g-t] " Lyude Paul
2017-08-31  8:00   ` Paul Kocialkowski [this message]

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=1504166456.1469.6.camel@linux.intel.com \
    --to=paul.kocialkowski@linux.intel.com \
    --cc=contact@paulk.fr \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.