Skip to contentSkip to conversation

lib/tests: Add audio selftest

PATCH Superseded Paul Kocialkowski 4 participants 7 messages Aug 30, 2017 – Aug 31, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/tests: Add audio selftest

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

---
 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
lib/tests/Makefile.am +1 -1
index 5d14194a..b1caa628 100644
@@ -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)
lib/tests/Makefile.sources +5 -0
index 8d1a8dea..eb702844 100644
@@ -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) \
lib/tests/igt_audio.c new file +57 -0

57 lines not on this page · raw message

Signature · 6 lines
2.14.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for lib/tests: Add audio selftest

== Series Details ==

== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Paul Kocialkowski

Quoting Paul Kocialkowski (2017-08-30 15:45:14)

Quoted 19 lines

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

---
 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
lib/tests/Makefile.am +0 -0
index 5d14194a..b1caa628 100644

lib/tests/Makefile.am AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS) \ · line 17

Quoted 5 lines
lib/tests/Makefile.am +1 -1
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✗ Fi.CI.IGT: failure for lib/tests: Add audio selftest

In reply to Paul Kocialkowski
== Series Details ==

== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Paul Kocialkowski
Quoted 83 lines · Paul Kocialkowski

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

---
 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
lib/tests/Makefile.am +1 -1
index 5d14194a..b1caa628 100644
@@ -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)

lib/tests/Makefile.sources +5 -0
index 8d1a8dea..eb702844 100644
@@ -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) \
lib/tests/igt_audio.c new file +20 -0
new file mode 100644
index 00000000..2354d5a0
@@ -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.
+ *
+ */

lib/tests/igt_audio.c new file +7 -0
+
+#include "igt_core.h"
+#include "igt_audio.h"
+
+static int test_frequencies[] = {
+	300,
+	600,

lib/tests/igt_audio.c line 40

Quoted 10 lines
lib/tests/igt_audio.c new file +10 -0
+	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

lib/tests/igt_audio.c line 47

Quoted 7 lines
lib/tests/igt_audio.c new file +7 -0
+	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

Quoted 10 lines
lib/tests/igt_audio.c new file +10 -0
+		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);
+}
Signature · 6 lines
Cheers,
	Lyude
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
In reply to Chris Wilson
Quoted 25 lines · Chris Wilson

Quoting Paul Kocialkowski (2017-08-30 15:45:14)

Quoted 24 lines

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

---
 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
lib/tests/Makefile.am +0 -0
index 5d14194a..b1caa628 100644
@@ -14,7 +14,7 @@ AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS)
 $(DEBUG_CFLAGS) \
        -DIGT_DATADIR=\""$(abs_srcdir)"\" \
        $(NULL)
 
Quoted 6 lines

lib/tests/Makefile.am AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) · line 20

Quoted 4 lines
lib/tests/Makefile.am +1 -1
-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!

Signature · 6 lines
Paul Kocialkowski <[email protected]>
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo, Finland
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
In reply to Lyude Paul

Hi,

Quoted 107 lines · Lyude Paul
Quoted 106 lines · Paul Kocialkowski

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

---
 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
lib/tests/Makefile.am +1 -1
index 5d14194a..b1caa628 100644
@@ -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)

lib/tests/Makefile.sources +5 -0
index 8d1a8dea..eb702844 100644
@@ -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) \
lib/tests/igt_audio.c new file +4 -0
new file mode 100644
index 00000000..2354d5a0
@@ -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.
+ *
+ */

lib/tests/igt_audio.c new file +13 -0
+
+#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) /
Quoted 8 lines

lib/tests/igt_audio.c line 40

Quoted 5 lines

sizeof(int);

lib/tests/igt_audio.c new file +4 -0
+
+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.

Quoted 10 lines

lib/tests/igt_audio.c line 47

Quoted 7 lines
lib/tests/igt_audio.c new file +7 -0
+	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!

Quoted 12 lines
Quoted 12 lines
lib/tests/igt_audio.c new file +1 -0
+		audio_signal_add_frequency(signal,

test_frequencies[i]);

lib/tests/igt_audio.c new file +5 -0
+
+	audio_signal_synthesize(signal);
+	audio_signal_fill(signal, buffer, 1024);
+
+	igt_assert(audio_signal_detect(signal, 2, 44800, buffer,

1024));

lib/tests/igt_audio.c new file +4 -0
+
+	audio_signal_clean(signal);
+	free(signal);
+}
Signature · 6 lines
Paul Kocialkowski <[email protected]>
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo, Finland
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx