Re: [igt-dev] [PATCH i-g-t] audio: Avoid test_integrity failing if there's no HW support

Chris Wilson
2019-04-23T09:09:56Z

Quoting Chris Wilson (2019-04-23 09:09:46)
> Before asserting that the HDMI audio loopback works after resume, first
> require it to be present before suspend -- as not all machines are setup
> with the right HDMI audio capture.
>
> More strictly, one would expect that an audio capture device setup
> before suspend will remain functional after resume. An exercise left for
> the reader.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110499
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Simon Ser <simon.ser@intel.com>
> Cc: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
> ---
> tests/audio.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/tests/audio.c b/tests/audio.c
> index 560876a33..28d18fb29 100644
> --- a/tests/audio.c
> +++ b/tests/audio.c
> @@ -94,7 +94,7 @@ static int input_callback(void *data, short *buffer, int frames)
> return 0;
> }
>
> -static void test_integrity(const char *device_name)
> +static bool test_integrity(const char *device_name)
> {
> struct test_data data;
> int sampling_rate;
> @@ -150,39 +150,35 @@ static void test_integrity(const char *device_name)
> data.streak = 0;
>
> ret = alsa_run(data.alsa, RUN_TIMEOUT);
> - igt_assert(ret > 0);
>
> audio_signal_clean(data.signal);
> free(data.signal);
>
> alsa_close_output(data.alsa);
>
> - run = true;
> + run = ret > 0;

Should be
run |= ret > 0;
as we want any available device.

It could also break after the first success, but that feels like too
much of a change to swallow in one go.
-Chris