osd-contiki/tools/cooja/contiki_tests/RUN_TEST

40 lines
825 B
Bash

#!/bin/bash
if [ -z "$2" ]; then
echo "Usage: $0 <test> <logfile>"
exit
fi
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
fi
OK=0
if [ -f "$TEST.log" ]; then
OK=`grep "TEST OK" $TEST.log | wc -l`
fi
if [ $OK == 0 ]; then
echo "FAIL" >> $LOG
if [ -f "$TEST.info" ]; then
echo "--LOG INFO START ($TEST.info) --" >> $LOG
cat $TEST.info >> $LOG
echo "--LOG INFO END --" >> $LOG
else
echo "-- NO LOG INFO AVAILABLE ($TEST.info) --" >> $LOG
fi
echo "-- OUTPUT TAIL START ($TEST.cooja_log) --" >> $LOG
tail -5 $TEST.cooja_log >> $LOG
echo "-- OUTPUT TAIL END --" >> $LOG
echo >> $LOG
else
echo "OK" >> $LOG
fi
echo >> $LOG