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