Changeset 167

Show
Ignore:
Timestamp:
10/14/07 15:15:07
Author:
apokayi
Message:

ito turn on/off the coloring in the output, a flag is added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • guts_main/guts_main.sh

    r163 r167  
    3636failed=0 
    3737cmp_failed=0 
     38 
     39# specify second argument as ON to turn on the coloring in the output 
     40COLOR=$2 
    3841 
    3942# flags for Berkeley UPC Compiler 
     
    6366                exe_output=`$RUN`  
    6467                if test $? -eq 0 ; then 
    65                         printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$UNIT]" 
     68                        if [ "$COLOR" == "ON" ]; then 
     69                                printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$UNIT]" 
     70                        fi 
     71                        printf "TEST PASSED for the unit [$UNIT]" 
    6672                        echo $exe_output 
    6773                        echo "$UNIT" >>units.passed 
    6874                        passed=`expr $passed + 1` 
    6975                else 
    70                         printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$UNIT]" 
     76                        if [ "$COLOR" == "ON" ]; then 
     77                                printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$UNIT]" 
     78                        fi 
     79                        printf "TEST FAILED for the unit [$UNIT]" 
     80 
    7181                        printf "\n" 
    7282                        echo $exe_output 
     
    102112                echo "ERROR: The NEGATIVE unit [$NUNIT] pass the compilation phase" 
    103113                echo "The unit will not be run!!!" 
    104                 echo -e "TEST \033[31m\033[1mFAILED\033[0m for the unit [$NUNIT]" 
    105                 echo "$NUNIT" >>units.notpassed 
     114                if [ "$COLOR" == "ON" ]; then 
     115                        echo -e "TEST \033[31m\033[1mFAILED\033[0m for the unit [$NUNIT]" 
     116                fi 
     117                echo -e "TEST FAILED for the unit [$NUNIT]" 
     118 
     119                echo "$NUNIT" >>units.notpassed 
    106120                failed=`expr $failed + 1` 
    107121                cmp_failed=`expr $cmp_failed + 1` 
     
    111125                echo "Note that this is the EXPECTED result since the unit is negative" 
    112126                echo "The unit will not be run!!!" 
    113                 printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$NUNIT]" 
    114                 echo "$NUNIT" >>units.passed      
     127                if [ "$COLOR" == "ON" ]; then 
     128                        printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$NUNIT]" 
     129                fi 
     130                printf "TEST PASSED for the unit [$NUNIT]" 
     131                echo "$NUNIT" >>units.passed      
    115132                passed=`expr $passed + 1` 
    116133 
     
    145162                exe_output=`$RUN` 
    146163                if test $? -eq 0 ; then 
    147                         printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$UNIT]" 
    148                         echo "$UNIT" >>units.notpassed 
     164                        if [ "$COLOR" == "ON" ]; then 
     165                                printf "TEST \033[31m\033[1mFAILED\033[0m for the unit [$UNIT]" 
     166                        fi 
     167                        printf "TEST FAILED for the unit [$UNIT]" 
     168                        echo "$UNIT" >>units.notpassed 
    149169                        failed=`expr $failed + 1` 
    150170                else 
    151                         printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$UNIT]" 
    152                         echo "$UNIT" >>units.passed 
     171                        if [ "$COLOR" == "ON" ]; then 
     172                                printf "TEST \033[34m\033[1mPASSED\033[0m for the unit [$UNIT]" 
     173                        fi 
     174                        printf "TEST PASSED for the unit [$UNIT]" 
     175                        echo "$UNIT" >>units.passed 
    153176                        passed=`expr $passed + 1` 
    154177                fi 
     
    174197printf "________________       GWU-HPCL UPC Compiler Testing Summary         ________________\n" 
    175198echo "SUCCESSFUL UNITS --> (units.passed)" 
    176 printf "\033[34m\033[1m" 
     199 
     200if [ "$COLOR" == "ON" ]; then 
     201        printf "\033[34m\033[1m" 
     202fi 
     203 
    177204if test -f units.passed ; then 
    178205        cat units.passed|sort|uniq 
    179206fi 
    180 printf "\033[0m" 
     207 
     208if [ "$COLOR" == "ON" ]; then 
     209        printf "\033[0m" 
     210fi 
    181211 
    182212echo "    FAILED UNITS --> (units.notpassed)" 
    183 printf "\033[31m\033[1m" 
     213 
     214if [ "$COLOR" == "ON" ]; then 
     215        printf "\033[31m\033[1m" 
     216fi 
     217 
    184218if test -f units.notpassed ; then 
    185219        cat units.notpassed|sort|uniq 
    186220fi 
    187 printf "\033[0m" 
    188  
    189 printf "\033[5m\033[1m\033[35m" 
     221 
     222if [ "$COLOR" == "ON" ]; then 
     223        printf "\033[0m" 
     224        printf "\033[1m\033[1m\033[35m" 
     225fi 
     226 
    190227echo "                 -->      Number of units PASSED : $passed" 
    191228echo "                 -->      Number of units FAILED : $failed" 
     
    194231 
    195232printf "                 -->    $percentage % of the units have PASSED\n" 
    196 printf "\033[0m" 
     233 
     234if [ "$COLOR" == "ON" ]; then 
     235        printf "\033[0m" 
     236fi 
     237 
    197238printf "===========================     TEST END    ====================================\n"