Måns Rullgård | 15 May 2012 15:06

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

Diego Biurrun <diego@...> writes:

> 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
>>  <at>  <at>  -261,6 +261,8  <at>  <at>  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.

Sure, I just think writing elaborate documentation is a waste of time
before the feature has been agreed on.

>>  <at>  <at>  -1817,6 +1819,20  <at>  <at>  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.

I suppose...

--

-- 
Måns Rullgård
mans@...

Gmane