bug fix: RUN_TEST removed the aggrerated log + simplified code

This commit is contained in:
fros4943 2009-06-25 11:10:50 +00:00
parent b912a41ea3
commit c66b8422ee
2 changed files with 30 additions and 48 deletions

View file

@ -34,9 +34,12 @@ fi
# Run tests # Run tests
for COUNTER in `seq 1 $REPEATS`; for COUNTER in `seq 1 $REPEATS`;
do do
echo ">>>>>>> Repeating $COUNTER/$REPEATS <<<<<<<<" echo ">>>>>>> Test $COUNTER/$REPEATS: $TEST-$COUNTER.log <<<<<<<<"
bash RUN_TEST $TEST $TEST$COUNTER.log -keeplog bash RUN_TEST $TEST RUN_REPEATED_LAST.log
mv $TEST.log $TEST-$COUNTER.log
done done
echo echo
echo ">>>>>>> DONE! Test logs stored in $TEST[1-$REPEATS].log <<<<<<<<" cat RUN_REPEATED_LAST.log
echo
echo ">>>>>>> DONE! Test logs stored in $TEST-[1-$REPEATS].log <<<<<<<<"

View file

@ -1,33 +1,19 @@
#!/bin/bash #!/bin/bash
if [ $# -lt 1 -o $# -gt 3 ]; then if [ $# -lt 1 -o $# -gt 2 ]; then
echo "Usage: $0 <test> [logfile] [-keeplog]" echo "Usage: $0 <test> [logfile]"
exit exit
fi fi
TEST=$1 TEST=$1
LOGFILE=0 LOG=/dev/null
if [ $# -gt 1 ]; then if [ $# -eq 2 ]; then
LOGFILE=1
LOG=$2 LOG=$2
if [ -f "$LOG" ]; then
rm $LOG
fi
fi
NO_LOG_PROCESSING=0
if [ $# -gt 2 ]; then
if [ $3 == "-keeplog" ]; then
NO_LOG_PROCESSING=1
else
echo "Usage: $0 <test> [logfile] [-keeplog]"
exit
fi
fi fi
echo ">>>>>>> Starting test: $TEST <<<<<<<<" echo ">>>>>>> Starting test: $TEST <<<<<<<<"
if [ $LOGFILE -eq 1 ]; then echo -n "[`date '+%F %T'`] $TEST: " >> $LOG; fi echo -n "[`date '+%F %T'`] $TEST: " >> $LOG
if [ -f "COOJA.log" ]; then if [ -f "COOJA.log" ]; then
rm COOJA.log rm COOJA.log
fi fi
@ -47,14 +33,7 @@ if [ -f "$TEST.log" ]; then
OK=`grep "TEST OK" $TEST.log | wc -l` OK=`grep "TEST OK" $TEST.log | wc -l`
fi fi
if [ $NO_LOG_PROCESSING -eq 1 ]; then if [ $OK == 0 ]; then
rm $LOG
mv $TEST.log $LOG
exit
fi
if [ $LOGFILE -eq 1 ]; then
if [ $OK == 0 ]; then
echo "FAIL" >> $LOG echo "FAIL" >> $LOG
if [ -f "$TEST.info" ]; then if [ -f "$TEST.info" ]; then
echo "-- TEST INFO ($TEST.info) --" >> $LOG echo "-- TEST INFO ($TEST.info) --" >> $LOG
@ -70,15 +49,15 @@ if [ $LOGFILE -eq 1 ]; then
fi fi
echo "-- COOJA OUTPUT (tail $TEST.cooja_log) --" >> $LOG echo "-- COOJA OUTPUT (tail $TEST.cooja_log) --" >> $LOG
tail -10 $TEST.cooja_log >> $LOG tail -10 $TEST.cooja_log >> $LOG
else echo >> $LOG
else
echo "OK" >> $LOG echo "OK" >> $LOG
fi
echo >> $LOG
fi fi
echo >> $LOG
if [ $OK == 0 ]; then if [ $OK == 0 ]; then
echo ">>>>>>> Finished test: $TEST FAILED <<<<<<<<" echo ">>>>>>> Finished test: $TEST FAILED <<<<<<<<"
echo ""
else else
echo ">>>>>>> Finished test: $TEST OK <<<<<<<<" echo ">>>>>>> Finished test: $TEST OK <<<<<<<<"
fi fi
echo ""