168d71fe7SPoul-Henning Kamp#!/bin/sh 268d71fe7SPoul-Henning Kamp# This file is in the public domain 368d71fe7SPoul-Henning Kamp 4f5ce64b9SPoul-Henning Kampset -ex 522aec2a3SPoul-Henning Kamp 6f5ce64b9SPoul-Henning KampOPLIST=`sh listallopts.sh` 722aec2a3SPoul-Henning Kamp 8f5ce64b9SPoul-Henning KampMDUNIT=47 9f5ce64b9SPoul-Henning Kampexport MDUNIT 10f5ce64b9SPoul-Henning Kamp 11f5ce64b9SPoul-Henning KampODIR=/usr/obj/`pwd` 12f5ce64b9SPoul-Henning KampFDIR=${ODIR}/files 13f5ce64b9SPoul-Henning KampMNT=${ODIR}/_.mnt 14f5ce64b9SPoul-Henning KampRDIR=${ODIR}/_.result 1599980563SBryan Drewery: ${MAKE_JOBS:="-j$(sysctl -n hw.ncpu)"} 16f5ce64b9SPoul-Henning Kamp 17f5ce64b9SPoul-Henning Kampexport ODIR MNT RDIR FDIR 1868d71fe7SPoul-Henning Kamp 1968d71fe7SPoul-Henning Kampbw ( ) ( 2068d71fe7SPoul-Henning Kamp cd ../../.. 21f5ce64b9SPoul-Henning Kamp make showconfig \ 22f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 23f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.sc 2>&1 24f5ce64b9SPoul-Henning Kamp a=$? 25f5ce64b9SPoul-Henning Kamp echo retval $a 26f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 27f5ce64b9SPoul-Henning Kamp exit 1 28f5ce64b9SPoul-Henning Kamp fi 2999980563SBryan Drewery make ${MAKE_JOBS} buildworld \ 30f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 31f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.bw 2>&1 32f5ce64b9SPoul-Henning Kamp a=$? 33f5ce64b9SPoul-Henning Kamp echo retval $a 34f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 35f5ce64b9SPoul-Henning Kamp exit 1 36f5ce64b9SPoul-Henning Kamp fi 3799980563SBryan Drewery make ${MAKE_JOBS} buildkernel \ 3868d71fe7SPoul-Henning Kamp KERNCONF=GENERIC \ 39f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 40f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.bk 2>&1 41f5ce64b9SPoul-Henning Kamp a=$? 42f5ce64b9SPoul-Henning Kamp echo retval $a 43f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 44f5ce64b9SPoul-Henning Kamp exit 1 45f5ce64b9SPoul-Henning Kamp fi 46f5ce64b9SPoul-Henning Kamp exit 0 4768d71fe7SPoul-Henning Kamp) 4868d71fe7SPoul-Henning Kamp 4968d71fe7SPoul-Henning Kampiw ( ) ( 50f5ce64b9SPoul-Henning Kamp trap "umount ${MNT} || true" 1 2 15 EXIT 51f5ce64b9SPoul-Henning Kamp newfs -O1 -U -b 4096 -f 512 /dev/md$MDUNIT 5268d71fe7SPoul-Henning Kamp mkdir -p ${MNT} 53f5ce64b9SPoul-Henning Kamp mount /dev/md${MDUNIT} ${MNT} 5468d71fe7SPoul-Henning Kamp 5568d71fe7SPoul-Henning Kamp cd ../../.. 5699980563SBryan Drewery make ${MAKE_JOBS} installworld \ 57f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 5868d71fe7SPoul-Henning Kamp DESTDIR=${MNT} \ 59f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.iw 2>&1 60f5ce64b9SPoul-Henning Kamp a=$? 61f5ce64b9SPoul-Henning Kamp echo retval $a 62f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 63f5ce64b9SPoul-Henning Kamp exit 1 64f5ce64b9SPoul-Henning Kamp fi 6568d71fe7SPoul-Henning Kamp cd etc 6668d71fe7SPoul-Henning Kamp make distribution \ 67f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 6868d71fe7SPoul-Henning Kamp DESTDIR=${MNT} \ 69f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.etc 2>&1 70f5ce64b9SPoul-Henning Kamp a=$? 71f5ce64b9SPoul-Henning Kamp echo retval $a 72f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 73f5ce64b9SPoul-Henning Kamp exit 1 74f5ce64b9SPoul-Henning Kamp fi 7568d71fe7SPoul-Henning Kamp cd .. 7699980563SBryan Drewery make ${MAKE_JOBS} installkernel \ 7768d71fe7SPoul-Henning Kamp KERNCONF=GENERIC \ 7868d71fe7SPoul-Henning Kamp DESTDIR=${MNT} \ 79f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 80f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.ik 2>&1 81f5ce64b9SPoul-Henning Kamp a=$? 82f5ce64b9SPoul-Henning Kamp echo retval $a 83f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 84f5ce64b9SPoul-Henning Kamp exit 1 85f5ce64b9SPoul-Henning Kamp fi 8668d71fe7SPoul-Henning Kamp 8768d71fe7SPoul-Henning Kamp sync ${MNT} 88f5ce64b9SPoul-Henning Kamp ( cd ${MNT} && mtree -c ) > ${FDIR}/_.mtree 89f5ce64b9SPoul-Henning Kamp ( cd ${MNT} && du ) > ${FDIR}/_.du 90f5ce64b9SPoul-Henning Kamp ( df -i ${MNT} ) > ${FDIR}/_.df 91f5ce64b9SPoul-Henning Kamp echo success > ${FDIR}/_.success 92f5ce64b9SPoul-Henning Kamp sync 93f5ce64b9SPoul-Henning Kamp sleep 1 94f5ce64b9SPoul-Henning Kamp sync 95f5ce64b9SPoul-Henning Kamp sleep 1 96f5ce64b9SPoul-Henning Kamp trap "" 1 2 15 EXIT 97f5ce64b9SPoul-Henning Kamp umount ${MNT} 98f5ce64b9SPoul-Henning Kamp echo "iw done" 9968d71fe7SPoul-Henning Kamp) 10068d71fe7SPoul-Henning Kamp 10122aec2a3SPoul-Henning Kamp 102f5ce64b9SPoul-Henning Kamp# Clean and recreate the ODIR 10322aec2a3SPoul-Henning Kamp 104f5ce64b9SPoul-Henning Kampif true ; then 105f5ce64b9SPoul-Henning Kamp echo "=== Clean and recreate ${ODIR}" 10668d71fe7SPoul-Henning Kamp if rm -rf ${ODIR} ; then 10768d71fe7SPoul-Henning Kamp true 10868d71fe7SPoul-Henning Kamp else 10968d71fe7SPoul-Henning Kamp chflags -R noschg ${ODIR} 11068d71fe7SPoul-Henning Kamp rm -rf ${ODIR} 11168d71fe7SPoul-Henning Kamp fi 112f5ce64b9SPoul-Henning Kamp mkdir -p ${ODIR} ${FDIR} ${MNT} 11368d71fe7SPoul-Henning Kamp 11422aec2a3SPoul-Henning Kampfi 11568d71fe7SPoul-Henning Kamp 116f5ce64b9SPoul-Henning Kamptrap "umount ${MNT} || true; mdconfig -d -u $MDUNIT" 1 2 15 EXIT 11722aec2a3SPoul-Henning Kamp 118f5ce64b9SPoul-Henning Kampumount $MNT || true 119f5ce64b9SPoul-Henning Kampmdconfig -d -u $MDUNIT || true 120*be3631bcSMichael Dexterdd if=/dev/zero of=${ODIR}/imgfile bs=1m count=5120 121f5ce64b9SPoul-Henning Kampmdconfig -a -t vnode -f ${ODIR}/imgfile -u $MDUNIT 122f5ce64b9SPoul-Henning Kamp 123f5ce64b9SPoul-Henning Kamp# Build & install the reference world 124f5ce64b9SPoul-Henning Kamp 125f5ce64b9SPoul-Henning Kampif true ; then 126f5ce64b9SPoul-Henning Kamp echo "=== Build reference world" 127f5ce64b9SPoul-Henning Kamp echo '' > ${ODIR}/src.conf 12822aec2a3SPoul-Henning Kamp MAKEOBJDIRPREFIX=$ODIR/_.ref 12922aec2a3SPoul-Henning Kamp export MAKEOBJDIRPREFIX 13068d71fe7SPoul-Henning Kamp bw 131f5ce64b9SPoul-Henning Kamp echo "=== Install reference world" 13222aec2a3SPoul-Henning Kamp mkdir -p ${RDIR}/Ref 13322aec2a3SPoul-Henning Kamp iw 134f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* ${RDIR}/Ref 135f5ce64b9SPoul-Henning Kampfi 136f5ce64b9SPoul-Henning Kamp 137f5ce64b9SPoul-Henning Kamp# Parse option list into subdirectories with src.conf files. 138f5ce64b9SPoul-Henning Kamp 139f5ce64b9SPoul-Henning Kampif true ; then 140f5ce64b9SPoul-Henning Kamp rm -rf ${RDIR}/[0-9a-f]* 141f5ce64b9SPoul-Henning Kamp for o in $OPLIST 142f5ce64b9SPoul-Henning Kamp do 143f5ce64b9SPoul-Henning Kamp echo "${o}=foo" > ${FDIR}/_src.conf 144f5ce64b9SPoul-Henning Kamp m=`md5 < ${FDIR}/_src.conf` 145f5ce64b9SPoul-Henning Kamp mkdir -p ${RDIR}/$m 146f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_src.conf ${RDIR}/$m/src.conf 147f5ce64b9SPoul-Henning Kamp done 14822aec2a3SPoul-Henning Kampfi 14922aec2a3SPoul-Henning Kamp 15022aec2a3SPoul-Henning Kamp# Run through each testtarget in turn 15122aec2a3SPoul-Henning Kamp 15268d71fe7SPoul-Henning Kampif true ; then 15322aec2a3SPoul-Henning Kamp for d in ${RDIR}/[0-9a-z]* 15468d71fe7SPoul-Henning Kamp do 15522aec2a3SPoul-Henning Kamp if [ ! -d $d ] ; then 15622aec2a3SPoul-Henning Kamp continue; 15768d71fe7SPoul-Henning Kamp fi 15822aec2a3SPoul-Henning Kamp echo '------------------------------------------------' 159f5ce64b9SPoul-Henning Kamp cat $d/src.conf 16022aec2a3SPoul-Henning Kamp echo '------------------------------------------------' 161f5ce64b9SPoul-Henning Kamp cp $d/src.conf ${ODIR}/src.conf 16222aec2a3SPoul-Henning Kamp 16322aec2a3SPoul-Henning Kamp if [ ! -f $d/iw/done ] ; then 16422aec2a3SPoul-Henning Kamp MAKEOBJDIRPREFIX=$ODIR/_.ref 16522aec2a3SPoul-Henning Kamp export MAKEOBJDIRPREFIX 166f5ce64b9SPoul-Henning Kamp echo "# BW(ref)+IW(ref) `cat $d/src.conf`" 167f5ce64b9SPoul-Henning Kamp rm -rf $d/iw 168f5ce64b9SPoul-Henning Kamp mkdir -p $d/iw 169f5ce64b9SPoul-Henning Kamp iw || true 170f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/iw || true 17122aec2a3SPoul-Henning Kamp touch $d/iw/done 17222aec2a3SPoul-Henning Kamp fi 17322aec2a3SPoul-Henning Kamp if [ ! -f $d/bw/done ] ; then 17422aec2a3SPoul-Henning Kamp MAKEOBJDIRPREFIX=$ODIR/_.tst 17522aec2a3SPoul-Henning Kamp export MAKEOBJDIRPREFIX 176f5ce64b9SPoul-Henning Kamp echo "# BW(opt) `cat $d/src.conf`" 177f5ce64b9SPoul-Henning Kamp rm -rf $d/w $d/bw 178f5ce64b9SPoul-Henning Kamp mkdir -p $d/w $d/bw 17922aec2a3SPoul-Henning Kamp if bw ; then 180f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/bw || true 181f5ce64b9SPoul-Henning Kamp 182f5ce64b9SPoul-Henning Kamp echo "# BW(opt)+IW(opt) `cat $d/src.conf`" 183f5ce64b9SPoul-Henning Kamp iw || true 184f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/w || true 18522aec2a3SPoul-Henning Kamp touch $d/w/done 186f5ce64b9SPoul-Henning Kamp 187f5ce64b9SPoul-Henning Kamp echo "# BW(opt)+IW(ref) `cat $d/src.conf`" 188f5ce64b9SPoul-Henning Kamp echo '' > ${ODIR}/src.conf 189f5ce64b9SPoul-Henning Kamp iw || true 190f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/bw || true 19122aec2a3SPoul-Henning Kamp touch $d/bw/done 19222aec2a3SPoul-Henning Kamp else 193f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/bw || true 194f5ce64b9SPoul-Henning Kamp touch $d/bw/done $d/w/done 19522aec2a3SPoul-Henning Kamp fi 19622aec2a3SPoul-Henning Kamp fi 19768d71fe7SPoul-Henning Kamp done 19868d71fe7SPoul-Henning Kampfi 199