All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] lib/tests: Add audio selftest
@ 2017-08-30 14:45 Paul Kocialkowski
  2017-08-30 15:02 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Paul Kocialkowski @ 2017-08-30 14:45 UTC (permalink / raw)
  To: intel-gfx

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];
+	struct audio_signal *signal;
+	int i;
+
+	signal = audio_signal_init(2, 44800);
+	igt_assert(signal);
+
+	for (i = 0; i < test_frequencies_count; i++)
+		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);
+}
-- 
2.14.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* ✓ Fi.CI.BAT: success for lib/tests: Add audio selftest
  2017-08-30 14:45 [PATCH i-g-t] lib/tests: Add audio selftest Paul Kocialkowski
@ 2017-08-30 15:02 ` Patchwork
  2017-08-30 15:44 ` [PATCH i-g-t] " Chris Wilson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2017-08-30 15:02 UTC (permalink / raw)
  To: Paul Kocialkowski; +Cc: intel-gfx

== Series Details ==

Series: lib/tests: Add audio selftest
URL   : https://patchwork.freedesktop.org/series/29550/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
fc6510887f8f45e18ca267e53eb564de043bd9d6 tools: Add intel_vbt_defs.h to Makefile.sources

with latest DRM-Tip kernel build CI_DRM_3018
6a305b78140a drm-tip: 2017y-08m-30d-08h-12m-34s UTC integration manifest

Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-snb-2600) fdo#100215 +1

fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215

fi-bdw-5557u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:455s
fi-bdw-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:444s
fi-blb-e6850     total:288  pass:224  dwarn:1   dfail:0   fail:0   skip:63  time:362s
fi-bsw-n3050     total:288  pass:243  dwarn:0   dfail:0   fail:0   skip:45  time:567s
fi-bwr-2160      total:288  pass:184  dwarn:0   dfail:0   fail:0   skip:104 time:255s
fi-bxt-j4205     total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:534s
fi-byt-j1900     total:288  pass:254  dwarn:1   dfail:0   fail:0   skip:33  time:529s
fi-byt-n2820     total:288  pass:250  dwarn:1   dfail:0   fail:0   skip:37  time:513s
fi-elk-e7500     total:288  pass:230  dwarn:0   dfail:0   fail:0   skip:58  time:439s
fi-glk-2a        total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:616s
fi-hsw-4770      total:288  pass:263  dwarn:0   dfail:0   fail:0   skip:25  time:448s
fi-hsw-4770r     total:288  pass:263  dwarn:0   dfail:0   fail:0   skip:25  time:429s
fi-ilk-650       total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:428s
fi-ivb-3520m     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:497s
fi-ivb-3770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:476s
fi-kbl-7500u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:477s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:599s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:603s
fi-pnv-d510      total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:528s
fi-skl-6260u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:472s
fi-skl-6770hq    total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:498s
fi-skl-gvtdvm    total:288  pass:266  dwarn:0   dfail:0   fail:0   skip:22  time:452s
fi-skl-x1585l    total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:505s
fi-snb-2520m     total:288  pass:251  dwarn:0   dfail:0   fail:0   skip:37  time:544s
fi-snb-2600      total:288  pass:249  dwarn:0   dfail:0   fail:1   skip:38  time:410s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_127/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH i-g-t] lib/tests: Add audio selftest
  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 ` 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
  3 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2017-08-30 15:44 UTC (permalink / raw)
  To: Paul Kocialkowski, intel-gfx

Quoting Paul Kocialkowski (2017-08-30 15:45:14)
> 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)

Let's play spot the odd one out.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* ✗ Fi.CI.IGT: failure for lib/tests: Add audio selftest
  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-30 17:25 ` Patchwork
  2017-08-30 18:53 ` [PATCH i-g-t] " Lyude Paul
  3 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2017-08-30 17:25 UTC (permalink / raw)
  To: Paul Kocialkowski; +Cc: intel-gfx

== Series Details ==

Series: lib/tests: Add audio selftest
URL   : https://patchwork.freedesktop.org/series/29550/
State : failure

== Summary ==

Test kms_flip:
        Subgroup plain-flip-fb-recreate-interruptible:
                fail       -> PASS       (shard-hsw)
        Subgroup modeset-vs-vblank-race-interruptible:
                pass       -> FAIL       (shard-hsw)
Test vgem_basic:
        Subgroup unload:
                skip       -> PASS       (shard-hsw) fdo#102453
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252
Test kms_properties:
        Subgroup plane-properties-legacy:
                skip       -> PASS       (shard-hsw)
Test kms_plane:
        Subgroup plane-position-hole-dpms-pipe-C-planes:
                skip       -> PASS       (shard-hsw)
Test kms_plane_multiple:
        Subgroup legacy-pipe-E-tiling-y:
                incomplete -> SKIP       (shard-hsw)
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test kms_atomic_transition:
        Subgroup plane-all-transition-fencing:
                skip       -> PASS       (shard-hsw)

fdo#102453 https://bugs.freedesktop.org/show_bug.cgi?id=102453
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-hsw        total:2265 pass:1230 dwarn:0   dfail:0   fail:19  skip:1016 time:9604s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_127/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH i-g-t] lib/tests: Add audio selftest
  2017-08-30 14:45 [PATCH i-g-t] lib/tests: Add audio selftest Paul Kocialkowski
                   ` (2 preceding siblings ...)
  2017-08-30 17:25 ` ✗ Fi.CI.IGT: failure for " Patchwork
@ 2017-08-30 18:53 ` Lyude Paul
  2017-08-31  8:00   ` Paul Kocialkowski
  3 siblings, 1 reply; 7+ messages in thread
From: Lyude Paul @ 2017-08-30 18:53 UTC (permalink / raw)
  To: Paul Kocialkowski, intel-gfx

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
> +	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
> +		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);
> +}
-- 
Cheers,
	Lyude
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH i-g-t] lib/tests: Add audio selftest
  2017-08-30 15:44 ` [PATCH i-g-t] " Chris Wilson
@ 2017-08-31  7:33   ` Paul Kocialkowski
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Kocialkowski @ 2017-08-31  7:33 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Wed, 2017-08-30 at 16:44 +0100, Chris Wilson wrote:
> Quoting Paul Kocialkowski (2017-08-30 15:45:14)
> > 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)
> 
> Let's play spot the odd one out.

Haha, sorry about that, I went over it way too quickly.

Thanks catching it!

-- 
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH i-g-t] lib/tests: Add audio selftest
  2017-08-30 18:53 ` [PATCH i-g-t] " Lyude Paul
@ 2017-08-31  8:00   ` Paul Kocialkowski
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Kocialkowski @ 2017-08-31  8:00 UTC (permalink / raw)
  To: Lyude Paul, intel-gfx; +Cc: contact

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-08-31  8:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.