changed to run standalone (use arguments -cvs and -mail to update and mail test report)
This commit is contained in:
parent
24d34b837d
commit
03beb76ade
2 changed files with 71 additions and 34 deletions
|
@ -1,19 +1,59 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$CONTIKI" ]; then
|
||||
echo Undefined variable: CONTIKI
|
||||
exit
|
||||
#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
|
||||
echo Undefined variable: CONTIKI
|
||||
exit 1
|
||||
fi
|
||||
CONTIKI=$CONTIKI_HOME
|
||||
fi
|
||||
|
||||
if [ -z "$MAILTO" ]; then
|
||||
echo Undefined variable: MAILTO
|
||||
exit
|
||||
if [ $MAIL -eq 1 ]; then
|
||||
if [ -z "$MAILTO" ]; then
|
||||
echo Undefined variable: MAILTO
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
function mail_report {
|
||||
echo ">>>>>>> Sending mail <<<<<<<<"
|
||||
cp $LOG ~/lastlog.log
|
||||
cat $LOG | mail -s "Contiki test results" $MAILTO
|
||||
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
|
||||
}
|
||||
|
||||
echo ">>>>>>> Cleaning up previous tests <<<<<<<<"
|
||||
|
@ -22,39 +62,36 @@ rm -fr se obj_cooja
|
|||
rm -f symbols.c symbols.h
|
||||
|
||||
echo ">>>>>>> Creating test log <<<<<<<<"
|
||||
#LOG="TEST-`date '+%F'`.log"
|
||||
LOG=currentlog.log
|
||||
touch $LOG
|
||||
echo "Starting test run `date '+%F %T'`"
|
||||
echo "Test run started at `date '+%F %T'`" >> $LOG
|
||||
echo "" >> $LOG
|
||||
|
||||
echo ">>>>>>> Updating from CVS <<<<<<<<"
|
||||
echo -n "Updating CVS: " >> $LOG
|
||||
(cd $CONTIKI && cvs update -dP)
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "FAIL" >> $LOG
|
||||
mail_report
|
||||
exit
|
||||
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
|
||||
echo "OK" >> $LOG
|
||||
|
||||
echo ">>>>>>> Building COOJA <<<<<<<<"
|
||||
echo -n "Building COOJA: " >> $LOG
|
||||
echo -n "[`date '+%F %T'`] Building COOJA: " >> $LOG
|
||||
(cd $CONTIKI/tools/cooja && ant clean && ant jar)
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Compilation of COOJA failed"
|
||||
echo "FAIL" >> $LOG
|
||||
mail_report
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
echo "OK" >> $LOG
|
||||
|
||||
echo "" >> $LOG
|
||||
echo >> $LOG
|
||||
for myfile in ./*.csc
|
||||
do
|
||||
TEST=`basename $myfile .csc`
|
||||
./RUN_TEST $TEST $LOG
|
||||
echo "" >> $LOG
|
||||
done
|
||||
|
||||
mail_report
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
echo Usage: $0 [test] [logfile]
|
||||
if [ -z "$2" ]; then
|
||||
echo "Usage: $0 <test> <logfile>"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -9,6 +9,7 @@ TEST=$1
|
|||
LOG=$2
|
||||
|
||||
echo ">>>>>>> Starting test: $TEST <<<<<<<<"
|
||||
echo -n "[`date '+%F %T'`] $TEST: " >> $LOG
|
||||
java -jar ../dist/cooja.jar -nogui -test=$TEST
|
||||
if [ -f "COOJA.log" ]; then
|
||||
mv COOJA.log $TEST.cooja_log
|
||||
|
@ -20,11 +21,10 @@ if [ -f "$TEST.log" ]; then
|
|||
fi
|
||||
|
||||
if [ $OK == 0 ]; then
|
||||
echo "$TEST: FAIL" >> $LOG
|
||||
echo "FAIL" >> $LOG
|
||||
if [ -f "$TEST.info" ]; then
|
||||
echo "--LOG INFO START ($TEST.info) --" >> $LOG
|
||||
cat $TEST.info >> $LOG
|
||||
echo "" >> $LOG
|
||||
echo "--LOG INFO END --" >> $LOG
|
||||
else
|
||||
echo "-- NO LOG INFO AVAILABLE ($TEST.info) --" >> $LOG
|
||||
|
@ -32,9 +32,9 @@ if [ $OK == 0 ]; then
|
|||
echo "-- OUTPUT TAIL START ($TEST.cooja_log) --" >> $LOG
|
||||
tail -5 $TEST.cooja_log >> $LOG
|
||||
echo "-- OUTPUT TAIL END --" >> $LOG
|
||||
|
||||
echo >> $LOG
|
||||
else
|
||||
echo "$TEST: OK" >> $LOG
|
||||
echo "OK" >> $LOG
|
||||
fi
|
||||
|
||||
echo "" >> $LOG
|
||||
echo >> $LOG
|
||||
|
|
Loading…
Reference in a new issue