nes-proj/tools/cooja/contiki_tests/RUN_TEST

64 lines
1.3 KiB
Plaintext
Raw Normal View History

2008-09-17 21:41:30 +00:00
#!/bin/bash
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "Usage: $0 <test> [logfile]"
2008-09-17 21:41:30 +00:00
exit
fi
2009-06-24 14:41:47 +00:00
2008-09-17 21:41:30 +00:00
TEST=$1
2009-06-24 14:41:47 +00:00
LOG=/dev/null
if [ $# -eq 2 ]; then
2008-09-29 13:27:43 +00:00
LOG=$2
fi
2008-09-17 21:41:30 +00:00
echo ">>>>>>> Starting test: $TEST <<<<<<<<"
echo -n "[`date '+%F %T'`] $TEST: " >> $LOG
2009-06-09 09:49:14 +00:00
if [ -f "COOJA.log" ]; then
rm COOJA.log
fi
if [ -f "COOJA.testlog" ]; then
rm COOJA.testlog
fi
java -mx512m -jar ../dist/cooja.jar -nogui=$TEST.csc
2008-09-17 21:41:30 +00:00
if [ -f "COOJA.log" ]; then
mv COOJA.log $TEST.cooja_log
fi
2009-06-09 09:49:14 +00:00
if [ -f "COOJA.testlog" ]; then
mv COOJA.testlog $TEST.log
fi
2008-09-17 21:41:30 +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`
fi
2008-09-17 21:41:30 +00:00
if [ $OK == 0 ]; then
echo "FAIL" >> $LOG
if [ -f "$TEST.info" ]; then
echo "-- TEST INFO ($TEST.info) --" >> $LOG
cat $TEST.info >> $LOG
2008-09-17 21:41:30 +00:00
else
echo "-- NO TEST INFO AVAILABLE ($TEST.info) --" >> $LOG
2008-09-17 21:41:30 +00:00
fi
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
tail -10 $TEST.cooja_log >> $LOG
echo >> $LOG
else
echo "OK" >> $LOG
2008-09-17 21:41:30 +00:00
fi
echo >> $LOG
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
echo ""