summaryrefslogtreecommitdiffstats
path: root/tools/tools/build_option_survey
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2005-08-09 09:27:11 +0000
committerphk <phk@FreeBSD.org>2005-08-09 09:27:11 +0000
commited93898ca2aeee26e9aa745a6388cefa5a5fe0e8 (patch)
tree4280aa2e34192cfd3f24a480d11125a2a17ec841 /tools/tools/build_option_survey
parentf2edd835a70c8c4dbde8caf8d9f28cc02446c2c2 (diff)
downloadFreeBSD-src-ed93898ca2aeee26e9aa745a6388cefa5a5fe0e8.zip
FreeBSD-src-ed93898ca2aeee26e9aa745a6388cefa5a5fe0e8.tar.gz
Update to latest version of this tool.
Takes about a week for a full run.
Diffstat (limited to 'tools/tools/build_option_survey')
-rw-r--r--tools/tools/build_option_survey/collect_all_make_options.sh45
-rw-r--r--tools/tools/build_option_survey/mkhtml.sh247
-rw-r--r--tools/tools/build_option_survey/no_list49
-rw-r--r--tools/tools/build_option_survey/option_survey.sh166
-rw-r--r--tools/tools/build_option_survey/reduce.sh75
5 files changed, 335 insertions, 247 deletions
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 0000000..0f25892
--- /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 cff7aea..75a6be2 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 '<HTML>
-<H1>FreeBSD Build Option Survey</H1>
-<P>
-This table shows the effect on various build options NO_* build
-options in FreeBSD.
-<P>
-For each option is shown the effect of applying it to buildworld
-alone, installworld alone or to both.
-<P>
-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.
-<P>
-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.
-<H2>Technical notes</H2>
-<P>
-This table is generated by software that can be found in
-src/tools/tools/build_option_survey.
-<P>
-The installworld is made onto a 200MB UFS1 filesystem with
-4k blocksize and 512 bytes fragmentsize. This matches
-use nanoBSDs filesystem creation usage.
-<P>
-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 "<P>This table was created on `uname -rm` at `date`" >> ${H}
-echo "<HR>" >> ${H}
-echo "<TABLE border=2>" >> ${H}
-echo '
+ODIR=/usr/obj/`pwd`
+RDIR=${ODIR}/_.result
+export ODIR RDIR
-<TR>
-<TH COLSPAN=16>Build option survey</TH>
-</TR>
+table_td () (
-<TR>
-<TH ROWSPAN=2>make.conf</TH>
-<TH COLSPAN=5>BuildWorld</TH>
-<TH COLSPAN=5>InstallWorld</TH>
-<TH COLSPAN=5>Build + InstallWorld</TH>
-</TR>
+ awk -v R=$1 -v T=$2 -v M=$4 '
+ BEGIN {
+ t= R "-" T
+ }
+ $1 == t {
+ if ($3 == 0 && $5 == 0 && $7 == 0) {
+ printf "<TD align=center COLSPAN=5>no effect</TD>"
+ } else {
+ if ($3 == 0) {
+ printf "<TD align=right>+%d</TD>", $3
+ } else {
+ printf "<TD align=right>"
+ printf "<A HREF=\"%s/%s.mtree.add.txt\">+%d</A>", M, t, $3
+ printf "</TD>"
+ }
+ if ($5 == 0) {
+ printf "<TD align=right>-%d</TD>", $5
+ } else {
+ printf "<TD align=right>"
+ printf "<A HREF=\"%s/%s.mtree.sub.txt\">-%d</A>", M, t, $5
+ printf "</TD>"
+ }
+ if ($7 == 0) {
+ printf "<TD align=right>*%d</TD>", $7
+ } else {
+ printf "<TD align=right>"
+ printf "<A HREF=\"%s/%s.mtree.chg.txt\">*%d</A>", M, t, $7
+ printf "</TD>"
+ }
+ printf "<TD align=right>%d</TD>", $9
+ printf "<TD align=right>%d</TD>", -$11
+ }
+ printf "\n"
+ d = 1
+ }
+ END {
+ if (d != 1) {
+ printf "<TD COLSPAN=5></TD>"
+ }
+ }
+ ' $3/stats
+ mkdir -p $HDIR/$4
+ cp $3/R*.txt $HDIR/$4 || true
+)
-<TR>
-<TH>Blocks</TH>
-<TH>Delta</TH>
-<TH COLSPAN=3>Files</TH>
-<TH>Blocks</TH>
-<TH>Delta</TH>
-<TH COLSPAN=3>Files</TH>
-<TH>Blocks</TH>
-<TH>Delta</TH>
-<TH COLSPAN=3>Files</TH>
-</TR>
-' >> $H
-echo '<TR><TD><I>[empty]</I></TD>' >> $H
-echo "<TD align=right>$ref_blk</TD>" >> $H
-echo "<TD></TD><TD></TD><TD></TD><TD></TD>" >> $H
-echo "<TD align=right>$ref_blk</TD>" >> $H
-echo "<TD></TD><TD></TD><TD></TD><TD></TD>" >> $H
-echo "<TD align=right>$ref_blk</TD>" >> $H
-echo "<TD></TD><TD></TD><TD></TD><TD></TD>" >> $H
-echo "</TR>" >> $H
+HDIR=${ODIR}/HTML
+rm -rf ${HDIR}
+mkdir -p ${HDIR}
+H=${HDIR}/index.html
-grep -v '#' no_list | while read o
-do
- echo "# $o"
- m=`echo "$o=YES" | md5`
- echo "<TR>" >> $H
- echo "<TD>" >> $H
- cat Tmp/$m/iw/make.conf >> $H
- echo "</TD>" >> $H
- for d in bw iw w
- do
- if [ ! -d Tmp/$m/$d ] ; then
- echo "<TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD>" >> $H
- continue
- fi
- if [ ! -f Tmp/$m/$d/_.df ] ; then
- echo "<TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD>" >> $H
- continue
- fi
- blk=`awk 'NR == 2 {print $3}' Tmp/$m/$d/_.df`
- echo "<TD align=right>$blk</TD>" >> $H
- echo "<TD align=right>`expr $blk - $ref_blk`</TD>" >> $H
- mtree -f Tmp/Ref/_.mtree -f Tmp/$m/$d/_.mtree \
- > HTML/$m.$d.mtree.txt
+echo "<HTML>" > $H
+echo "<TABLE border=2>" >> $H
- 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
+echo "<TR>" >> $H
+echo "<TH ROWSPAN=3>make.conf</TH>" >> $H
+echo "<TH COLSPAN=5>Ref</TH>" >> $H
+echo "<TH COLSPAN=5>Ref</TH>" >> $H
+echo "<TH COLSPAN=5>Ref</TH>" >> $H
+echo "</TR>" >> $H
- rm -f HTML/$m.$d.mtree.txt
+echo "<TR>" >> $H
+echo "<TH COLSPAN=5>BuildWorld</TH>" >> $H
+echo "<TH COLSPAN=5>InstallWorld</TH>" >> $H
+echo "<TH COLSPAN=5>World</TH>" >> $H
+echo "</TR>" >> $H
- 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 "<TD align=right>+$add</TD>" >> $H
- rm -f HTML/$m.$d.add.txt
- else
- echo "<TD align=right><A href=\"$m.$d.add.txt\">+$add</A></TD>" >> $H
- fi
- if [ $sub -eq 0 ] ; then
- echo "<TD align=right>-$sub</TD>" >> $H
- rm -f HTML/$m.$d.sub.txt
- else
- echo "<TD align=right><A href=\"$m.$d.sub.txt\">-$sub</A></TD>" >> $H
- fi
- if [ $chg -eq 0 ] ; then
- echo "<TD align=right>*$chg</TD>" >> $H
- rm -f HTML/$m.$d.chg.txt
- else
- echo "<TD align=right><A href=\"$m.$d.chg.txt\">*$chg</A></TD>" >> $H
- fi
+echo "<TR>" >> $H
+for i in bw iw w
+do
+ echo "<TH>A</TH>" >> $H
+ echo "<TH>D</TH>" >> $H
+ echo "<TH>C</TH>" >> $H
+ echo "<TH>KB</TH>" >> $H
+ echo "<TH>Delta</TH>" >> $H
+done
+echo "</TR>" >> $H
- done
+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 "<TR>" >> $H
+ echo "<TD><PRE>" >> $H
+ cat $m/make.conf >> $H
+ echo "</PRE></TD>" >> $H
+ if [ -f $m/bw/_.bw ] ; then
+ echo "<TD align=center COLSPAN=5>failed</TD>" >> $H
+ else
+ table_td R BW $m $md >> $H
+ fi
+ if [ -f $m/iw/_.iw ] ; then
+ echo "<TD align=center COLSPAN=5>failed</TD>" >> $H
+ else
+ table_td R IW $m $md >> $H
+ fi
+ if [ -f $m/w/_.iw -o -f $m/bw/_.bw ] ; then
+ echo "<TD align=center COLSPAN=5>failed</TD>" >> $H
+ else
+ table_td R W $m $md >> $H
+ fi
echo "</TR>" >> $H
done
-echo "</TABLE>" >> ${H}
-echo "</HTML>" >> ${H}
+echo "</TABLE>" >> $H
+echo "</HTML>" >> $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 117b923..0000000
--- 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 2beadb5..659333a 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
-
- bw
fi
-if false ; then
- rm -rf Tmp
+# Build the reference world
+if false ; then
echo '' > ${ODIR}/make.conf
+ MAKEOBJDIRPREFIX=$ODIR/_.ref
+ export MAKEOBJDIRPREFIX
+ bw
+fi
- if iw ; then
- m=Tmp/Ref
- mkdir -p $m
- cp ${ODIR}/_.df $m
- cp ${ODIR}/_.mtree $m
- cp ${ODIR}/_.du $m
- fi
+# Parse option list into subdirectories with make.conf files.
- cat no_list | while read o
+if false ; then
+ 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
+ if [ ! -d $d ] ; then
+ continue;
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
+ echo '------------------------------------------------'
+ cat $d/make.conf
+ echo '------------------------------------------------'
+ cp $d/make.conf ${ODIR}/make.conf
+
+ 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
-
- # 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/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 0000000..c4f79cc
--- /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
OpenPOWER on IntegriCloud