[libav-devel] [PATCH] configure: add --enable/disable-random option

Diego Biurrun diego at biurrun.de
Tue May 15 14:51:05 CEST 2012


On Wed, May 09, 2012 at 04:32:09AM +0100, Mans Rullgard wrote:
> This allows creating random configurations which is useful for
> testing purposes.
> 
> --- a/configure
> +++ b/configure
> @@ -261,6 +261,8 @@ Developer options (useful when working on Libav itself):
>                             \$FATE_SAMPLES at make invocation time.
>    --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
>                             should be used only for debugging purposes)
> +  --enable-random=LIST     randomly enable/disable components
> +  --disable-random=LIST

This needs more explanation, possibly an example.  It's not clear that
LIST has to be comma-separated and how to add a probability.

> @@ -1817,6 +1819,20 @@ show_list() {
>  
> +do_random(){
> +    action=$1
> +    IFS=,
> +    set -- $2
> +    unset IFS
> +    for thing; do
> +        comp=${thing%:*}
> +        prob=${thing#$comp}
> +        prob=${prob#:}
> +        is_in ${comp}s $COMPONENT_LIST && eval comp=\$$(toupper $comp)_LIST
> +        $action $(printf '%s\n' $comp | awk "BEGIN { srand() } rand() < ${prob:-0.5} { print }")
> +    done
> +}

I'm tempted to think that you could skip adding the 's' to the component
name and rely on it being present on the command line.

Diego


More information about the libav-devel mailing list