diff options
author | phk <phk@FreeBSD.org> | 2006-03-25 10:50:40 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2006-03-25 10:50:40 +0000 |
commit | 4fb406f9ac8e60c9b5f63e1970f91854b603c2e1 (patch) | |
tree | 58be7fe2ce857f5b7234a6ff1336653324fe35ce /tools | |
parent | 6b6242717caaf68cc0462bffebf7d89895e826a9 (diff) | |
download | FreeBSD-src-4fb406f9ac8e60c9b5f63e1970f91854b603c2e1.zip FreeBSD-src-4fb406f9ac8e60c9b5f63e1970f91854b603c2e1.tar.gz |
Update build survey scripts
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/build_option_survey/collect_all_make_options.sh | 45 | ||||
-rw-r--r-- | tools/tools/build_option_survey/listallopts.sh | 22 | ||||
-rw-r--r-- | tools/tools/build_option_survey/mkhtml.sh | 158 | ||||
-rw-r--r-- | tools/tools/build_option_survey/option_survey.sh | 211 | ||||
-rw-r--r-- | tools/tools/build_option_survey/reduce.sh | 48 |
5 files changed, 287 insertions, 197 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 deleted file mode 100644 index 0f25892..0000000 --- a/tools/tools/build_option_survey/collect_all_make_options.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/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/listallopts.sh b/tools/tools/build_option_survey/listallopts.sh new file mode 100644 index 0000000..77c859a --- /dev/null +++ b/tools/tools/build_option_survey/listallopts.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# This file is in the public domain + + +set -e + +T=/tmp/_$$ + +cd /usr/src +make showconfig __MAKE_CONF=/dev/null SRCCONF=/dev/null | + sort | + sed ' + s/^MK_// + s/=// + ' | awk ' + $2 == "yes" { printf "WITHOUT_%s\n", $1 } + $2 == "no" { printf "WITH_%s\n", $1 } + ' + diff --git a/tools/tools/build_option_survey/mkhtml.sh b/tools/tools/build_option_survey/mkhtml.sh index 75a6be2..6e4e164 100644 --- a/tools/tools/build_option_survey/mkhtml.sh +++ b/tools/tools/build_option_survey/mkhtml.sh @@ -2,17 +2,11 @@ # This file is in the public domain # $FreeBSD$ -set -e +set -e sh reduce.sh -if [ "x$1" != "x" ] ; then - OPLIST=$1 -else - OPLIST=no_list -fi - -OPLIST=_.options +OPLIST=`sh listallopts.sh` ODIR=/usr/obj/`pwd` RDIR=${ODIR}/_.result @@ -62,7 +56,7 @@ table_td () ( } ' $3/stats mkdir -p $HDIR/$4 - cp $3/R*.txt $HDIR/$4 || true + cp $3/r*.txt $HDIR/$4 || true ) HDIR=${ODIR}/HTML @@ -70,19 +64,31 @@ rm -rf ${HDIR} mkdir -p ${HDIR} H=${HDIR}/index.html -echo "<HTML>" > $H -echo "<TABLE border=2>" >> $H +echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<HTML>' > $H -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 +echo '<HEAD> +<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<TITLE>FreeBSD Build Options Survey</TITLE> +</HEAD> +<BODY bgcolor="#FFFFFF"> +' >> $H + +echo ' +<H2>The table is explained at the bottom</H2> +<HR> +' >> $H + +echo '<TABLE border="1" cellspacing="0">' >> $H echo "<TR>" >> $H +echo "<TH ROWSPAN=2>src.conf</TH>" >> $H +echo "<TH ROWSPAN=2>MK_FOO</TH>" >> $H +echo "<TH ROWSPAN=2></TH>" >> $H echo "<TH COLSPAN=5>BuildWorld</TH>" >> $H +echo "<TH ROWSPAN=2></TH>" >> $H echo "<TH COLSPAN=5>InstallWorld</TH>" >> $H +echo "<TH ROWSPAN=2></TH>" >> $H echo "<TH COLSPAN=5>World</TH>" >> $H echo "</TR>" >> $H @@ -97,9 +103,21 @@ do done echo "</TR>" >> $H -grep -v '^[ ]*#' $OPLIST | while read o +majcol ( ) ( + echo "<TD></TD>" >> $H + if [ ! -f $3/$1/done ] ; then + echo "<TD align=center COLSPAN=5>no data yet</TD>" >> $H + elif [ -f $3/$1/_.success ] ; then + table_td $2 $1 $3 $4 >> $H + else + echo "<TD align=center COLSPAN=5>failed</TD>" >> $H + fi +) + + +for o in $OPLIST do - md=`echo "$o=/dev/YES" | md5` + md=`echo "${o}=foo" | md5` m=${RDIR}/$md if [ ! -d $m ] ; then continue @@ -107,30 +125,100 @@ do if [ ! -f $m/stats ] ; then continue fi + echo "=== mkhtml ${d}_${o}" echo "<TR>" >> $H echo "<TD><PRE>" >> $H - cat $m/make.conf >> $H + cat $m/src.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 + echo "<TD><PRE>" >> $H + if [ -f $m/w/_.sc ] ; then + comm -13 ${RDIR}/Ref/_.sc $m/w/_.sc >> $H fi + echo "</PRE></TD>" >> $H + + majcol bw r $m $md + majcol iw r $m $md + majcol w r $m $md echo "</TR>" >> $H done echo "</TABLE>" >> $H +echo ' +<HR> +<H2>How to read this table</H2> +<P> +The table has five major columns. + +<OL> +<LI><P><B>src.conf</B></P> +<P>The name of the option being tested</P> +<P> +All options are tested both in their WITH_FOO and WITHOUT_FOO variants +but if the option has no effect (ie: is the default) it will not appear +in the table +</P> +</LI> + +<LI><P><B>MK_FOO</B></P> +<P>Internal build flags affected by this option </P> +</LI> + +<LI><P><B>Buildworld</B></P> +<P>What happens when the option is given to buildworld but not installworld</P> +<PRE>Ie: + make buildworld WITH_FOO=yes + make installworld +</PRE> +</LI> + +<LI><P><B>Installworld</B></P> +<P>What happens when the option is given to installworld but not buildworld</P> +<PRE>Ie: + make buildworld + make installworld WITH_FOO=yes +</PRE> +</LI> + +<LI><P><B>World</B></P> +<P>What happens when the option is given to both buildworld and installworld</P> +<PRE>Ie: + make buildworld WITH_FOO=yes + make installworld WITH_FOO=yes +</PRE> +</LI> +</OL> + +<P>Inside each of the last three major columns there are five subcolumns</P> +<OL> +<LI><P><B>A</B></P> +<P>Number of added files/directories (relative to the option not be given</P> +<P>If non-zero, the number links to a list of the added files/directories</P> +</LI> +<LI><P><B>D</B></P> +<P>Number of deleted files/directories (relative to the option not be given</P> +<P>If non-zero, the number links to a list of the files not installed files/directories</P> +</LI> +<LI><P><B>C</B></P> +<P>Number of changed files/directories (relative to the option not be given</P> +<P>If non-zero, the number links to a list of the files/directories which are differnet (two lines each)</P> +</LI> +<LI><P><B>KB</B></P> +<P>Size of installed operating system in kilobytes</P> +<LI><P><B>Delta</B></P> +<P>Size change in kilobytes relative to the option not be given</P> +</LI> +</OL> + +<HR>' >> $H +echo ' +<p> + <a href="http://validator.w3.org/check?uri=referer"><img + src="http://www.w3.org/Icons/valid-html401" + alt="Valid HTML 4.01 Transitional" height="31" width="88"></a> +</p> + +' >> $H echo "</HTML>" >> $H -rsync -r $HDIR/. phk@critter:/tmp/HTML +echo "rsync phk" rsync -r $HDIR/. phk@phk:www/misc/build_options diff --git a/tools/tools/build_option_survey/option_survey.sh b/tools/tools/build_option_survey/option_survey.sh index 659333a..3fee316 100644 --- a/tools/tools/build_option_survey/option_survey.sh +++ b/tools/tools/build_option_survey/option_survey.sh @@ -2,112 +2,151 @@ # This file is in the public domain # $FreeBSD$ -if [ "x$1" != "x" ] ; then - OPLIST=$1 -else - OPLIST=no_list -fi +set -ex + +OPLIST=`sh listallopts.sh` -OPLIST=_.options +MDUNIT=47 +export MDUNIT -set -e +ODIR=/usr/obj/`pwd` +FDIR=${ODIR}/files +MNT=${ODIR}/_.mnt +RDIR=${ODIR}/_.result + +export ODIR MNT RDIR FDIR bw ( ) ( cd ../../.. + make showconfig \ + SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ + > ${FDIR}/_.sc 2>&1 + a=$? + echo retval $a + if [ $a -ne 0 ] ; then + exit 1 + fi make -j 4 buildworld \ - __MAKE_CONF=${ODIR}/make.conf \ - > ${ODIR}/_.bw 2>&1 + SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ + > ${FDIR}/_.bw 2>&1 + a=$? + echo retval $a + if [ $a -ne 0 ] ; then + exit 1 + fi make -j 4 buildkernel \ KERNCONF=GENERIC \ - __MAKE_CONF=${ODIR}/make.conf \ - > ${ODIR}/_.bk 2>&1 + SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ + > ${FDIR}/_.bk 2>&1 + a=$? + echo retval $a + if [ $a -ne 0 ] ; then + exit 1 + fi + exit 0 ) iw ( ) ( - dd if=/dev/zero of=${ODIR}/_.i bs=1m count=200 + trap "umount ${MNT} || true" 1 2 15 EXIT + newfs -O1 -U -b 4096 -f 512 /dev/md$MDUNIT mkdir -p ${MNT} - MD=`mdconfig -a -t vnode -f ${ODIR}/_.i` - trap "umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT - newfs -O1 -U -b 4096 -f 512 /dev/$MD - mount /dev/${MD} ${MNT} + mount /dev/md${MDUNIT} ${MNT} cd ../../.. make installworld \ - __MAKE_CONF=${ODIR}/make.conf \ + SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ DESTDIR=${MNT} \ - > ${ODIR}/_.iw 2>&1 + > ${FDIR}/_.iw 2>&1 + a=$? + echo retval $a + if [ $a -ne 0 ] ; then + exit 1 + fi cd etc make distribution \ - __MAKE_CONF=${ODIR}/make.conf \ + SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ DESTDIR=${MNT} \ - > ${ODIR}/_.etc 2>&1 + > ${FDIR}/_.etc 2>&1 + a=$? + echo retval $a + if [ $a -ne 0 ] ; then + exit 1 + fi cd .. make installkernel \ KERNCONF=GENERIC \ DESTDIR=${MNT} \ - __MAKE_CONF=${ODIR}/make.conf \ - > ${ODIR}/_.ik 2>&1 + SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ + > ${FDIR}/_.ik 2>&1 + a=$? + echo retval $a + if [ $a -ne 0 ] ; then + exit 1 + fi sync ${MNT} - ( cd ${MNT} && mtree -c ) > ${ODIR}/_.mtree - ( cd ${MNT} && du ) > ${ODIR}/_.du - ( df -i ${MNT} ) > ${ODIR}/_.df + ( cd ${MNT} && mtree -c ) > ${FDIR}/_.mtree + ( cd ${MNT} && du ) > ${FDIR}/_.du + ( df -i ${MNT} ) > ${FDIR}/_.df + echo success > ${FDIR}/_.success + sync + sleep 1 + sync + sleep 1 + trap "" 1 2 15 EXIT + umount ${MNT} + echo "iw done" ) -ODIR=/usr/obj/`pwd` -MNT=${ODIR}/_.mnt -RDIR=${ODIR}/_.result -export ODIR MNT RDIR - -# Clean and recrate the ODIR +# Clean and recreate the ODIR -if false ; then +if true ; then + echo "=== Clean and recreate ${ODIR}" if rm -rf ${ODIR} ; then true else chflags -R noschg ${ODIR} rm -rf ${ODIR} fi - mkdir -p ${ODIR} + mkdir -p ${ODIR} ${FDIR} ${MNT} fi -# Build the reference world +trap "umount ${MNT} || true; mdconfig -d -u $MDUNIT" 1 2 15 EXIT + +umount $MNT || true +mdconfig -d -u $MDUNIT || true +dd if=/dev/zero of=${ODIR}/imgfile bs=1m count=250 +mdconfig -a -t vnode -f ${ODIR}/imgfile -u $MDUNIT + +# Build & install the reference world -if false ; then - echo '' > ${ODIR}/make.conf +if true ; then + echo "=== Build reference world" + echo '' > ${ODIR}/src.conf MAKEOBJDIRPREFIX=$ODIR/_.ref export MAKEOBJDIRPREFIX bw + echo "=== Install reference world" + mkdir -p ${RDIR}/Ref + iw + mv ${FDIR}/_.* ${RDIR}/Ref fi -# Parse option list into subdirectories with make.conf files. +# Parse option list into subdirectories with src.conf files. -if false ; then - rm -rf ${RDIR} - grep -v '^[ ]*#' $OPLIST | while read o +if true ; then + rm -rf ${RDIR}/[0-9a-f]* + for o in $OPLIST do - echo "$o=/dev/YES" > ${ODIR}/_make.conf - m=`md5 < ${ODIR}/_make.conf` + echo "${o}=foo" > ${FDIR}/_src.conf + m=`md5 < ${FDIR}/_src.conf` mkdir -p ${RDIR}/$m - mv ${ODIR}/_make.conf ${RDIR}/$m/make.conf + mv ${FDIR}/_src.conf ${RDIR}/$m/src.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 @@ -117,58 +156,42 @@ if true ; then continue; fi echo '------------------------------------------------' - cat $d/make.conf + cat $d/src.conf echo '------------------------------------------------' - cp $d/make.conf ${ODIR}/make.conf + cp $d/src.conf ${ODIR}/src.conf if [ ! -f $d/iw/done ] ; then - echo "# Trying IW" + MAKEOBJDIRPREFIX=$ODIR/_.ref + export MAKEOBJDIRPREFIX + echo "# BW(ref)+IW(ref) `cat $d/src.conf`" 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 + iw || true + mv ${FDIR}/_.* $d/iw || true touch $d/iw/done fi if [ ! -f $d/bw/done ] ; then - echo "# Trying BW" MAKEOBJDIRPREFIX=$ODIR/_.tst export MAKEOBJDIRPREFIX + echo "# BW(opt) `cat $d/src.conf`" + rm -rf $d/w $d/bw + mkdir -p $d/w $d/bw 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 + mv ${FDIR}/_.* $d/bw || true + + echo "# BW(opt)+IW(opt) `cat $d/src.conf`" + iw || true + mv ${FDIR}/_.* $d/w || true 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 + + echo "# BW(opt)+IW(ref) `cat $d/src.conf`" + echo '' > ${ODIR}/src.conf + iw || true + mv ${FDIR}/_.* $d/bw || true 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 + mv ${FDIR}/_.* $d/bw || true + touch $d/bw/done $d/w/done fi fi done diff --git a/tools/tools/build_option_survey/reduce.sh b/tools/tools/build_option_survey/reduce.sh index c4f79cc..3755749 100644 --- a/tools/tools/build_option_survey/reduce.sh +++ b/tools/tools/build_option_survey/reduce.sh @@ -2,13 +2,9 @@ # This file is in the public domain # $FreeBSD$ -if [ "x$1" != "x" ] ; then - OPLIST=$1 -else - OPLIST=no_list -fi +set -e -OPLIST=_.options +OPLIST=`sh listallopts.sh` ODIR=/usr/obj/`pwd` RDIR=${ODIR}/_.result @@ -24,23 +20,23 @@ compa ( ) ( 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 + -f ${1}/_.mtree -f $2/_.mtree > $2/_.mtree.all.txt || true + grep '^ ' $2/_.mtree.all.txt > $4/$3.mtree.chg.txt || true + grep '^[^ ]' $2/_.mtree.all.txt > $4/$3.mtree.sub.txt || true + grep '^ [^ ]' $2/_.mtree.all.txt > $4/$3.mtree.add.txt || true 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` + c=`expr $c / 2 || true` 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 +for o in $OPLIST do - md=`echo "$o=/dev/YES" | md5` + md=`echo "${o}=foo" | md5` m=${RDIR}/$md if [ ! -d $m ] ; then continue @@ -48,28 +44,34 @@ do if [ ! -d $m/iw -a ! -d $m/bw -a ! -d $m/w ] ; then continue fi + echo "=== reduce ${o}" echo echo ------------------------------------------------------------- echo $md - cat $m/make.conf + cat $m/src.conf echo ------------------------------------------------------------- - if [ -f $m/iw/done -a ! -f $m/iw/_.mtree ] ; then + if [ ! -f $m/iw/done ] ; then + echo "IW pending" + elif [ ! -f $m/iw/_.success ] ; then echo "IW failed" fi - if [ -f $m/bw/done -a ! -f $m/bw/_.mtree ] ; then + if [ ! -f $m/bw/done ] ; then + echo "BW pending" + elif [ ! -f $m/bw/_.success ] ; then echo "BW failed" fi - if [ -f $m/w/done -a ! -f $m/w/_.mtree ] ; then + if [ ! -f $m/w/done ] ; then + echo "W pending" + elif [ ! -f $m/w/_.success ] ; 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 + for x in iw bw w + do + compa ${RDIR}/Ref/ $m/$x r-$x $m + done ) > $m/stats cat $m/stats done +echo "== reduce done" |