[FFmpeg-devel] [PATCH v4 03/11] avformat/fifo: Add fate test
Michael Niedermayer
michael at niedermayer.cc
Thu Aug 11 23:55:09 EEST 2016
On Thu, Aug 11, 2016 at 10:02:07PM +0200, sebechlebskyjan at gmail.com wrote:
> From: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
>
> Signed-off-by: Jan Sebechlebsky <sebechlebskyjan at gmail.com>
> ---
> Changes since the last version of patch:
> - Fixed make dependencies so the tests are not executed when
> required components are disabled
>
> libavformat/Makefile | 1 +
> libavformat/tests/fifo_muxer.c | 443 +++++++++++++++++++++++++++++++++++++++++
> tests/Makefile | 1 +
> tests/fate/fifo-muxer.mak | 20 ++
> tests/ref/fate/fifo-muxer-tst | 11 +
> 5 files changed, 476 insertions(+)
> create mode 100644 libavformat/tests/fifo_muxer.c
> create mode 100644 tests/fate/fifo-muxer.mak
> create mode 100644 tests/ref/fate/fifo-muxer-tst
>
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index 2d2b78c..5d827d31 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -591,6 +591,7 @@ TESTPROGS = seek \
> url \
> # async \
>
> +TESTPROGS-$(CONFIG_FIFO_MUXER) += fifo_muxer
> TESTPROGS-$(CONFIG_FFRTMPCRYPT_PROTOCOL) += rtmpdh
> TESTPROGS-$(CONFIG_MOV_MUXER) += movenc
> TESTPROGS-$(CONFIG_NETWORK) += noproxy
> diff --git a/libavformat/tests/fifo_muxer.c b/libavformat/tests/fifo_muxer.c
> new file mode 100644
> index 0000000..d6ce85d
> --- /dev/null
> +++ b/libavformat/tests/fifo_muxer.c
> @@ -0,0 +1,443 @@
> +/*
> + * FIFO pseudo-muxer
> + * Copyright (c) 2016 Jan Sebechlebsky
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public License
> + * as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public License
> + * along with FFmpeg; if not, write to the Free Software * Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include <stdlib.h>
> +#include "libavutil/opt.h"
> +#include "libavutil/time.h"
> +#include "libavutil/avassert.h"
> +#include "libavformat/avformat.h"
> +#include "libavformat/url.h"
> +
> +#define MAX_TST_PACKETS 128
> +#define SLEEPTIME_50_MS 50000
> +#define SLEEPTIME_10_MS 10000
> +
> +/* Implementation of mock muxer to simulate real muxer failures */
> +
> +/* This is structure of data sent in packets to
> + * failing muxer */
> +typedef struct FailingMuxerPacketData {
> + int ret; /* return value of write_packet call*/
> + int recover_after; /* set ret to zero after this number of recovery attempts */
> + unsigned sleep_time; /* sleep for this long in write_packet to simulate long I/O operation */
> +} FailingMuxerPacketData;
> +
> +
> +typedef struct FailingMuxerContext {
> + AVClass *class;
> + int write_header_ret;
> + int write_trailer_ret;
> + /* If non-zero, summary of processed packets will be printed in deinit */
> + uint8_t print_deinit_summary;
[...]
> +#define OFFSET(x) offsetof(FailingMuxerContext, x)
> +static const AVOption options[] = {
> + {"write_header_ret", "write_header() return value", OFFSET(write_header_ret),
> + AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
> + {"write_trailer_ret", "write_trailer() return value", OFFSET(write_trailer_ret),
> + AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM},
> + {"print_deinit_summary", "print summary when deinitializing muxer", OFFSET(print_deinit_summary),
> + AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
Types mismatch, and fails on mips-qemu
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160811/db7d54db/attachment.sig>
More information about the ffmpeg-devel
mailing list