Home | History | Annotate | Download | only in testing
      1 #!/bin/bash
      2 
      3 black='\E[30m'
      4 red='\E[31m'
      5 green='\E[32m'
      6 yellow='\E[33m'
      7 blue='\E[34m'
      8 magenta='\E[35m'
      9 cyan='\E[36m'
     10 white='\E[37m'
     11 
     12 if [ -f $2 ]; then
     13   data=$2
     14   if [ -f $1.summ ]; then rm $1.summ; fi
     15   if [ -f $1.snap ]; then rm $1.snap; fi
     16 else
     17   data=$1
     18 fi
     19 
     20 if ! ./$1 < $data > /dev/null 2> .runtest.log ; then
     21   echo -e  $red Test $1 failed: $black
     22   echo -e $blue
     23   cat .runtest.log
     24   echo -e $black
     25   exit 1
     26 else
     27   if [ -f $1.summ ]; then
     28     if [ `grep "FATAL ERROR" $1.summ | wc -l` -gt 0 ]; then
     29       echo -e  $red "Test $1 failed (FATAL ERROR, read the file $1.summ for details)" $black
     30       echo -e $blue
     31       cat .runtest.log
     32       echo -e $black
     33       exit 1;
     34     fi
     35 
     36     if [ `grep "FAILED THE TESTS OF ERROR-EXITS" $1.summ | wc -l` -gt 0 ]; then
     37       echo -e  $red "Test $1 failed (FAILED THE TESTS OF ERROR-EXITS, read the file $1.summ for details)" $black
     38       echo -e $blue
     39       cat .runtest.log
     40       echo -e $black
     41       exit 1;
     42     fi      
     43   fi
     44   echo -e $green Test $1 passed$black
     45 fi
     46