1 |
149 |
olivier.gi |
#!/bin/bash
|
2 |
|
|
#------------------------------------------------------------------------------
|
3 |
|
|
# Copyright (C) 2001 Authors
|
4 |
|
|
#
|
5 |
|
|
# This source file may be used and distributed without restriction provided
|
6 |
|
|
# that this copyright statement is not removed from the file and that any
|
7 |
|
|
# derivative work contains the original copyright notice and the associated
|
8 |
|
|
# disclaimer.
|
9 |
|
|
#
|
10 |
|
|
# This source file is free software; you can redistribute it and/or modify
|
11 |
|
|
# it under the terms of the GNU Lesser General Public License as published
|
12 |
|
|
# by the Free Software Foundation; either version 2.1 of the License, or
|
13 |
|
|
# (at your option) any later version.
|
14 |
|
|
#
|
15 |
|
|
# This source is distributed in the hope that it will be useful, but WITHOUT
|
16 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
17 |
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
18 |
|
|
# License for more details.
|
19 |
|
|
#
|
20 |
|
|
# You should have received a copy of the GNU Lesser General Public License
|
21 |
|
|
# along with this source; if not, write to the Free Software Foundation,
|
22 |
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
23 |
|
|
#
|
24 |
|
|
#------------------------------------------------------------------------------
|
25 |
202 |
olivier.gi |
#
|
26 |
149 |
olivier.gi |
# File Name: parse_results
|
27 |
202 |
olivier.gi |
#
|
28 |
149 |
olivier.gi |
# Author(s):
|
29 |
|
|
# - Olivier Girard, olgirard@gmail.com
|
30 |
|
|
#
|
31 |
|
|
#------------------------------------------------------------------------------
|
32 |
|
|
# $Rev: 138 $
|
33 |
|
|
# $LastChangedBy: olivier.girard $
|
34 |
|
|
# $LastChangedDate: 2012-04-23 13:10:00 +0200 (Mon, 23 Apr 2012) $
|
35 |
|
|
#------------------------------------------------------------------------------
|
36 |
|
|
###############################################################################
|
37 |
|
|
# #
|
38 |
|
|
# PARSE REGRESSION RESULTS IN THE LOG DIRECTORY #
|
39 |
|
|
# #
|
40 |
|
|
###############################################################################
|
41 |
|
|
|
42 |
202 |
olivier.gi |
# Formating attributes
|
43 |
|
|
green=$(tput setaf 2)
|
44 |
|
|
green_bold=$(tput bold)$(tput setaf 2)
|
45 |
|
|
red=$(tput setaf 1)
|
46 |
|
|
red_bold=$(tput bold)$(tput setaf 1)
|
47 |
|
|
normal=$(tput sgr0)
|
48 |
|
|
|
49 |
|
|
# Specify log directory
|
50 |
|
|
if [ $# -ne 1 ]; then
|
51 |
|
|
LOG_DIR=./log/0
|
52 |
|
|
else
|
53 |
|
|
LOG_DIR=$1
|
54 |
|
|
fi
|
55 |
|
|
|
56 |
|
|
|
57 |
149 |
olivier.gi |
#----------------------------------------------------#
|
58 |
202 |
olivier.gi |
# Get numbers of PASSED/SKIPPED/FAILED/ABORTED tests #
|
59 |
149 |
olivier.gi |
#----------------------------------------------------#
|
60 |
|
|
|
61 |
|
|
passed_nr="0"
|
62 |
|
|
skipped_nr="0"
|
63 |
|
|
failed_nr="0"
|
64 |
202 |
olivier.gi |
aborted_nr="0"
|
65 |
149 |
olivier.gi |
|
66 |
202 |
olivier.gi |
for file in $LOG_DIR/*.log ; do
|
67 |
149 |
olivier.gi |
passed_ok=`grep -c PASSED $file`
|
68 |
|
|
skipped_ok=`grep -c SKIPPED $file`
|
69 |
|
|
failed_ok=`grep -c FAILED $file`
|
70 |
202 |
olivier.gi |
|
71 |
|
|
if [ $passed_ok == 1 ]; then
|
72 |
|
|
passed_nr=`expr $passed_nr + 1`
|
73 |
|
|
elif [ $skipped_ok == 1 ]; then
|
74 |
|
|
skipped_nr=`expr $skipped_nr + 1`
|
75 |
|
|
elif [ $failed_ok != 0 ]; then
|
76 |
|
|
failed_nr=`expr $failed_nr + 1`
|
77 |
149 |
olivier.gi |
else
|
78 |
202 |
olivier.gi |
aborted_nr=`expr $aborted_nr + 1`
|
79 |
149 |
olivier.gi |
fi
|
80 |
|
|
done
|
81 |
|
|
|
82 |
|
|
#----------------------------------------------------#
|
83 |
202 |
olivier.gi |
# Display detailed report #
|
84 |
149 |
olivier.gi |
#----------------------------------------------------#
|
85 |
|
|
echo ""
|
86 |
202 |
olivier.gi |
echo "#====================================================================================================================================================#"
|
87 |
|
|
echo "# #"
|
88 |
|
|
echo "# DETAILED REPORT #"
|
89 |
|
|
echo "# #"
|
90 |
|
|
echo "#====================================================================================================================================================#"
|
91 |
|
|
echo "# || || || DMA IF TRANSFER || #"
|
92 |
|
|
echo "# TEST NAME || RESULT || SEED ||-------------------|| REPLAY COMMAND #"
|
93 |
|
|
echo "# || || || Total | Error || #"
|
94 |
|
|
echo "#============================++===========++===============++=========+=========++===================================================================#"
|
95 |
|
|
echo "# || || || | || #"
|
96 |
|
|
for file in $LOG_DIR/*.log ; do
|
97 |
|
|
testname=`basename $file .log`
|
98 |
|
|
passed_ok=`grep -c PASSED $file`
|
99 |
|
|
skipped_ok=`grep -c SKIPPED $file`
|
100 |
|
|
failed_ok=`grep -c FAILED $file`
|
101 |
|
|
abort_ok=0
|
102 |
|
|
if [ $passed_ok == 1 ]; then
|
103 |
|
|
result="${green} PASSED ${normal}"
|
104 |
|
|
replay_color="${normal}"
|
105 |
|
|
elif [ $skipped_ok == 1 ]; then
|
106 |
|
|
result="${normal} SKIPPED ${normal}"
|
107 |
|
|
replay_color="${normal}"
|
108 |
|
|
elif [ $failed_ok != 0 ]; then
|
109 |
|
|
result="${red} FAILED ${normal}"
|
110 |
|
|
replay_color="${red}"
|
111 |
|
|
else
|
112 |
|
|
result="${red} ABORTED ${normal}"
|
113 |
|
|
replay_color="${red}"
|
114 |
|
|
abort_ok=1
|
115 |
|
|
fi
|
116 |
|
|
|
117 |
|
|
seed=`grep "SIMULATION SEED" $file`
|
118 |
|
|
seed_arr=($seed)
|
119 |
|
|
|
120 |
|
|
dma_total=`grep "DMA REPORT" $file`
|
121 |
|
|
dma_total_arr=($dma_total)
|
122 |
|
|
dma_error=`grep "Total Errors" $file`
|
123 |
|
|
dma_error_arr=($dma_error)
|
124 |
|
|
dma_error_arr[2]="${dma_error_arr[2]}"
|
125 |
|
|
if [ $abort_ok == 0 ]; then
|
126 |
|
|
if [ ${dma_error_arr[2]} -ne " 0" ]; then
|
127 |
|
|
dma_error_arr[2]="${red} ${dma_error_arr[2]} ${normal}"
|
128 |
|
|
fi
|
129 |
|
|
fi
|
130 |
|
|
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
|
131 |
|
|
done
|
132 |
|
|
echo "# || || || | || #"
|
133 |
|
|
echo "#====================================================================================================================================================#"
|
134 |
149 |
olivier.gi |
echo ""
|
135 |
202 |
olivier.gi |
|
136 |
|
|
#----------------------------------------------------#
|
137 |
|
|
# Display skipped and failed tests #
|
138 |
|
|
#----------------------------------------------------#
|
139 |
|
|
echo ""
|
140 |
|
|
echo "#===================================================================#"
|
141 |
|
|
echo "# SKIPPED & FAILED TESTS #"
|
142 |
|
|
echo "#===================================================================#"
|
143 |
|
|
echo ""
|
144 |
|
|
if [ $skipped_nr != 0 ]; then
|
145 |
149 |
olivier.gi |
echo " SKIPPED TESTS:"
|
146 |
202 |
olivier.gi |
for file in $LOG_DIR/*.log ; do
|
147 |
|
|
skipped_ok=`grep -c SKIPPED $file`
|
148 |
|
|
if [ $skipped_ok == 1 ]; then
|
149 |
|
|
echo " - $file"
|
150 |
|
|
fi
|
151 |
149 |
olivier.gi |
done
|
152 |
|
|
fi
|
153 |
|
|
echo ""
|
154 |
202 |
olivier.gi |
if [ $failed_nr != 0 ]; then
|
155 |
|
|
echo "${red_bold} FAILED TESTS:${normal}"
|
156 |
|
|
for file in $LOG_DIR/*.log ; do
|
157 |
|
|
failed_ok=`grep -c FAILED $file`
|
158 |
|
|
if [ $failed_ok != 0 ]; then
|
159 |
|
|
echo "${red_bold} - $file ${normal}"
|
160 |
|
|
fi
|
161 |
149 |
olivier.gi |
done
|
162 |
|
|
fi
|
163 |
|
|
echo ""
|
164 |
202 |
olivier.gi |
if [ $aborted_nr != 0 ]; then
|
165 |
|
|
echo "${red_bold} ABORTED TESTS:${normal}"
|
166 |
|
|
for file in $LOG_DIR/*.log ; do
|
167 |
|
|
passed_ok=`grep -c PASSED $file`
|
168 |
|
|
if [ $passed_ok == 0 ]; then
|
169 |
|
|
failed_ok=`grep -c FAILED $file`
|
170 |
|
|
if [ $failed_ok == 0 ]; then
|
171 |
|
|
skipped_ok=`grep -c SKIPPED $file`
|
172 |
|
|
if [ $skipped_ok == 0 ]; then
|
173 |
|
|
echo "${red_bold} - $file ${normal}"
|
174 |
|
|
fi
|
175 |
|
|
fi
|
176 |
|
|
fi
|
177 |
149 |
olivier.gi |
done
|
178 |
|
|
fi
|
179 |
|
|
echo ""
|
180 |
|
|
|
181 |
|
|
#----------------------------------------------------#
|
182 |
|
|
# Display summary report #
|
183 |
|
|
#----------------------------------------------------#
|
184 |
|
|
echo ""
|
185 |
202 |
olivier.gi |
echo "#===================================================================#"
|
186 |
|
|
echo "# SUMMARY REPORT #"
|
187 |
|
|
echo "#===================================================================#"
|
188 |
149 |
olivier.gi |
echo ""
|
189 |
|
|
|
190 |
|
|
# Generate final report
|
191 |
202 |
olivier.gi |
echo " +-----------------------------------"
|
192 |
|
|
echo " | Number of PASSED tests :${green_bold} $passed_nr ${normal}"
|
193 |
|
|
echo " | Number of SKIPPED tests :${green_bold} $skipped_nr ${normal}"
|
194 |
|
|
echo " | Number of FAILED tests :${red_bold} $failed_nr ${normal}"
|
195 |
|
|
echo " | Number of ABORTED tests :${red_bold} $aborted_nr ${normal}"
|
196 |
|
|
echo " |----------------------------------"
|
197 |
|
|
echo -n " | Number of tests : "
|
198 |
|
|
ls -1 $LOG_DIR/*.log | wc -l
|
199 |
|
|
echo " +----------------------------------"
|
200 |
149 |
olivier.gi |
echo ""
|
201 |
202 |
olivier.gi |
echo " Make sure passed+skipped == total"
|
202 |
149 |
olivier.gi |
echo ""
|
203 |
|
|
echo ""
|