From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v3] lib/tests/igt_audio: add a test holding a sample
Date: Wed, 5 Jun 2019 11:03:30 +0300 [thread overview]
Message-ID: <20190605080330.29059-1-simon.ser@intel.com> (raw)
In-Reply-To: <b2ac6d2c-27f2-1c80-aac7-d53eaab48bb0@linux.intel.com>
Make sure holding a sample in the input signal makes audio_signal_detect fail.
Signed-off-by: Simon Ser <simon.ser@intel.com>
---
lib/tests/igt_audio.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/lib/tests/igt_audio.c b/lib/tests/igt_audio.c
index 47e61adf74fe..d18537d66fb7 100644
--- a/lib/tests/igt_audio.c
+++ b/lib/tests/igt_audio.c
@@ -116,6 +116,28 @@ static void test_signal_detect_with_unexpected_freq(struct audio_signal *signal)
igt_assert(!ok);
}
+static void test_signal_detect_held_sample(struct audio_signal *signal)
+{
+ double *buf;
+ bool ok;
+ size_t i;
+ double value;
+
+ buf = malloc(BUFFER_LEN * sizeof(double));
+ audio_signal_fill(signal, buf, BUFFER_LEN / CHANNELS);
+
+ /* Repeat a sample in the middle of the signal */
+ value = buf[BUFFER_LEN / 3];
+ for (i = 0; i < 5; i++)
+ buf[BUFFER_LEN / 3 + i] = value;
+
+ ok = audio_signal_detect(signal, SAMPLING_RATE, 0, buf, BUFFER_LEN);
+
+ free(buf);
+
+ igt_assert(!ok);
+}
+
igt_main
{
struct audio_signal *signal;
@@ -151,6 +173,9 @@ igt_main
igt_subtest("signal-detect-with-unexpected-freq")
test_signal_detect_with_unexpected_freq(signal);
+ igt_subtest("signal-detect-held-sample")
+ test_signal_detect_held_sample(signal);
+
igt_fixture {
audio_signal_fini(signal);
}
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-06-05 8:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 11:48 [igt-dev] [PATCH i-g-t v2 0/3] Check for audio noise and pops Simon Ser
2019-06-04 11:48 ` [igt-dev] [PATCH i-g-t v2 1/3] lib/igt_audio: detect " Simon Ser
2019-06-04 12:52 ` Martin Peres
2019-06-04 11:48 ` [igt-dev] [PATCH i-g-t v2 2/3] lib/tests/igt_audio: add a pop test Simon Ser
2019-06-04 12:54 ` Martin Peres
2019-06-05 8:03 ` Simon Ser [this message]
2019-06-12 10:56 ` [igt-dev] [PATCH i-g-t v3] lib/tests/igt_audio: add a test holding a sample Martin Peres
2019-06-04 11:48 ` [igt-dev] [PATCH i-g-t v2 3/3] lib/tests/igt_audio: add phaseshift detection test Simon Ser
2019-06-04 13:01 ` Martin Peres
2019-06-04 12:23 ` [igt-dev] ✓ Fi.CI.BAT: success for Check for audio noise and pops Patchwork
2019-06-04 23:39 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-06-05 10:48 ` [igt-dev] ✓ Fi.CI.BAT: success for Check for audio noise and pops (rev2) Patchwork
2019-06-06 14:00 ` [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=20190605080330.29059-1-simon.ser@intel.com \
--to=simon.ser@intel.com \
--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