[FFmpeg-devel] [PATCH 2/3] parseutils: add FATE test.

Michael Niedermayer michaelni at gmx.at
Tue Apr 17 10:57:08 CEST 2012


On Mon, Apr 16, 2012 at 01:33:38PM +0200, Nicolas George wrote:
> It requires adding an option to the test program
> to avoid random lines.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavutil/parseutils.c    |   11 ++++++--
>  tests/fate/libavutil.mak  |    4 +++
>  tests/ref/fate/parseutils |   61 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 73 insertions(+), 3 deletions(-)
>  create mode 100644 tests/ref/fate/parseutils
> 
> diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
> index df737f6..09c56a0 100644
> --- a/libavutil/parseutils.c
> +++ b/libavutil/parseutils.c
> @@ -679,8 +679,13 @@ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info
>  
>  #undef printf
>  
> -int main(void)
> +int main(int argc, char **argv)
>  {
> +    int deterministic = 0;
> +
> +    if (argc >= 2 && !strcmp(argv[1], "-fate"))
> +        deterministic = 1;
> +
>      printf("Testing av_parse_video_rate()\n");
>      {
>          int i;
> @@ -728,6 +733,7 @@ int main(void)
>          const char *color_names[] = {
>              "bikeshed",
>              "RaNdOm",
> +            "random at 10",
>              "foo",
>              "red",
>              "Red ",
> @@ -748,7 +754,6 @@ int main(void)
>              "ff0000",
>              "ffXX00",
>              "red at foo",
> -            "random at 10",
>              "0xff0000 at 1.0",
>              "red@",
>              "red at 0xfff",
> @@ -766,7 +771,7 @@ int main(void)
>  
>          av_log_set_level(AV_LOG_DEBUG);
>  
> -        for (i = 0;  i < FF_ARRAY_ELEMS(color_names); i++) {
> +        for (i = deterministic ? 3 : 0;  i < FF_ARRAY_ELEMS(color_names); i++) {
>              if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
>                  printf("%s -> R(%d) G(%d) B(%d) A(%d)\n", color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
>              else

i would suggest tp skip av_get_random_seed() instead, i guess a
"global" variable would work fine to switch it off.

otherwise LGTM

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120417/431177db/attachment.asc>


More information about the ffmpeg-devel mailing list