[igt-dev] [PATCH i-g-t 5/5] lib/tests/igt_audio: add a pop test

Martin Peres martin.peres at linux.intel.com
Mon Jun 3 14:14:31 UTC 2019


On 29/05/2019 16:32, Simon Ser wrote:
> Make sure adding a pop in the input signal makes audio_signal_detect fail.
> 
> Signed-off-by: Simon Ser <simon.ser at intel.com>
> ---
>  lib/tests/igt_audio.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/lib/tests/igt_audio.c b/lib/tests/igt_audio.c
> index 0f1c39d93728..214dcea73efc 100644
> --- a/lib/tests/igt_audio.c
> +++ b/lib/tests/igt_audio.c
> @@ -111,6 +111,26 @@ static void test_signal_detect_extra(struct audio_signal *signal)
>  	igt_assert(!ok);
>  }
>  
> +static void test_signal_detect_pop(struct audio_signal *signal)
> +{
> +	double *buf;
> +	bool ok;
> +	size_t i;
> +
> +	buf = malloc(BUFFER_LEN * sizeof(double));
> +	audio_signal_fill(signal, buf, BUFFER_LEN / CHANNELS);
> +
> +	/* Add a discontinuity in the signal */
> +	for (i = 0; i < 5; i++)
> +		buf[BUFFER_LEN / 3 + i] = 0.9;

Would be nice to check both for a held value (no updates for some
samples then continuing the signal as expected) and a phase shift.

Could you check both in two different tests? That would increase our
confidence in our methodology!

I'll review 4 and 5 again when this is done :)

> +
> +	ok = audio_signal_detect(signal, SAMPLING_RATE, 0, buf, BUFFER_LEN);
> +
> +	free(buf);
> +
> +	igt_assert(!ok);
> +}
> +
>  igt_main
>  {
>  	struct audio_signal *signal;
> @@ -146,6 +166,9 @@ igt_main
>  		igt_subtest("signal-detect-extra")
>  			test_signal_detect_extra(signal);
>  
> +		igt_subtest("signal-detect-pop")
> +			test_signal_detect_pop(signal);
> +
>  		igt_fixture {
>  			audio_signal_fini(signal);
>  		}
> 


More information about the igt-dev mailing list