From 22aec2a31537deea151b92438ed9051e677f6062 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Tue, 9 Aug 2005 09:27:11 +0000 Subject: [PATCH] Update to latest version of this tool. Takes about a week for a full run. --- .../collect_all_make_options.sh | 45 ++++ tools/tools/build_option_survey/mkhtml.sh | 249 +++++++++--------- tools/tools/build_option_survey/no_list | 49 ---- .../build_option_survey/option_survey.sh | 168 +++++++----- tools/tools/build_option_survey/reduce.sh | 75 ++++++ 5 files changed, 337 insertions(+), 249 deletions(-) create mode 100644 tools/tools/build_option_survey/collect_all_make_options.sh delete mode 100644 tools/tools/build_option_survey/no_list create mode 100644 tools/tools/build_option_survey/reduce.sh diff --git a/tools/tools/build_option_survey/collect_all_make_options.sh b/tools/tools/build_option_survey/collect_all_make_options.sh new file mode 100644 index 000000000000..0f258928d89e --- /dev/null +++ b/tools/tools/build_option_survey/collect_all_make_options.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# This file is in the public domain +# +# $FreeBSD$ + +find ../../.. -name 'Makefile*' -print | + xargs grep 'defined' | + sed ' + /release\/Makefile/d + /tools\/tools/d + s/^[^:]*:// + /^[ ]*#/d + s/\|\|/\ + /g + s/\&\&/\ + /g + ' | sed ' + /defined[ ]*(/!d + s/).*// + s/.*(// + /{/d + /[$]/d + ' | sort -u | + sed ' + # build directives + /^NO_CLEAN$/d + /^NO_CLEANDIR$/d + /^NO_KERNELCLEAN$/d + /^NO_KERNELCONFIG$/d + /^NO_KERNELDEPEND$/d + /^NO_PORTSUPDATE$/d + /^NO_DOCUPDATE$/d + /^LDSCRIPT$/d + /^DEBUG$/d + /^SMP$/d + # Do not even think about it :-) + /^NOTYET$/d + /^notdef*$/d + # Unknown magic + /^_.*$/d + /^MODULES_WITH_WORLD$/d + /^BATCH_DELETE_OLD_FILES$/d + /^SUBDIR_OVERRIDE$/d + ' > _.options diff --git a/tools/tools/build_option_survey/mkhtml.sh b/tools/tools/build_option_survey/mkhtml.sh index cff7aea0f088..75a6be2d50b1 100644 --- a/tools/tools/build_option_survey/mkhtml.sh +++ b/tools/tools/build_option_survey/mkhtml.sh @@ -2,148 +2,135 @@ # This file is in the public domain # $FreeBSD$ -rm -rf HTML -mkdir -p HTML +set -e -ref_blk=`awk 'NR == 2 {print $3}' Tmp/Ref/_.df` +sh reduce.sh -echo $ref_blk +if [ "x$1" != "x" ] ; then + OPLIST=$1 +else + OPLIST=no_list +fi -H=HTML/index.html -echo ' -

FreeBSD Build Option Survey

-

-This table shows the effect on various build options NO_* build -options in FreeBSD. -

-For each option is shown the effect of applying it to buildworld -alone, installworld alone or to both. -

-For each case is shown the size of the installworld image, the -delta compared to the full installworld and the number of file -system entries added, deleted or changed by the option. -

-The add/delete/change fields link to "mtree(1) -f -f" output -for the relevant files. -For the "changed" data, the first line is the reference copy -and the second line is the result of the applied option. -

Technical notes

-

-This table is generated by software that can be found in -src/tools/tools/build_option_survey. -

-The installworld is made onto a 200MB UFS1 filesystem with -4k blocksize and 512 bytes fragmentsize. This matches -use nanoBSDs filesystem creation usage. -

-For reasons of randomness, the "usr/share/man/whatis" file varies -in size from installworld to installworld, and this generally -dithers the results by a few blocks in one or the other direction. -' > ${H} +OPLIST=_.options -echo "

This table was created on `uname -rm` at `date`" >> ${H} -echo "


" >> ${H} -echo "" >> ${H} -echo ' +ODIR=/usr/obj/`pwd` +RDIR=${ODIR}/_.result +export ODIR RDIR - - - +table_td () ( - - - - - - + awk -v R=$1 -v T=$2 -v M=$4 ' + BEGIN { + t= R "-" T + } + $1 == t { + if ($3 == 0 && $5 == 0 && $7 == 0) { + printf "" + } else { + if ($3 == 0) { + printf "", $3 + } else { + printf "" + } + if ($5 == 0) { + printf "", $5 + } else { + printf "" + } + if ($7 == 0) { + printf "", $7 + } else { + printf "" + } + printf "", $9 + printf "", -$11 + } + printf "\n" + d = 1 + } + END { + if (d != 1) { + printf "" + } + } + ' $3/stats + mkdir -p $HDIR/$4 + cp $3/R*.txt $HDIR/$4 || true +) - - - - - - - - - - - -' >> $H -echo '' >> $H -echo "" >> $H -echo "" >> $H -echo "" >> $H -echo "" >> $H -echo "" >> $H -echo "" >> $H +HDIR=${ODIR}/HTML +rm -rf ${HDIR} +mkdir -p ${HDIR} +H=${HDIR}/index.html + +echo "" > $H +echo "
Build option survey
make.confBuildWorldInstallWorldBuild + InstallWorld
no effect+%d" + printf "+%d", M, t, $3 + printf "-%d" + printf "-%d", M, t, $5 + printf "*%d" + printf "*%d", M, t, $7 + printf "%d%d
BlocksDeltaFilesBlocksDeltaFilesBlocksDeltaFiles
[empty]$ref_blk$ref_blk$ref_blk
" >> $H + +echo "" >> $H +echo "" >> $H +echo "" >> $H +echo "" >> $H +echo "" >> $H echo "" >> $H -grep -v '#' no_list | while read o +echo "" >> $H +echo "" >> $H +echo "" >> $H +echo "" >> $H +echo "" >> $H + +echo "" >> $H +for i in bw iw w do - echo "# $o" - m=`echo "$o=YES" | md5` + echo "" >> $H + echo "" >> $H + echo "" >> $H + echo "" >> $H + echo "" >> $H +done +echo "" >> $H + +grep -v '^[ ]*#' $OPLIST | while read o +do + md=`echo "$o=/dev/YES" | md5` + m=${RDIR}/$md + if [ ! -d $m ] ; then + continue + fi + if [ ! -f $m/stats ] ; then + continue + fi + echo "" >> $H - echo "" >> $H - for d in bw iw w - do - if [ ! -d Tmp/$m/$d ] ; then - echo "" >> $H - continue - fi - if [ ! -f Tmp/$m/$d/_.df ] ; then - echo "" >> $H - continue - fi - blk=`awk 'NR == 2 {print $3}' Tmp/$m/$d/_.df` - echo "" >> $H - echo "" >> $H - mtree -f Tmp/Ref/_.mtree -f Tmp/$m/$d/_.mtree \ - > HTML/$m.$d.mtree.txt - - grep '^[^ ]' \ - HTML/$m.$d.mtree.txt > HTML/$m.$d.sub.txt - grep '^ [^ ]' \ - HTML/$m.$d.mtree.txt > HTML/$m.$d.add.txt - sed ' - /^ [^ ]/d - /^[^ ]/d - / file$/d - / dir$/d - / link$/d - ' HTML/$m.$d.mtree.txt > HTML/$m.$d.chg.txt - - rm -f HTML/$m.$d.mtree.txt - - sub=`wc -l < HTML/$m.$d.sub.txt` - add=`wc -l < HTML/$m.$d.add.txt` - chg=`wc -l < HTML/$m.$d.chg.txt` - chg=`expr $chg / 2` - if [ $add -eq 0 ] ; then - echo "" >> $H - rm -f HTML/$m.$d.add.txt - else - echo "" >> $H - fi - if [ $sub -eq 0 ] ; then - echo "" >> $H - rm -f HTML/$m.$d.sub.txt - else - echo "" >> $H - fi - if [ $chg -eq 0 ] ; then - echo "" >> $H - rm -f HTML/$m.$d.chg.txt - else - echo "" >> $H - fi - - done + echo "" >> $H + if [ -f $m/bw/_.bw ] ; then + echo "" >> $H + else + table_td R BW $m $md >> $H + fi + if [ -f $m/iw/_.iw ] ; then + echo "" >> $H + else + table_td R IW $m $md >> $H + fi + if [ -f $m/w/_.iw -o -f $m/bw/_.bw ] ; then + echo "" >> $H + else + table_td R W $m $md >> $H + fi echo "" >> $H done -echo "
make.confRefRefRef
BuildWorldInstallWorldWorld
ADCKBDelta
" >> $H - cat Tmp/$m/iw/make.conf >> $H - echo "----------$blk`expr $blk - $ref_blk`+$add+$add-$sub-$sub*$chg*$chg
" >> $H
+	cat $m/make.conf >> $H
+	echo "
failedfailedfailed
" >> ${H} -echo "" >> ${H} +echo "" >> $H +echo "" >> $H -#scp -r HTML phk@critter:/tmp -#scp -r HTML phk@phk:www/misc/kernel_options +rsync -r $HDIR/. phk@critter:/tmp/HTML +rsync -r $HDIR/. phk@phk:www/misc/build_options diff --git a/tools/tools/build_option_survey/no_list b/tools/tools/build_option_survey/no_list deleted file mode 100644 index 117b923be770..000000000000 --- a/tools/tools/build_option_survey/no_list +++ /dev/null @@ -1,49 +0,0 @@ -# This file is in the public domain -# $FreeBSD$ -NO_ACPI -NO_ATM -NO_AUTHPF -NO_BIND -NO_BIND_DNSSEC -NO_BIND_LIBS_LWRES -NO_BIND_UTILS -NO_BLUETOOTH -NO_CVS -NO_CXX -NO_DICT -NO_FORTRAN -NO_GAMES -NO_GCOV -NO_GDB -NO_GPIB -NO_HESIOD_LIBC -NO_HTML -NO_I4B -NO_INET6 -NO_INFO -NO_IPFILTER -NO_KERBEROS -NO_KLDLOAD -NO_LIBC_R -NO_LIBPTHREAD -NO_LIBTHR -NO_LPR -NO_MAILWRAPPER -NO_MAN -NO_MODULES -NO_NETCAT -NO_NETGRAPH -NO_NIS -NO_OBJC -NO_P1003_1B -NO_PAM -NO_PF -NO_PROFILE -NO_RCMDS -NO_RESCUE -NO_SENDMAIL -NO_SHAREDOCS -NO_TOOLCHAIN -NO_USB -PPP_NO_NETGRAPH -PPP_NO_RADIUS diff --git a/tools/tools/build_option_survey/option_survey.sh b/tools/tools/build_option_survey/option_survey.sh index 2beadb5ff51a..659333a5f9a2 100644 --- a/tools/tools/build_option_survey/option_survey.sh +++ b/tools/tools/build_option_survey/option_survey.sh @@ -2,6 +2,14 @@ # This file is in the public domain # $FreeBSD$ +if [ "x$1" != "x" ] ; then + OPLIST=$1 +else + OPLIST=no_list +fi + +OPLIST=_.options + set -e bw ( ) ( @@ -48,8 +56,11 @@ iw ( ) ( ODIR=/usr/obj/`pwd` MNT=${ODIR}/_.mnt -MAKEOBJDIRPREFIX=$ODIR -export MAKEOBJDIRPREFIX ODIR MNT +RDIR=${ODIR}/_.result +export ODIR MNT RDIR + + +# Clean and recrate the ODIR if false ; then if rm -rf ${ODIR} ; then @@ -60,86 +71,105 @@ if false ; then fi mkdir -p ${ODIR} - echo '' > ${ODIR}/make.conf +fi +# Build the reference world + +if false ; then + echo '' > ${ODIR}/make.conf + MAKEOBJDIRPREFIX=$ODIR/_.ref + export MAKEOBJDIRPREFIX bw fi +# Parse option list into subdirectories with make.conf files. + if false ; then - rm -rf Tmp - - echo '' > ${ODIR}/make.conf - - if iw ; then - m=Tmp/Ref - mkdir -p $m - cp ${ODIR}/_.df $m - cp ${ODIR}/_.mtree $m - cp ${ODIR}/_.du $m - fi - - cat no_list | while read o + rm -rf ${RDIR} + grep -v '^[ ]*#' $OPLIST | while read o do - echo "IW $o" - echo "$o=YES" > ${ODIR}/make.conf - m=Tmp/`md5 < ${ODIR}/make.conf`/iw - mkdir -p $m - echo $m - cp ${ODIR}/make.conf $m - if iw ; then - cp ${ODIR}/_.df $m - cp ${ODIR}/_.mtree $m - cp ${ODIR}/_.du $m - else - cp ${ODIR}/_.iw $m - cp ${ODIR}/_.ik $m - fi + echo "$o=/dev/YES" > ${ODIR}/_make.conf + m=`md5 < ${ODIR}/_make.conf` + mkdir -p ${RDIR}/$m + mv ${ODIR}/_make.conf ${RDIR}/$m/make.conf done fi +# Do the reference installworld + +if false ; then + echo '' > ${ODIR}/make.conf + MAKEOBJDIRPREFIX=$ODIR/_.ref + export MAKEOBJDIRPREFIX + mkdir -p ${RDIR}/Ref + iw + cp ${ODIR}/_.df ${RDIR}/Ref + cp ${ODIR}/_.mtree ${RDIR}/Ref + cp ${ODIR}/_.du ${RDIR}/Ref +fi + +# Run through each testtarget in turn + if true ; then - cat no_list | while read o + for d in ${RDIR}/[0-9a-z]* do - # First build+installworld - echo "W $o" - echo "$o=YES" > ${ODIR}/make.conf - - m=Tmp/`md5 < ${ODIR}/make.conf`/w - mkdir -p $m - echo $m - cp ${ODIR}/make.conf $m - - if bw ; then - true - else - cp ${ODIR}/_.bw $m || true - cp ${ODIR}/_.bk $m || true - fi - if iw ; then - cp ${ODIR}/_.df $m - cp ${ODIR}/_.mtree $m - cp ${ODIR}/_.du $m - else - cp ${ODIR}/_.iw $m - cp ${ODIR}/_.ik $m + if [ ! -d $d ] ; then + continue; fi + echo '------------------------------------------------' + cat $d/make.conf + echo '------------------------------------------------' + cp $d/make.conf ${ODIR}/make.conf - # Then only buildworld - echo "BW $o" - m=Tmp/`md5 < ${ODIR}/make.conf`/bw - mkdir -p $m - echo $m - cp ${ODIR}/make.conf $m - echo '' > ${ODIR}/make.conf - if iw ; then - cp ${ODIR}/_.df $m - cp ${ODIR}/_.mtree $m - cp ${ODIR}/_.du $m - else - cp ${ODIR}/_.iw $m - cp ${ODIR}/_.ik $m + if [ ! -f $d/iw/done ] ; then + echo "# Trying IW" + rm -rf $d/iw + mkdir -p $d/iw + MAKEOBJDIRPREFIX=$ODIR/_.ref + export MAKEOBJDIRPREFIX + if iw ; then + cp ${ODIR}/_.df $d/iw + cp ${ODIR}/_.mtree $d/iw + cp ${ODIR}/_.du $d/iw + else + cp ${ODIR}/_.iw $d/iw || true + cp ${ODIR}/_.ik $d/iw || true + fi + touch $d/iw/done + fi + if [ ! -f $d/bw/done ] ; then + echo "# Trying BW" + MAKEOBJDIRPREFIX=$ODIR/_.tst + export MAKEOBJDIRPREFIX + if bw ; then + mkdir -p $d/w + if iw ; then + cp ${ODIR}/_.df $d/w + cp ${ODIR}/_.mtree $d/w + cp ${ODIR}/_.du $d/w + else + cp ${ODIR}/_.iw $d/w || true + cp ${ODIR}/_.ik $d/w || true + fi + touch $d/w/done + echo "# Trying W" + mkdir -p $d/bw + echo '' > ${ODIR}/make.conf + if iw ; then + cp ${ODIR}/_.df $d/bw + cp ${ODIR}/_.mtree $d/bw + cp ${ODIR}/_.du $d/bw + else + cp ${ODIR}/_.iw $d/bw || true + cp ${ODIR}/_.ik $d/bw || true + fi + touch $d/bw/done + else + mkdir -p $d/bw + cp ${ODIR}/_.bw $d/bw || true + cp ${ODIR}/_.bk $d/bw || true + touch $d/bw/done + fi fi - - done fi diff --git a/tools/tools/build_option_survey/reduce.sh b/tools/tools/build_option_survey/reduce.sh new file mode 100644 index 000000000000..c4f79cca1562 --- /dev/null +++ b/tools/tools/build_option_survey/reduce.sh @@ -0,0 +1,75 @@ +#!/bin/sh +# This file is in the public domain +# $FreeBSD$ + +if [ "x$1" != "x" ] ; then + OPLIST=$1 +else + OPLIST=no_list +fi + +OPLIST=_.options + +ODIR=/usr/obj/`pwd` +RDIR=${ODIR}/_.result +export ODIR RDIR + + +compa ( ) ( + if [ ! -f $1/_.mtree ] ; then + return + fi + if [ ! -f $2/_.mtree ] ; then + return + fi + + mtree -k uid,gid,mode,nlink,size,link,type,flags \ + -f ${1}/_.mtree -f $2/_.mtree > $2/_.mtree.all.txt + grep '^ ' $2/_.mtree.all.txt > $4/$3.mtree.chg.txt + grep '^[^ ]' $2/_.mtree.all.txt > $4/$3.mtree.sub.txt + grep '^ [^ ]' $2/_.mtree.all.txt > $4/$3.mtree.add.txt + a=`wc -l < $4/$3.mtree.add.txt` + s=`wc -l < $4/$3.mtree.sub.txt` + c=`wc -l < $4/$3.mtree.chg.txt` + c=`expr $c / 2` + + br=`awk 'NR == 2 {print $3}' $1/_.df` + bt=`awk 'NR == 2 {print $3}' $2/_.df` + echo $3 A $a S $s C $c B $bt D `expr $br - $bt` +) + +grep -v '^[ ]*#' $OPLIST | while read o +do + md=`echo "$o=/dev/YES" | md5` + m=${RDIR}/$md + if [ ! -d $m ] ; then + continue + fi + if [ ! -d $m/iw -a ! -d $m/bw -a ! -d $m/w ] ; then + continue + fi + + echo + echo ------------------------------------------------------------- + echo $md + cat $m/make.conf + echo ------------------------------------------------------------- + if [ -f $m/iw/done -a ! -f $m/iw/_.mtree ] ; then + echo "IW failed" + fi + if [ -f $m/bw/done -a ! -f $m/bw/_.mtree ] ; then + echo "BW failed" + fi + if [ -f $m/w/done -a ! -f $m/w/_.mtree ] ; then + echo "W failed" + fi + ( + compa ${RDIR}/Ref/ $m/iw R-IW $m + compa ${RDIR}/Ref/ $m/bw R-BW $m + compa ${RDIR}/Ref/ $m/w R-W $m + compa $m/iw $m/w IW-W $m + compa $m/bw $m/w BW-W $m + compa $m/bw $m/iw BW-IW $m + ) > $m/stats + cat $m/stats +done