9 May 2012 15:25
Re: [PATCH] configure: add --enable/disable-random option
On 2012-05-09 04:32:09 +0100, Måns Rullgård wrote: > This allows creating random configurations which is useful for > testing purposes. > > Signed-off-by: Mans Rullgard <mans@...> > --- > Disregard the previous mail. It has some debug stuff left behind. > --- > configure | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/configure b/configure > index 67cba5a..e82006a 100755 > --- 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 an example would be nice '--disable-random=decoders[:0.20],encoders:0.8,... I'm not sure if a simple --randconfig which disables all compoments with a random probability would be easier to use. I'll add that. > NOTE: Object files are built at the place where configure is launched. > EOF > <at> <at> -1817,6 +1819,20 <at> <at> show_list() { > exit 0 > } > > +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 > +} > + > for opt do > optval="${opt#*=}" > case "$opt" in > <at> <at> -1831,6 +1847,10 <at> <at> for opt do > --disable-everything) > map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST > ;; > + --enable-random=*|--disable-random=*) > + action=${opt%%-random=*} > + do_random ${action#--} $optval > + ;; > --enable-*=*|--disable-*=*) > eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/') > is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt" lgtm Janne
RSS Feed