168d71fe7SPoul-Henning Kamp#!/bin/sh 268d71fe7SPoul-Henning Kamp# This file is in the public domain 368d71fe7SPoul-Henning Kamp# $FreeBSD$ 468d71fe7SPoul-Henning Kamp 5f5ce64b9SPoul-Henning Kampset -ex 622aec2a3SPoul-Henning Kamp 7f5ce64b9SPoul-Henning KampOPLIST=`sh listallopts.sh` 822aec2a3SPoul-Henning Kamp 9f5ce64b9SPoul-Henning KampMDUNIT=47 10f5ce64b9SPoul-Henning Kampexport MDUNIT 11f5ce64b9SPoul-Henning Kamp 12f5ce64b9SPoul-Henning KampODIR=/usr/obj/`pwd` 13f5ce64b9SPoul-Henning KampFDIR=${ODIR}/files 14f5ce64b9SPoul-Henning KampMNT=${ODIR}/_.mnt 15f5ce64b9SPoul-Henning KampRDIR=${ODIR}/_.result 16*99980563SBryan Drewery: ${MAKE_JOBS:="-j$(sysctl -n hw.ncpu)"} 17f5ce64b9SPoul-Henning Kamp 18f5ce64b9SPoul-Henning Kampexport ODIR MNT RDIR FDIR 1968d71fe7SPoul-Henning Kamp 2068d71fe7SPoul-Henning Kampbw ( ) ( 2168d71fe7SPoul-Henning Kamp cd ../../.. 22f5ce64b9SPoul-Henning Kamp make showconfig \ 23f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 24f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.sc 2>&1 25f5ce64b9SPoul-Henning Kamp a=$? 26f5ce64b9SPoul-Henning Kamp echo retval $a 27f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 28f5ce64b9SPoul-Henning Kamp exit 1 29f5ce64b9SPoul-Henning Kamp fi 30*99980563SBryan Drewery make ${MAKE_JOBS} buildworld \ 31f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 32f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.bw 2>&1 33f5ce64b9SPoul-Henning Kamp a=$? 34f5ce64b9SPoul-Henning Kamp echo retval $a 35f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 36f5ce64b9SPoul-Henning Kamp exit 1 37f5ce64b9SPoul-Henning Kamp fi 38*99980563SBryan Drewery make ${MAKE_JOBS} buildkernel \ 3968d71fe7SPoul-Henning Kamp KERNCONF=GENERIC \ 40f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 41f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.bk 2>&1 42f5ce64b9SPoul-Henning Kamp a=$? 43f5ce64b9SPoul-Henning Kamp echo retval $a 44f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 45f5ce64b9SPoul-Henning Kamp exit 1 46f5ce64b9SPoul-Henning Kamp fi 47f5ce64b9SPoul-Henning Kamp exit 0 4868d71fe7SPoul-Henning Kamp) 4968d71fe7SPoul-Henning Kamp 5068d71fe7SPoul-Henning Kampiw ( ) ( 51f5ce64b9SPoul-Henning Kamp trap "umount ${MNT} || true" 1 2 15 EXIT 52f5ce64b9SPoul-Henning Kamp newfs -O1 -U -b 4096 -f 512 /dev/md$MDUNIT 5368d71fe7SPoul-Henning Kamp mkdir -p ${MNT} 54f5ce64b9SPoul-Henning Kamp mount /dev/md${MDUNIT} ${MNT} 5568d71fe7SPoul-Henning Kamp 5668d71fe7SPoul-Henning Kamp cd ../../.. 57*99980563SBryan Drewery make ${MAKE_JOBS} installworld \ 58f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 5968d71fe7SPoul-Henning Kamp DESTDIR=${MNT} \ 60f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.iw 2>&1 61f5ce64b9SPoul-Henning Kamp a=$? 62f5ce64b9SPoul-Henning Kamp echo retval $a 63f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 64f5ce64b9SPoul-Henning Kamp exit 1 65f5ce64b9SPoul-Henning Kamp fi 6668d71fe7SPoul-Henning Kamp cd etc 6768d71fe7SPoul-Henning Kamp make distribution \ 68f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 6968d71fe7SPoul-Henning Kamp DESTDIR=${MNT} \ 70f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.etc 2>&1 71f5ce64b9SPoul-Henning Kamp a=$? 72f5ce64b9SPoul-Henning Kamp echo retval $a 73f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 74f5ce64b9SPoul-Henning Kamp exit 1 75f5ce64b9SPoul-Henning Kamp fi 7668d71fe7SPoul-Henning Kamp cd .. 77*99980563SBryan Drewery make ${MAKE_JOBS} installkernel \ 7868d71fe7SPoul-Henning Kamp KERNCONF=GENERIC \ 7968d71fe7SPoul-Henning Kamp DESTDIR=${MNT} \ 80f5ce64b9SPoul-Henning Kamp SRCCONF=${ODIR}/src.conf __MAKE_CONF=/dev/null \ 81f5ce64b9SPoul-Henning Kamp > ${FDIR}/_.ik 2>&1 82f5ce64b9SPoul-Henning Kamp a=$? 83f5ce64b9SPoul-Henning Kamp echo retval $a 84f5ce64b9SPoul-Henning Kamp if [ $a -ne 0 ] ; then 85f5ce64b9SPoul-Henning Kamp exit 1 86f5ce64b9SPoul-Henning Kamp fi 8768d71fe7SPoul-Henning Kamp 8868d71fe7SPoul-Henning Kamp sync ${MNT} 89f5ce64b9SPoul-Henning Kamp ( cd ${MNT} && mtree -c ) > ${FDIR}/_.mtree 90f5ce64b9SPoul-Henning Kamp ( cd ${MNT} && du ) > ${FDIR}/_.du 91f5ce64b9SPoul-Henning Kamp ( df -i ${MNT} ) > ${FDIR}/_.df 92f5ce64b9SPoul-Henning Kamp echo success > ${FDIR}/_.success 93f5ce64b9SPoul-Henning Kamp sync 94f5ce64b9SPoul-Henning Kamp sleep 1 95f5ce64b9SPoul-Henning Kamp sync 96f5ce64b9SPoul-Henning Kamp sleep 1 97f5ce64b9SPoul-Henning Kamp trap "" 1 2 15 EXIT 98f5ce64b9SPoul-Henning Kamp umount ${MNT} 99f5ce64b9SPoul-Henning Kamp echo "iw done" 10068d71fe7SPoul-Henning Kamp) 10168d71fe7SPoul-Henning Kamp 10222aec2a3SPoul-Henning Kamp 103f5ce64b9SPoul-Henning Kamp# Clean and recreate the ODIR 10422aec2a3SPoul-Henning Kamp 105f5ce64b9SPoul-Henning Kampif true ; then 106f5ce64b9SPoul-Henning Kamp echo "=== Clean and recreate ${ODIR}" 10768d71fe7SPoul-Henning Kamp if rm -rf ${ODIR} ; then 10868d71fe7SPoul-Henning Kamp true 10968d71fe7SPoul-Henning Kamp else 11068d71fe7SPoul-Henning Kamp chflags -R noschg ${ODIR} 11168d71fe7SPoul-Henning Kamp rm -rf ${ODIR} 11268d71fe7SPoul-Henning Kamp fi 113f5ce64b9SPoul-Henning Kamp mkdir -p ${ODIR} ${FDIR} ${MNT} 11468d71fe7SPoul-Henning Kamp 11522aec2a3SPoul-Henning Kampfi 11668d71fe7SPoul-Henning Kamp 117f5ce64b9SPoul-Henning Kamptrap "umount ${MNT} || true; mdconfig -d -u $MDUNIT" 1 2 15 EXIT 11822aec2a3SPoul-Henning Kamp 119f5ce64b9SPoul-Henning Kampumount $MNT || true 120f5ce64b9SPoul-Henning Kampmdconfig -d -u $MDUNIT || true 121f5ce64b9SPoul-Henning Kampdd if=/dev/zero of=${ODIR}/imgfile bs=1m count=250 122f5ce64b9SPoul-Henning Kampmdconfig -a -t vnode -f ${ODIR}/imgfile -u $MDUNIT 123f5ce64b9SPoul-Henning Kamp 124f5ce64b9SPoul-Henning Kamp# Build & install the reference world 125f5ce64b9SPoul-Henning Kamp 126f5ce64b9SPoul-Henning Kampif true ; then 127f5ce64b9SPoul-Henning Kamp echo "=== Build reference world" 128f5ce64b9SPoul-Henning Kamp echo '' > ${ODIR}/src.conf 12922aec2a3SPoul-Henning Kamp MAKEOBJDIRPREFIX=$ODIR/_.ref 13022aec2a3SPoul-Henning Kamp export MAKEOBJDIRPREFIX 13168d71fe7SPoul-Henning Kamp bw 132f5ce64b9SPoul-Henning Kamp echo "=== Install reference world" 13322aec2a3SPoul-Henning Kamp mkdir -p ${RDIR}/Ref 13422aec2a3SPoul-Henning Kamp iw 135f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* ${RDIR}/Ref 136f5ce64b9SPoul-Henning Kampfi 137f5ce64b9SPoul-Henning Kamp 138f5ce64b9SPoul-Henning Kamp# Parse option list into subdirectories with src.conf files. 139f5ce64b9SPoul-Henning Kamp 140f5ce64b9SPoul-Henning Kampif true ; then 141f5ce64b9SPoul-Henning Kamp rm -rf ${RDIR}/[0-9a-f]* 142f5ce64b9SPoul-Henning Kamp for o in $OPLIST 143f5ce64b9SPoul-Henning Kamp do 144f5ce64b9SPoul-Henning Kamp echo "${o}=foo" > ${FDIR}/_src.conf 145f5ce64b9SPoul-Henning Kamp m=`md5 < ${FDIR}/_src.conf` 146f5ce64b9SPoul-Henning Kamp mkdir -p ${RDIR}/$m 147f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_src.conf ${RDIR}/$m/src.conf 148f5ce64b9SPoul-Henning Kamp done 14922aec2a3SPoul-Henning Kampfi 15022aec2a3SPoul-Henning Kamp 15122aec2a3SPoul-Henning Kamp# Run through each testtarget in turn 15222aec2a3SPoul-Henning Kamp 15368d71fe7SPoul-Henning Kampif true ; then 15422aec2a3SPoul-Henning Kamp for d in ${RDIR}/[0-9a-z]* 15568d71fe7SPoul-Henning Kamp do 15622aec2a3SPoul-Henning Kamp if [ ! -d $d ] ; then 15722aec2a3SPoul-Henning Kamp continue; 15868d71fe7SPoul-Henning Kamp fi 15922aec2a3SPoul-Henning Kamp echo '------------------------------------------------' 160f5ce64b9SPoul-Henning Kamp cat $d/src.conf 16122aec2a3SPoul-Henning Kamp echo '------------------------------------------------' 162f5ce64b9SPoul-Henning Kamp cp $d/src.conf ${ODIR}/src.conf 16322aec2a3SPoul-Henning Kamp 16422aec2a3SPoul-Henning Kamp if [ ! -f $d/iw/done ] ; then 16522aec2a3SPoul-Henning Kamp MAKEOBJDIRPREFIX=$ODIR/_.ref 16622aec2a3SPoul-Henning Kamp export MAKEOBJDIRPREFIX 167f5ce64b9SPoul-Henning Kamp echo "# BW(ref)+IW(ref) `cat $d/src.conf`" 168f5ce64b9SPoul-Henning Kamp rm -rf $d/iw 169f5ce64b9SPoul-Henning Kamp mkdir -p $d/iw 170f5ce64b9SPoul-Henning Kamp iw || true 171f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/iw || true 17222aec2a3SPoul-Henning Kamp touch $d/iw/done 17322aec2a3SPoul-Henning Kamp fi 17422aec2a3SPoul-Henning Kamp if [ ! -f $d/bw/done ] ; then 17522aec2a3SPoul-Henning Kamp MAKEOBJDIRPREFIX=$ODIR/_.tst 17622aec2a3SPoul-Henning Kamp export MAKEOBJDIRPREFIX 177f5ce64b9SPoul-Henning Kamp echo "# BW(opt) `cat $d/src.conf`" 178f5ce64b9SPoul-Henning Kamp rm -rf $d/w $d/bw 179f5ce64b9SPoul-Henning Kamp mkdir -p $d/w $d/bw 18022aec2a3SPoul-Henning Kamp if bw ; then 181f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/bw || true 182f5ce64b9SPoul-Henning Kamp 183f5ce64b9SPoul-Henning Kamp echo "# BW(opt)+IW(opt) `cat $d/src.conf`" 184f5ce64b9SPoul-Henning Kamp iw || true 185f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/w || true 18622aec2a3SPoul-Henning Kamp touch $d/w/done 187f5ce64b9SPoul-Henning Kamp 188f5ce64b9SPoul-Henning Kamp echo "# BW(opt)+IW(ref) `cat $d/src.conf`" 189f5ce64b9SPoul-Henning Kamp echo '' > ${ODIR}/src.conf 190f5ce64b9SPoul-Henning Kamp iw || true 191f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/bw || true 19222aec2a3SPoul-Henning Kamp touch $d/bw/done 19322aec2a3SPoul-Henning Kamp else 194f5ce64b9SPoul-Henning Kamp mv ${FDIR}/_.* $d/bw || true 195f5ce64b9SPoul-Henning Kamp touch $d/bw/done $d/w/done 19622aec2a3SPoul-Henning Kamp fi 19722aec2a3SPoul-Henning Kamp fi 19868d71fe7SPoul-Henning Kamp done 19968d71fe7SPoul-Henning Kampfi 200