osd-contiki/tools/cooja/contiki_tests/RUN_ALL

97 lines
1.9 KiB
Plaintext
Raw Normal View History

2008-04-23 17:19:13 +02:00
#!/bin/bash
2008-04-22 16:29:05 +02:00
#LOG="TEST-`date '+%F'`.log"
LOG=currentlog.log
MAIL=0
CVS=0
PROGNAME=`basename $0`
Usage() {
echo >&2 "$PROGNAME:" "$@"
echo >&2 "Usage: $PROGNAME [-cvs] [-mail]"
exit 10
}
while [ $# -gt 0 ]; do
case "$1" in
-cvs) CVS=1 ;;
-mail) MAIL=1 ;;
*) Usage "Unknown option \"$1\"" ;;
esac
shift
done
if [ -z "$CONTIKI" ]; then
if [ -z "$CONTIKI_HOME" ]; then
CONTIKI_HOME=../../..
2009-05-26 16:36:26 +02:00
echo Undefined variable: CONTIKI. Using default: ${CONTIKI}
fi
CONTIKI=$CONTIKI_HOME
fi
if [ $MAIL -eq 1 ]; then
if [ -z "$MAILTO" ]; then
echo Undefined variable: MAILTO
exit 1
fi
fi
function mail_report() {
if [ $MAIL -eq 1 ]; then
echo ">>>>>>> Sending mail <<<<<<<<"
echo "[`date '+%F %T'`] Mailing test report" >> $LOG
cat $LOG | mail -s "Contiki test results" $MAILTO
if [ "$?" -ne 0 ]; then
echo "Failed to send mail"
echo "[`date '+%F %T'`] MAIL FAILED" >> $LOG
else
echo "[`date '+%F %T'`] test report sent" >> $LOG
fi
else
echo
echo
echo ">>>>>>> Test Report <<<<<<<<"
cat $LOG
fi
cp $LOG RUN_ALL_LAST.log
}
2008-04-29 06:43:27 +02:00
echo ">>>>>>> Cleaning up previous tests <<<<<<<<"
rm -f *.log *.cooja_log
rm -fr se obj_cooja
rm -f symbols.c symbols.h
2008-04-24 08:17:26 +02:00
2008-04-29 06:43:27 +02:00
echo ">>>>>>> Creating test log <<<<<<<<"
2008-04-23 17:19:13 +02:00
touch $LOG
2008-09-18 09:25:27 +02:00
if [ $CVS -eq 1 ]; then
echo ">>>>>>> Updating from CVS <<<<<<<<"
echo -n "[`date '+%F %T'`] Updating CVS: " >> $LOG
(cd $CONTIKI && cvs update -dP)
if [ "$?" != "0" ]; then
echo "FAIL" >> $LOG
mail_report
exit 1
fi
echo "OK" >> $LOG
fi
2008-09-18 09:25:27 +02:00
echo ">>>>>>> Building COOJA <<<<<<<<"
echo -n "[`date '+%F %T'`] Building COOJA: " >> $LOG
2008-09-18 09:25:27 +02:00
(cd $CONTIKI/tools/cooja && ant clean && ant jar)
if [ "$?" != "0" ]; then
echo "Compilation of COOJA failed"
echo "FAIL" >> $LOG
mail_report
exit 1
fi
echo "OK" >> $LOG
2008-04-24 08:17:26 +02:00
echo >> $LOG
2008-04-22 16:29:05 +02:00
for myfile in ./*.csc
do
TEST=`basename $myfile .csc`
bash RUN_TEST $TEST $LOG
2008-04-23 17:19:13 +02:00
done
2008-04-29 06:43:27 +02:00
mail_report