blob: 5d4bf917bd9747279c98da4cf428a8891f8a78b9 (
plain) (
tree)
|
|
#! /bin/sh
#
# Test Driver
#
# test_driver CPUs|all
#
vfile=`dirname $0`/../VERSIONS
if [ ! -r ${vfile} ] ; then
echo VERSIONS file not found
exit 1
fi
source ${vfile}
if [ ! -d ${BASEDIR} ] ; then
echo Have you set the BASEDIR in VERSIONS correctly?
exit 1
fi
BASEDIR=`pwd`
for d in ${AUTOCONF} ${AUTOMAKE} ${BINUTILSDIR} \
${GDBDIR} ${NEWLIBDIR} ${GCCDIR}
do
if [ ! -d ${d} ] ; then
echo "Cannot locate ${d} -- aborting"
exit 1
fi
done
toggle()
{
case $1 in
no) echo "yes" ;;
yes) echo "no" ;;
*) fatal "Unknown value to toggle ($1)" ;;
esac
}
usage()
{
cat <<EOF
test_driver [options] CPU .. CPU
-A - enable clean, native, and update
-1 - build basic tools (default=yes)
-a - build Ada (default=yes)
-G - build GCC Go (default=yes)
-J - build GCJ (default=yes)
-c - clean install point (also installs auto tools)
-m - mail results to lists (default=yes)
-n - build native
-T - run tests (default=yes)
-u - update GNU source if version from CVS/SVN
-U - update RTEMS source if version from CVS/SVN (will bootstrap)
-v - verbose
EOF
}
doCleanInstallPoint="no"
doUpdateTools="no"
doUpdateRTEMS="no"
doNative="no"
doBasicTools="yes"
verbose="yes"
doAda="yes"
doGccGo="yes"
doGcj="yes"
doMail="yes"
doObjC="yes"
doFORTRAN="yes"
doTests="yes"
justTests="no"
checkOptionsAndExit="no"
while getopts J1AacmnuCGTUfOv OPT
do
case "$OPT" in
A) doCleanInstallPoint=`toggle ${doCleanInstallPoint}`
doNative=`toggle ${doNative}`
doUpdateTools=`toggle ${doUpdateTools}`
doUpdateRTEMS=`toggle ${doUpdateRTEMS}`
;;
1) doBasicTools=`toggle ${doBasicTools}` ;;
a) doAda=`toggle ${doAda}` ;;
C) checkOptionsAndExit=`toggle ${checkOptionsAndExit}` ;;
G) doGccGo=`toggle ${doGccGo}` ;;
J) doGcj=`toggle ${doGcj}` ;;
f) doFORTRAN=`toggle ${doFORTRAN}` ;;
O) doObjC=`toggle ${doObjC}` ;;
c) doCleanInstallPoint=`toggle ${doCleanInstallPoint}` ;;
j) justTests=`toggle ${justTests}` ;;
m) doMail=`toggle ${doMail}` ;;
n) doNative=`toggle ${doNative}` ;;
T) doTests=`toggle ${doTests}` ;;
u) doUpdateTools=`toggle ${doUpdateTools}` ;;
U) doUpdateRTEMS=`toggle ${doUpdateRTEMS}` ;;
v) verbose=`toggle ${verbose}` ;;
*) usage; exit 1;
esac
done
shiftcount=`expr $OPTIND - 1`
shift $shiftcount
args=$*
CPUs=""
for cpu in ${args}
do
if [ ${cpu} = "native" ] ; then
doNative="yes"
else
CPUs="${CPUs} ${cpu}"
fi
done
CPUS_PART1="avr arm h8300 i386 m32c mips sh sparc64"
CPUS_PART2="bfin lm32 m32r m68k powerpc sparc"
ALL_CPUs="${CPUS_PART1} ${CPUS_PART2}"
if [ "X${CPUs}" = "Xall" -o "X${CPUs}" = "X all" ] ; then
CPUs="${ALL_CPUs}"
elif [ "X${CPUs}" = "X part1" ] ; then
CPUs="${CPUS_PART1}"
elif [ "X${CPUs}" = "X part2" ] ; then
CPUs="${CPUS_PART2}"
elif [ "X${CPUs}" = "X" -a ${doNative} = "no" ] ; then
echo "No CPUs specified to test"
exit 1
fi
if [ ${verbose} = "yes" ] ; then
echo "Clean Install Point: " ${doCleanInstallPoint}
echo "Install Autotools: " ${doCleanInstallPoint}
echo "Install Native: " ${doNative}
echo "Update Tool Source: " ${doUpdateTools}
echo "Update RTEMS: " ${doUpdateRTEMS}
echo "Build Basic Tools: " ${doBasicTools}
echo "Build Ada: " ${doAda}
echo "Build GCC Go: " ${doGccGo}
echo "Build GCJ: " ${doGcj}
echo "Build Objective-C " ${doObjC}
echo "Build FORTRAN " ${doFORTRAN}
echo "Email Results: " ${doMail}
echo "Run Tests: " ${doTests}
echo "CPUs to Build: " ${CPUs}
fi
test ${checkOptionsAndExit} = "yes" && exit 0
test ${doMail} = "no" && mailArg="-M"
test ${doTests} = "yes" && testArg="-T"
test ${doAda} = "yes" && adaArg="-a"
test ${doGccGo} = "yes" && gccgoArg="-G"
test ${doGcj} = "yes" && gcjArg="-J"
test ${doObjC} = "yes" && objcArg="-O"
test ${doFORTRAN} = "yes" && fortrancArg="-f"
test ${doBasicTools} = "yes" && basicArgs="-b -D -1 -r"
echo "Checking for just tests override"
if [ ${justTests} = "yes" ] ; then
adaArg=""
gccgoArg=""
gcjArg=""
objcArg=""
fortranArg=""
basicArgs=""
fi
start=`date`
echo Started at: ${start}
# HELPER - Update RTEMS
update_rtems()
{
cd ${RTEMSDIR}
if [ -d CVS ] ; then
cvs up -Pd 2>&1 | grep -v ^cvs
./bootstrap -c
./bootstrap
fi
}
# HELPER - Update GCC
update_gcc()
{
cd ${GCCDIR}
if [ -d .svn ] ; then
grep "svn+ssh" .svn/entries >/dev/null
if [ $? -eq 0 ] ; then
echo "Skipping gcc update -- ssh keyed check out"
else
echo "Updating gcc -- anonymous check out"
./contrib/gcc_update
if [ $? -ne 0 ] ; then
echo "Update of GCC Failed."
exit 1
fi
fi
fi
return 0
}
# HELPER - Remove all the installed previous builds
clean_up()
{
rm -rf ${INSTALL}/* ${BSP_INSTALL}/*
}
install_auto()
{
for auto in ${AUTOCONF} ${AUTOMAKE}
do
cd ${auto}
make distclean
./configure --prefix=${INSTALL}
make all install
done
}
install_ppl()
{
if [ x${PPL} != x ] ; then
if [ ! -r ${INSTALL}/lib/libppl.a ] ; then
echo "*** Building PPL ***"
cd ${PPL}
make distclean
./configure --enable-watchdog --prefix=${INSTALL}
make ${MAKEJOBS} all install
fi
fi
}
# This handles GNU tools from CVS
update_others()
{
for d in ${BINUTILSDIR} ${GDBDIR} ${NEWLIBDIR}
do
cd ${d}
if [ -d .svn ] ; then
echo "I do not update SVN for ${d}"
exit 1
fi
if [ -d CVS ] ; then
cvs up -P 2>&1 | grep -v ^cvs
fi
done
}
build_cpu()
{
bsp=
exitStatus=0
for cpu in $*
do
case $cpu in
arm) bsp=edb7312 ;;
avr) bsp=avrtest ;;
bfin) bsp=eZKit533 ;;
h8300) bsp=h8sim ;;
i386) bsp=pc386 ;;
lm32) bsp=lm32_evr ;;
m32c) bsp=m32csim ;;
m32r) bsp=m32rsim ;;
m68k) bsp=uC5282 ;;
mips) bsp=jmr3904 ;;
powerpc) bsp=psim ;;
sh) bsp=simsh1 ;;
sparc) bsp=sis ;;
sparc64) bsp=niagara ;;
*)
echo "Unknown CPU ${cpu}"
exit 1
;;
esac
doOne=${SCRIPTDIR}/gcc/do_one
echo "Building ${cpu}/${bsp}..."
echo "time sh -x ${doOne} -v -d ${basicArgs} \
${gccgoArg} ${gcjArg} ${adaArg} ${objcArg} ${fortranArg} \
${mailArg} ${testArg} \ ${cpu} ${bsp} >${BASEDIR}/${bsp}.log 2>&1"
time sh -x ${doOne} -v -d ${basicArgs} \
${gccgoArg} ${gcjArg} ${adaArg} ${objcArg} ${fortranArg} \
${mailArg} ${testArg} \ ${cpu} ${bsp} >${BASEDIR}/${bsp}.log 2>&1
echo $?
done
stopped=`date`
echo Started at: ${start}
echo Stopped at: ${stopped}
}
if [ ${doCleanInstallPoint} = "yes" ] ; then
# Clean the install point
clean_up
fi
# Update gcc and install autotools in parallel
if [ ! -r ${INSTALL}/bin/autoconf ] ; then
install_auto
fi
if [ ${doUpdateTools} = "yes" ] ; then
update_gcc
update_others
fi
if [ ! -r ${INSTALL}/lib/libppl.a ] ; then
install_ppl
fi
wait
# Do any remaining prep work in parallel
if [ ${doUpdateRTEMS} = "yes" ] ; then
update_rtems
fi
wait
do_cpus=yes
if [ ${doNative} = "yes" ]; then
# Build the native compiler as a baseline to build the others
time sh -x ${SCRIPTDIR}/gcc/do_one -n >${BASEDIR}/native.log 2>&1
if [ $? -ne 0 ] ; then
do_cpus=no
fi
fi
# Now cycle over all these CPUs
if [ ${do_cpus} = yes ] ; then
for cpu in ${CPUs}
do
build_cpu ${cpu}
done
fi
stopped=`date`
echo Started at: ${start}
echo Stopped at: ${stopped}
|