2008-09-17 21:41:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2008-09-26 14:34:49 +00:00
|
|
|
if [ -z "$2" ]; then
|
|
|
|
echo "Usage: $0 <test> <logfile>"
|
2008-09-17 21:41:30 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
TEST=$1
|
|
|
|
LOG=$2
|
|
|
|
|
|
|
|
echo ">>>>>>> Starting test: $TEST <<<<<<<<"
|
2008-09-26 14:34:49 +00:00
|
|
|
echo -n "[`date '+%F %T'`] $TEST: " >> $LOG
|
2008-09-17 21:41:30 +00:00
|
|
|
java -jar ../dist/cooja.jar -nogui -test=$TEST
|
|
|
|
if [ -f "COOJA.log" ]; then
|
|
|
|
mv COOJA.log $TEST.cooja_log
|
|
|
|
fi
|
|
|
|
|
2008-09-18 15:10:11 +00:00
|
|
|
OK=0
|
2008-09-17 21:41:30 +00:00
|
|
|
if [ -f "$TEST.log" ]; then
|
|
|
|
OK=`grep "TEST OK" $TEST.log | wc -l`
|
2008-09-18 15:10:11 +00:00
|
|
|
fi
|
2008-09-17 21:41:30 +00:00
|
|
|
|
2008-09-18 15:10:11 +00:00
|
|
|
if [ $OK == 0 ]; then
|
2008-09-26 14:34:49 +00:00
|
|
|
echo "FAIL" >> $LOG
|
2008-09-17 21:41:30 +00:00
|
|
|
if [ -f "$TEST.info" ]; then
|
|
|
|
echo "--LOG INFO START ($TEST.info) --" >> $LOG
|
|
|
|
cat $TEST.info >> $LOG
|
2008-09-18 15:10:11 +00:00
|
|
|
echo "--LOG INFO END --" >> $LOG
|
2008-09-17 21:41:30 +00:00
|
|
|
else
|
2008-09-18 15:10:11 +00:00
|
|
|
echo "-- NO LOG INFO AVAILABLE ($TEST.info) --" >> $LOG
|
2008-09-17 21:41:30 +00:00
|
|
|
fi
|
2008-09-18 15:10:11 +00:00
|
|
|
echo "-- OUTPUT TAIL START ($TEST.cooja_log) --" >> $LOG
|
|
|
|
tail -5 $TEST.cooja_log >> $LOG
|
|
|
|
echo "-- OUTPUT TAIL END --" >> $LOG
|
2008-09-26 14:34:49 +00:00
|
|
|
echo >> $LOG
|
2008-09-18 15:10:11 +00:00
|
|
|
else
|
2008-09-26 14:34:49 +00:00
|
|
|
echo "OK" >> $LOG
|
2008-09-17 21:41:30 +00:00
|
|
|
fi
|
2008-09-18 10:22:25 +00:00
|
|
|
|
2008-09-26 14:34:49 +00:00
|
|
|
echo >> $LOG
|