bug fix: RUN_TEST removed the aggrerated log + simplified code
This commit is contained in:
parent
b912a41ea3
commit
c66b8422ee
2 changed files with 30 additions and 48 deletions
|
@ -34,9 +34,12 @@ fi
|
|||
# Run tests
|
||||
for COUNTER in `seq 1 $REPEATS`;
|
||||
do
|
||||
echo ">>>>>>> Repeating $COUNTER/$REPEATS <<<<<<<<"
|
||||
bash RUN_TEST $TEST $TEST$COUNTER.log -keeplog
|
||||
echo ">>>>>>> Test $COUNTER/$REPEATS: $TEST-$COUNTER.log <<<<<<<<"
|
||||
bash RUN_TEST $TEST RUN_REPEATED_LAST.log
|
||||
mv $TEST.log $TEST-$COUNTER.log
|
||||
done
|
||||
|
||||
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 <<<<<<<<"
|
||||
|
|
|
@ -1,33 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 1 -o $# -gt 3 ]; then
|
||||
echo "Usage: $0 <test> [logfile] [-keeplog]"
|
||||
if [ $# -lt 1 -o $# -gt 2 ]; then
|
||||
echo "Usage: $0 <test> [logfile]"
|
||||
exit
|
||||
fi
|
||||
|
||||
TEST=$1
|
||||
|
||||
LOGFILE=0
|
||||
if [ $# -gt 1 ]; then
|
||||
LOGFILE=1
|
||||
LOG=/dev/null
|
||||
if [ $# -eq 2 ]; then
|
||||
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
|
||||
|
||||
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
|
||||
rm COOJA.log
|
||||
fi
|
||||
|
@ -47,38 +33,31 @@ if [ -f "$TEST.log" ]; then
|
|||
OK=`grep "TEST OK" $TEST.log | wc -l`
|
||||
fi
|
||||
|
||||
if [ $NO_LOG_PROCESSING -eq 1 ]; then
|
||||
rm $LOG
|
||||
mv $TEST.log $LOG
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ $LOGFILE -eq 1 ]; then
|
||||
if [ $OK == 0 ]; then
|
||||
echo "FAIL" >> $LOG
|
||||
if [ -f "$TEST.info" ]; then
|
||||
echo "-- TEST INFO ($TEST.info) --" >> $LOG
|
||||
cat $TEST.info >> $LOG
|
||||
else
|
||||
echo "-- NO TEST INFO AVAILABLE ($TEST.info) --" >> $LOG
|
||||
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
|
||||
if [ $OK == 0 ]; then
|
||||
echo "FAIL" >> $LOG
|
||||
if [ -f "$TEST.info" ]; then
|
||||
echo "-- TEST INFO ($TEST.info) --" >> $LOG
|
||||
cat $TEST.info >> $LOG
|
||||
else
|
||||
echo "OK" >> $LOG
|
||||
echo "-- NO TEST INFO AVAILABLE ($TEST.info) --" >> $LOG
|
||||
fi
|
||||
echo >> $LOG
|
||||
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
|
||||
fi
|
||||
echo >> $LOG
|
||||
|
||||
if [ $OK == 0 ]; then
|
||||
echo ">>>>>>> Finished test: $TEST FAILED <<<<<<<<"
|
||||
echo ""
|
||||
else
|
||||
echo ">>>>>>> Finished test: $TEST OK <<<<<<<<"
|
||||
fi
|
||||
echo ""
|
||||
|
|
Loading…
Reference in a new issue