From: Martin Peres <martin.peres@linux.intel.com>
To: Simon Ser <simon.ser@intel.com>, igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v2 6/9] tests/kms_chamelium: add name parameter to audio_state_start
Date: Mon, 27 May 2019 15:29:49 +0300 [thread overview]
Message-ID: <61caf5a7-35aa-ca4f-78e5-93c588cd34e8@linux.intel.com> (raw)
In-Reply-To: <20190524150334.15833-7-simon.ser@intel.com>
On 24/05/2019 18:03, Simon Ser wrote:
> This identifies the audio test name. This is required for adding multiple
> audio tests.
>
> Signed-off-by: Simon Ser <simon.ser@intel.com>
> ---
> tests/kms_chamelium.c | 22 ++++++++++++----------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
> index 063840721f46..14262831c3ff 100644
> --- a/tests/kms_chamelium.c
> +++ b/tests/kms_chamelium.c
> @@ -824,6 +824,7 @@ struct audio_state {
> int rate;
> } playback, capture;
>
> + const char *name;
> struct audio_signal *signal;
> int channel_mapping[8];
>
> @@ -871,7 +872,7 @@ static void *run_audio_thread(void *data)
> return NULL;
> }
>
> -static void audio_state_start(struct audio_state *state)
> +static void audio_state_start(struct audio_state *state, const char *name)
> {
> int ret;
> bool ok;
> @@ -879,12 +880,13 @@ static void audio_state_start(struct audio_state *state)
> enum chamelium_stream_realtime_mode stream_mode;
> char dump_suffix[64];
>
> + state->name = name;
This is a little dangerous since the name could have been allocated on
the stack of the caller, which could lead to a use after free later on.
With this replaced with strdup and a free(state->name) in the fini
function, the patch is:
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
> state->recv_pages = 0;
> state->msec = 0;
>
> - igt_debug("Starting test with playback format %s, sampling rate %d Hz "
> - "and %d channels\n",
> - snd_pcm_format_name(state->playback.format),
> + igt_debug("Starting %s test with playback format %s, "
> + "sampling rate %d Hz and %d channels\n",
> + name, snd_pcm_format_name(state->playback.format),
> state->playback.rate, state->playback.channels);
>
> chamelium_start_capturing_audio(state->chamelium, state->port, false);
> @@ -930,8 +932,8 @@ static void audio_state_start(struct audio_state *state)
>
> if (igt_frame_dump_is_enabled()) {
> snprintf(dump_suffix, sizeof(dump_suffix),
> - "capture-%s-%dch-%dHz",
> - snd_pcm_format_name(state->playback.format),
> + "capture-%s-%s-%dch-%dHz",
> + name, snd_pcm_format_name(state->playback.format),
> state->playback.channels, state->playback.rate);
>
> state->dump_fd = audio_create_wav_file_s32_le(dump_suffix,
> @@ -1001,9 +1003,9 @@ static void audio_state_stop(struct audio_state *state, bool success)
> state->dump_path = NULL;
> }
>
> - igt_debug("Audio test result for format %s, sampling rate %d Hz and "
> - "%d channels: %s\n",
> - snd_pcm_format_name(state->playback.format),
> + igt_debug("Audio %s test result for format %s, sampling rate %d Hz "
> + "and %d channels: %s\n",
> + state->name, snd_pcm_format_name(state->playback.format),
> state->playback.rate, state->playback.channels,
> success ? "ALL GREEN" : "FAILED");
> }
> @@ -1062,7 +1064,7 @@ static bool test_audio_frequencies(struct audio_state *state)
> audio_output_frequencies_callback, state,
> PLAYBACK_SAMPLES);
>
> - audio_state_start(state);
> + audio_state_start(state, "frequencies");
>
> igt_assert(state->capture.rate == state->playback.rate);
>
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-05-27 12:29 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 15:03 [igt-dev] [PATCH i-g-t v2 0/9] tests/kms_chamelium: add pulse test Simon Ser
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 1/9] tests/kms_chamelium: refactor audio test Simon Ser
2019-05-27 10:20 ` Martin Peres
2019-05-27 12:17 ` Ser, Simon
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 2/9] tests/kms_chamelium: introduce audio_state_receive Simon Ser
2019-05-27 12:24 ` Martin Peres
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 3/9] tests/kms_chamelium: rename do_test_display_audio and test_audio_configuration Simon Ser
2019-05-27 12:25 ` Martin Peres
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 4/9] tests/kms_chamelium: explain why 8-channel tests aren't performed Simon Ser
2019-05-27 12:25 ` Martin Peres
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 5/9] lib/igt_audio: introduce audio_convert_to Simon Ser
2019-05-27 12:27 ` Martin Peres
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 6/9] tests/kms_chamelium: add name parameter to audio_state_start Simon Ser
2019-05-27 12:29 ` Martin Peres [this message]
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 7/9] lib/igt_audio: make audio_extract_channel_s32_le support a NULL dst Simon Ser
2019-05-27 12:30 ` Martin Peres
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 8/9] tests/kms_chamelium: add pulse audio test Simon Ser
2019-05-27 12:46 ` Martin Peres
2019-05-24 15:03 ` [igt-dev] [PATCH i-g-t v2 9/9] tests/kms_chamelium: add audio channel alignment test Simon Ser
2019-05-27 13:34 ` Martin Peres
2019-05-26 9:58 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_chamelium: add pulse test Patchwork
2019-05-26 13:09 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-05-27 6:31 ` Ser, Simon
2019-05-27 13:41 ` Martin Peres
2019-05-27 7:01 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_chamelium: add pulse test (rev2) Patchwork
2019-05-27 15: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=61caf5a7-35aa-ca4f-78e5-93c588cd34e8@linux.intel.com \
--to=martin.peres@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=simon.ser@intel.com \
/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