OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [core/] [sim/] [rtl_sim/] [bin/] [parse_results] - Rev 227

Go to most recent revision | Compare with Previous | Blame | View Log

#!/bin/bash
#------------------------------------------------------------------------------
# Copyright (C) 2001 Authors
#
# This source file may be used and distributed without restriction provided
# that this copyright statement is not removed from the file and that any
# derivative work contains the original copyright notice and the associated
# disclaimer.
#
# This source file is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# This source is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this source; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
#------------------------------------------------------------------------------
#
# File Name: parse_results
#
# Author(s):
#             - Olivier Girard,    olgirard@gmail.com
#
#------------------------------------------------------------------------------
# $Rev: 138 $
# $LastChangedBy: olivier.girard $
# $LastChangedDate: 2012-04-23 13:10:00 +0200 (Mon, 23 Apr 2012) $
#------------------------------------------------------------------------------
###############################################################################
#                                                                             #
#                PARSE REGRESSION RESULTS IN THE LOG DIRECTORY                #
#                                                                             #
###############################################################################

# Formating attributes
green=$(tput setaf 2)
green_bold=$(tput bold)$(tput setaf 2)
red=$(tput setaf 1)
red_bold=$(tput bold)$(tput setaf 1)
normal=$(tput sgr0)

# Specify log directory
if [ $# -ne 1 ]; then
    LOG_DIR=./log/0
else
    LOG_DIR=$1
fi


#----------------------------------------------------#
# Get numbers of PASSED/SKIPPED/FAILED/ABORTED tests #
#----------------------------------------------------#

passed_nr="0"
skipped_nr="0"
failed_nr="0"
aborted_nr="0"

for file in $LOG_DIR/*.log ; do
    passed_ok=`grep -c PASSED $file`
    skipped_ok=`grep -c SKIPPED $file`
    failed_ok=`grep -c FAILED $file`

    if [ $passed_ok == 1 ]; then
        passed_nr=`expr $passed_nr + 1`
    elif [ $skipped_ok == 1 ]; then
        skipped_nr=`expr $skipped_nr + 1`
    elif [ $failed_ok != 0 ]; then
        failed_nr=`expr $failed_nr + 1`
    else
        aborted_nr=`expr $aborted_nr + 1`
    fi
done

#----------------------------------------------------#
#            Display detailed report                 #
#----------------------------------------------------#
echo ""
echo "#====================================================================================================================================================#"
echo "#                                                                                                                                                    #"
echo "#                                                                    DETAILED REPORT                                                                 #"
echo "#                                                                                                                                                    #"
echo "#====================================================================================================================================================#"
echo "#                            ||           ||               ||  DMA IF TRANSFER  ||                                                                   #"
echo "#          TEST NAME         ||  RESULT   ||      SEED     ||-------------------||                              REPLAY COMMAND                       #"
echo "#                            ||           ||               ||  Total  |  Error  ||                                                                   #"
echo "#============================++===========++===============++=========+=========++===================================================================#"
echo "#                            ||           ||               ||         |         ||                                                                   #"
for file in $LOG_DIR/*.log ; do
    testname=`basename $file .log`
    passed_ok=`grep -c PASSED $file`
    skipped_ok=`grep -c SKIPPED $file`
    failed_ok=`grep -c FAILED $file`
    abort_ok=0
    if [ $passed_ok == 1 ]; then
        result="${green} PASSED  ${normal}"
        replay_color="${normal}"
    elif [ $skipped_ok == 1 ]; then
        result="${normal} SKIPPED ${normal}"
        replay_color="${normal}"
    elif [ $failed_ok != 0 ]; then
        result="${red} FAILED  ${normal}"
        replay_color="${red}"
    else
        result="${red} ABORTED ${normal}"
        replay_color="${red}"
        abort_ok=1
    fi

    seed=`grep "SIMULATION SEED"   $file`
    seed_arr=($seed)

    dma_total=`grep "DMA REPORT"   $file`
    dma_total_arr=($dma_total)
    dma_error=`grep "Total Errors" $file`
    dma_error_arr=($dma_error)
    dma_error_arr[2]="${dma_error_arr[2]}"
    if [ $abort_ok == 0 ]; then
        if [ ${dma_error_arr[2]} -ne " 0" ]; then
            dma_error_arr[2]="${red}  ${dma_error_arr[2]} ${normal}"
        fi
    fi
    printf "#   %-24s || %s || %12s  || %6s  |  %4s   ||  $replay_color../bin/msp430sim -seed %12s   %-24s${normal}   #\n" $testname "$result" " ${seed_arr[2]}" " ${dma_total_arr[4]}" "${dma_error_arr[2]}" " ${seed_arr[2]}" $testname
done
echo "#                            ||           ||               ||         |         ||                                                                   #"
echo "#====================================================================================================================================================#"
echo ""

#----------------------------------------------------#
#        Display skipped and failed tests            #
#----------------------------------------------------#
echo ""
echo "#===================================================================#"
echo "#                          SKIPPED & FAILED TESTS                   #"
echo "#===================================================================#"
echo ""
if [ $skipped_nr != 0 ]; then
    echo " SKIPPED TESTS:"
    for file in $LOG_DIR/*.log ; do
        skipped_ok=`grep -c SKIPPED $file`
        if [ $skipped_ok == 1 ]; then
            echo "                 -  $file"
        fi
    done
fi
echo ""
if [ $failed_nr != 0 ]; then
    echo "${red_bold} FAILED TESTS:${normal}"
    for file in $LOG_DIR/*.log ; do
        failed_ok=`grep -c FAILED $file`
        if [ $failed_ok != 0 ]; then
            echo "${red_bold}                 -  $file ${normal}"
        fi
    done
fi
echo ""
if [ $aborted_nr != 0 ]; then
    echo  "${red_bold} ABORTED TESTS:${normal}"
    for file in $LOG_DIR/*.log ; do
        passed_ok=`grep -c PASSED $file`
        if [ $passed_ok == 0 ]; then
            failed_ok=`grep -c FAILED $file`
            if [ $failed_ok == 0 ]; then
                skipped_ok=`grep -c SKIPPED $file`
                if [ $skipped_ok == 0 ]; then
                    echo  "${red_bold}                 -  $file ${normal}"
                fi
            fi
        fi
    done
fi
echo ""

#----------------------------------------------------#
# Display summary report                             #
#----------------------------------------------------#
echo ""
echo "#===================================================================#"
echo "#                            SUMMARY REPORT                         #"
echo "#===================================================================#"
echo ""

# Generate final report
echo    "         +-----------------------------------"
echo    "         | Number of PASSED  tests :${green_bold} $passed_nr ${normal}"
echo    "         | Number of SKIPPED tests :${green_bold} $skipped_nr ${normal}"
echo    "         | Number of FAILED  tests :${red_bold} $failed_nr ${normal}"
echo    "         | Number of ABORTED tests :${red_bold} $aborted_nr ${normal}"
echo    "         |----------------------------------"
echo -n "         | Number of tests         : "
ls -1 $LOG_DIR/*.log | wc -l
echo    "         +----------------------------------"
echo    ""
echo    "         Make sure passed+skipped == total"
echo    ""
echo    ""

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.