gcc/libjava/classpath/scripts/kissme-mauve
Tom Tromey f911ba985a Initial revision
From-SVN: r102074
2005-07-16 00:30:23 +00:00

347 lines
7.5 KiB
Bash
Executable File

#!/bin/sh
CLASSPATH_CVS=~/mauve/classpath
CLASSPATH_PREFIX=~/mauve/root/classpath
MAUVE_CVS=~/mauve/mauve
KISSME_CVS=~/mauve/kissme
KISSME_PREFIX=~/mauve/root/kissme
KISSME_BIN=~/mauve/kissme/useful_scripts/kissme
LOG=/tmp/mauve.log
RESULTS=/tmp/kissme-mauve.txt
REPORT=/tmp/kissme-mauve-report.txt
TIMEOUT=30
rm -f ${LOG} > /dev/null 2>&1
rm -f ${RESULTS} > /dev/null 2>&1
today=`date`
echo "${today}" > ${LOG}
touch ${RESULTS}
_aclocal ()
{
aclocal "$@" >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error running aclocal"
exit 1
fi
}
_autoheader ()
{
autoheader "$@" >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error running autoheader"
exit 1
fi
}
_automake ()
{
automake "$@" >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error running automake"
exit 1
fi
}
_autoconf ()
{
autoconf "$@" >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error running autoconf"
exit 1
fi
}
classpath_checkout ()
{
if [ ! -d "${CLASSPATH_CVS}" ]; then
mkdir --parents ${CLASSPATH_CVS}
local dir=`dirname "${CLASSPATH_CVS}"`
cd "${dir}"
cvs -z3 -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/classpath co classpath >> ${LOG} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error checking out classpath"
exit 1
fi
fi
}
classpath_update ()
{
cd "${CLASSPATH_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error checking out classpath"
exit 1
fi
}
classpath_clean ()
{
if [ -d "${CLASSPATH_CVS}/build" ]; then
rm -rf "${CLASSPATH_CVS}/build"
fi
if [ -d "${CLASSPATH_PREFIX}" ]; then
rm -rf "${CLASSPATH_PREFIX}"
fi
mkdir --parents "${CLASSPATH_CVS}/build"
mkdir --parents "${CLASSPATH_PREFIX}"
}
classpath_configure ()
{
cd "${CLASSPATH_CVS}"
_aclocal
_autoheader
_automake
_autoconf
cd "${CLASSPATH_CVS}/build" && ../configure --prefix=${CLASSPATH_PREFIX} --with-gcj --enable-jni >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error configuring"
exit 1
fi
}
classpath_build ()
{
cd "${CLASSPATH_CVS}/build" && make >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error during make"
exit 1
fi
}
classpath_install ()
{
cd "${CLASSPATH_CVS}/build" && make install >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error during make"
exit 1
fi
}
kissme_checkout ()
{
if [ ! -d "${KISSME_CVS}" ]; then
mkdir --parents ${KISSME_CVS}
local dir=`dirname "${KISSME_CVS}"`
cd "${KISSME_CVS}"
cvs -z3 -d :pserver:anonymous@cvs.kissme.sourceforge.net:/cvsroot/kissme co . >> ${LOG} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error checking out kissme"
exit 1
fi
fi
}
kissme_update ()
{
cd "${KISSME_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error checking out kissme"
exit 1
fi
}
kissme_clean ()
{
if [ -d "${KISSME_CVS}/build" ]; then
rm -rf "${KISSME_CVS}/build"
fi
if [ -d "${KISSME_PREFIX}" ]; then
rm -rf "${KISSME_PREFIX}"
fi
mkdir --parents "${KISSME_CVS}/build"
mkdir --parents "${KISSME_PREFIX}"
}
kissme_configure ()
{
cd "${KISSME_CVS}"
_aclocal
_autoheader
_automake -a
_autoconf
cd "${KISSME_CVS}" && ./configure --prefix=${KISSME_PREFIX} \
--enable-use-zips --with-gnu-classpath=${CLASSPATH_CVS} \
--with-gnu-classpath-build=${CLASSPATH_CVS}/build \
--with-classpath-install-dir=${CLASSPATH_PREFIX} >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error configuring"
exit 1
fi
}
kissme_build ()
{
cd "${KISSME_CVS}" && make >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error during make"
exit 1
fi
}
kissme_install ()
{
cd "${KISSME_CVS}" && make install >> ${LOG} 2>&1
if [ $? -ne 0 ]; then
echo "Error during make"
exit 1
fi
}
mauve_checkout ()
{
if [ ! -d "${MAUVE_CVS}" ]; then
mkdir --parents ${MAUVE_CVS}
local dir=`dirname "${MAUVE_CVS}"`
cd "${dir}"
cvs -z3 -d :pserver:anoncvs@sources.redhat.com:/cvs/mauve co mauve >> ${LOG} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error checking out mauve"
exit 1
fi
fi
}
mauve_update ()
{
cd "${MAUVE_CVS}" && cvs update -d -P . >> ${LOG} 2>/dev/null
if [ $? -ne 0 ]; then
echo "Error checking out mauve"
exit 1
fi
}
kissme_mauve ()
{
export JAVAC="jikes -bootclasspath ${CLASSPATH_PREFIX}/share/classpath/glibj.zip"
export JAVA="${KISSME_BIN}"
# if [ -f "${KISSME_CVS}/useful_scripts/mauve-kissme" ]; then
# cp -f "${KISSME_CVS}/useful_scripts/mauve-kissme" "${MAUVE_CVS}"
# fi
if [ -f "${CLASSPATH_CVS}/mauve-classpath" ]; then
cp -f "${CLASSPATH_CVS}/mauve-classpath" "${MAUVE_CVS}"
fi
cd "${MAUVE_CVS}"
if [ $? -ne 0 ]; then
echo "Error configuring mauve"
exit 1
fi
_aclocal
_automake
_autoconf
./configure >> "${LOG}" 2>&1
if [ $? -ne 0 ]; then
echo "Error configuring mauve"
exit 1
fi
# create class choices from key file
if [ -f classes ]; then
rm -f classes 2>/dev/null
fi
if [ -f choices ]; then
rm -f choices 2>/dev/null
fi
/bin/sh choose "${MAUVE_CVS}" classpath
if [ $? -ne 0 ]; then
echo "Error during choose for mauve"
exit 1
fi
# compile classes
compile=`cat "${MAUVE_CVS}/classes" | tr '.' '/' | awk '{print $1".java"}' | xargs`
${JAVAC} -classpath "${MAUVE_CVS}" -d "${MAUVE_CVS}" ${compile} >> "${LOG}" 2>&1
if [ $? -ne 0 ]; then
echo "Error during compile for mauve"
exit 1
fi
set -m
for i in `cat "${MAUVE_CVS}/classes"`; do
echo "$i" | ${JAVA} gnu.testlet.SimpleTestHarness -verbose >> "${RESULTS}" 2>&1 &
vm_pid=$!
sleep ${TIMEOUT} && kill -9 $vm_pid > /dev/null 2>&1 && echo "FAIL: $i execution aborted" >> "${RESULTS}" &
kill_pid=$!
fg %- 2>/dev/null
kill -9 $kill_pid >/dev/null 2>&1 # && echo Test did not time out
done
}
mauve_summary ()
{
if [ ! -f "${RESULTS}" ]; then
echo "Error creating summary"
exit 1
fi
pass_cnt=`grep PASS "${RESULTS}" | wc -l`
fail_cnt=`grep FAIL "${RESULTS}" | wc -l`
total_cnt=`expr $pass_cnt + $fail_cnt`
today=`date`
echo "Mauve test results for Kissme" > "${REPORT}"
echo "Report generated on ${today}" >> "${REPORT}"
echo "" >> "${REPORT}"
echo "${fail_cnt} of ${total_cnt} tests failed." >> "${REPORT}"
echo "" >> "${REPORT}"
cat "${RESULTS}" >> "${REPORT}"
}
#--------------------------------------------------------------------
# Update Classpath CVS
#--------------------------------------------------------------------
classpath_checkout
classpath_update
#--------------------------------------------------------------------
# Build Classpath with GCJ 3.2
#--------------------------------------------------------------------
classpath_clean
classpath_configure
classpath_build
classpath_install
#--------------------------------------------------------------------
# Update Kissme CVS
#--------------------------------------------------------------------
kissme_checkout
kissme_update
#--------------------------------------------------------------------
# Build Kissme
#--------------------------------------------------------------------
kissme_clean
kissme_configure
kissme_build
#kissme_install
#--------------------------------------------------------------------
# Update Mauve CVS
#--------------------------------------------------------------------
mauve_checkout
mauve_update
#--------------------------------------------------------------------
# Execute Mauve
#--------------------------------------------------------------------
kissme_mauve
#--------------------------------------------------------------------
# Create report
#--------------------------------------------------------------------
mauve_summary