2008-09-17 21:41:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2008-09-29 13:27:43 +00:00
|
|
|
if [ $# -lt 1 -o $# -gt 2 ]; then
|
|
|
|
echo "Usage: $0 <test> [logfile]"
|
2008-09-17 21:41:30 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
TEST=$1
|
2008-09-29 13:27:43 +00:00
|
|
|
LOGFILE=0
|
|
|
|
if [ $# -eq 2 ]; then
|
|
|
|
LOGFILE=1
|
|
|
|
LOG=$2
|
|
|
|
fi
|
2008-09-17 21:41:30 +00:00
|
|
|
|
|
|
|
echo ">>>>>>> Starting test: $TEST <<<<<<<<"
|
2008-09-29 13:27:43 +00:00
|
|
|
if [ $LOGFILE -eq 1 ]; then echo -n "[`date '+%F %T'`] $TEST: " >> $LOG; fi
|
2009-02-07 17:24:15 +00:00
|
|
|
java -mx512m -jar ../dist/cooja.jar -nogui -test=$TEST
|
2008-09-17 21:41:30 +00:00
|
|
|
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-29 13:27:43 +00:00
|
|
|
if [ $LOGFILE -eq 1 ]; then
|
|
|
|
if [ $OK == 0 ]; then
|
|
|
|
echo "FAIL" >> $LOG
|
|
|
|
if [ -f "$TEST.info" ]; then
|
2008-12-03 16:25:17 +00:00
|
|
|
echo "-- TEST INFO ($TEST.info) --" >> $LOG
|
2008-09-29 13:27:43 +00:00
|
|
|
cat $TEST.info >> $LOG
|
|
|
|
else
|
2008-12-03 16:25:17 +00:00
|
|
|
echo "-- NO TEST INFO AVAILABLE ($TEST.info) --" >> $LOG
|
2008-09-29 13:27:43 +00:00
|
|
|
fi
|
2008-12-03 16:25:17 +00:00
|
|
|
if [ -f "$TEST.log" ]; then
|
|
|
|
echo "-- TEST OUTPUT (tail $TEST.log) --" >> $LOG
|
|
|
|
tail -5 $TEST.log >> $LOG
|
|
|
|
else
|
|
|
|
echo "-- NO TEST OUTPUT AVAILABLE ($TEST.log) --" >> $LOG
|
|
|
|
fi
|
|
|
|
echo "-- COOJA OUTPUT (tail $TEST.cooja_log) --" >> $LOG
|
2008-09-29 13:27:43 +00:00
|
|
|
tail -5 $TEST.cooja_log >> $LOG
|
2008-09-17 21:41:30 +00:00
|
|
|
else
|
2008-09-29 13:27:43 +00:00
|
|
|
echo "OK" >> $LOG
|
2008-09-17 21:41:30 +00:00
|
|
|
fi
|
2008-09-26 14:34:49 +00:00
|
|
|
echo >> $LOG
|
2008-09-17 21:41:30 +00:00
|
|
|
fi
|
2008-09-18 10:22:25 +00:00
|
|
|
|
2008-09-29 13:27:43 +00:00
|
|
|
if [ $OK == 0 ]; then
|
|
|
|
echo ">>>>>>> Finished test: $TEST FAILED <<<<<<<<"
|
|
|
|
else
|
|
|
|
echo ">>>>>>> Finished test: $TEST OK <<<<<<<<"
|
|
|
|
fi
|