1 |
202 |
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 |
|
|
#
|
26 |
|
|
# File Name: parse_summaries
|
27 |
|
|
#
|
28 |
|
|
# 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 |
|
|
# #
|
39 |
|
|
# PARSE REGRESSION RESULTS IN THE LOG DIRECTORY #
|
40 |
|
|
# #
|
41 |
|
|
###############################################################################
|
42 |
|
|
|
43 |
|
|
# Formating attributes
|
44 |
|
|
yellow=$(tput setaf 3)
|
45 |
|
|
green=$(tput setaf 2)
|
46 |
|
|
green_bold=$(tput bold)$(tput setaf 2)
|
47 |
|
|
red=$(tput setaf 1)
|
48 |
|
|
red_bold=$(tput bold)$(tput setaf 1)
|
49 |
|
|
normal=$(tput sgr0)
|
50 |
|
|
|
51 |
|
|
# Specify log directory & summary files
|
52 |
|
|
LOG_DIR=./log
|
53 |
|
|
if [ $# -ne 1 ]; then
|
54 |
|
|
SUM_FILES=$LOG_DIR/summary.*.log
|
55 |
|
|
else
|
56 |
|
|
SUM_FILES=$1
|
57 |
|
|
fi
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
#-------------------------------------------------------------------------#
|
61 |
|
|
# Get overall numbers of PASSED/SKIPPED/FAILED/ABORTED tests #
|
62 |
|
|
#-------------------------------------------------------------------------#
|
63 |
|
|
|
64 |
|
|
# Number of files to be processed
|
65 |
|
|
nr_log_files=0
|
66 |
|
|
for file in $SUM_FILES ; do
|
67 |
|
|
nr_log_files=`expr $nr_log_files + 1`
|
68 |
|
|
done
|
69 |
|
|
|
70 |
|
|
# Initialize progress variables
|
71 |
|
|
progress=0.0
|
72 |
|
|
progress_idx=0
|
73 |
|
|
progress_incr=$(awk -v r=$nr_log_files 'BEGIN{print 100 / r}')
|
74 |
|
|
printf "\nProcess and merge log files (1/2)... 0.00%%"
|
75 |
|
|
|
76 |
|
|
passed_nr="0"
|
77 |
|
|
skipped_nr="0"
|
78 |
|
|
failed_nr="0"
|
79 |
|
|
aborted_nr="0"
|
80 |
|
|
|
81 |
|
|
for file in $SUM_FILES ; do
|
82 |
|
|
passed_ok=`grep "PASSED" $file | grep -c msp430sim`
|
83 |
|
|
skipped_ok=`grep "SKIPPED" $file | grep -c msp430sim`
|
84 |
|
|
failed_ok=`grep "FAILED" $file | grep -c msp430sim`
|
85 |
|
|
aborted_ok=`grep "ABORTED" $file | grep -c msp430sim`
|
86 |
|
|
|
87 |
|
|
passed_nr=`expr $passed_nr + $passed_ok`
|
88 |
|
|
skipped_nr=`expr $skipped_nr + $skipped_ok`
|
89 |
|
|
failed_nr=`expr $failed_nr + $failed_ok`
|
90 |
|
|
aborted_nr=`expr $aborted_nr + $aborted_ok`
|
91 |
|
|
|
92 |
|
|
progress_idx=`expr $progress_idx + 1`
|
93 |
|
|
progress=$(awk -v idx=$progress_idx -v incr=$progress_incr 'BEGIN{print incr * idx}')
|
94 |
|
|
printf "\b\b\b\b\b\b\b%6.2f%%" $progress
|
95 |
|
|
done
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
#-------------------------------------------------------------------------#
|
99 |
|
|
# Get numbers of PASSED/SKIPPED/FAILED/ABORTED tests for individual tests #
|
100 |
|
|
#-------------------------------------------------------------------------#
|
101 |
|
|
testnames_list=""
|
102 |
|
|
failed_reg_list=""
|
103 |
|
|
|
104 |
|
|
# Put log file content into variable
|
105 |
|
|
tests_list=`grep msp430sim $SUM_FILES`
|
106 |
|
|
tests_nr=`cat $SUM_FILES | grep -c msp430sim`
|
107 |
|
|
|
108 |
|
|
# Initialize progress variables
|
109 |
|
|
progress=0.0
|
110 |
|
|
progress_idx=0
|
111 |
|
|
progress_incr=$(awk -v r=$tests_nr 'BEGIN{print 100 / r}')
|
112 |
|
|
printf "\nProcess and merge log files (2/2)... 0.00%%"
|
113 |
|
|
|
114 |
|
|
while read -r line; do
|
115 |
|
|
|
116 |
|
|
line_arr=($line)
|
117 |
|
|
|
118 |
|
|
# Update list of test names
|
119 |
|
|
testnames_list=$testnames_list" ${line_arr[1]}"
|
120 |
|
|
|
121 |
|
|
# Get regression index number
|
122 |
|
|
reg_index=`basename ${line_arr[0]} .log:#`
|
123 |
|
|
reg_index=`echo "${reg_index##*.}"`
|
124 |
|
|
|
125 |
|
|
# Detect if the test as PASSED, SKIPPED, FAILED or ABORTED
|
126 |
|
|
passed_ok=0
|
127 |
|
|
skipped_ok=0
|
128 |
|
|
failed_ok=0
|
129 |
|
|
aborted_ok=0
|
130 |
|
|
if [[ $line =~ .*PASSED.* ]]; then
|
131 |
|
|
passed_ok=1
|
132 |
|
|
elif [[ $line =~ .*SKIPPED.* ]]; then
|
133 |
|
|
skipped_ok=1
|
134 |
|
|
elif [[ $line =~ .*FAILED.* ]]; then
|
135 |
|
|
failed_ok=1
|
136 |
|
|
elif [[ $line =~ .*ABORTED.* ]]; then
|
137 |
|
|
aborted_ok=1
|
138 |
|
|
fi
|
139 |
|
|
|
140 |
|
|
# Get number of DMA accesses (Total and Error)
|
141 |
|
|
dma_total=${line_arr[9]}
|
142 |
|
|
if [ "${line_arr[11]}" == "[31m" ]; then
|
143 |
|
|
dma_error=${line_arr[12]}
|
144 |
|
|
else
|
145 |
|
|
dma_error=${line_arr[11]}
|
146 |
|
|
fi
|
147 |
|
|
|
148 |
|
|
# Update accumulated values for later reporting
|
149 |
|
|
prefix=${line_arr[1]//-/_}
|
150 |
|
|
varname=${prefix}_passed_nr
|
151 |
|
|
if [ -z "${!varname}" ]; then
|
152 |
|
|
declare -i ${prefix}_passed_nr=$passed_ok
|
153 |
|
|
declare -i ${prefix}_skipped_nr=$skipped_ok
|
154 |
|
|
declare -i ${prefix}_failed_nr=$failed_ok
|
155 |
|
|
declare -i ${prefix}_aborted_nr=$aborted_ok
|
156 |
|
|
declare -i ${prefix}_dma_total_nr=$dma_total
|
157 |
|
|
declare -i ${prefix}_dma_error_nr=$dma_error
|
158 |
|
|
if [ $failed_ok != 0 ] || [ $aborted_ok != 0 ] || [ $dma_error != 0 ]; then
|
159 |
|
|
declare ${prefix}_failing_indexes=$reg_index
|
160 |
|
|
failed_reg_list=$failed_reg_list" $file"
|
161 |
|
|
else
|
162 |
|
|
declare ${prefix}_failing_indexes="-"
|
163 |
|
|
fi
|
164 |
|
|
else
|
165 |
|
|
varname=${prefix}_passed_nr; declare -i $varname=`expr ${!varname} + $passed_ok`
|
166 |
|
|
varname=${prefix}_skipped_nr; declare -i $varname=`expr ${!varname} + $skipped_ok`
|
167 |
|
|
varname=${prefix}_failed_nr; declare -i $varname=`expr ${!varname} + $failed_ok`
|
168 |
|
|
varname=${prefix}_aborted_nr; declare -i $varname=`expr ${!varname} + $aborted_ok`
|
169 |
|
|
varname=${prefix}_dma_total_nr; declare -i $varname=`expr ${!varname} + $dma_total`
|
170 |
|
|
varname=${prefix}_dma_error_nr; declare -i $varname=`expr ${!varname} + $dma_error`
|
171 |
|
|
if [ $failed_ok != 0 ] || [ $aborted_ok != 0 ] || [ $dma_error != 0 ]; then
|
172 |
|
|
varname=${prefix}_failing_indexes;
|
173 |
|
|
failed_reg_list=$failed_reg_list" $file"
|
174 |
|
|
if [ "${!varname}" == "-" ]; then
|
175 |
|
|
declare $varname=$reg_index
|
176 |
|
|
else
|
177 |
|
|
declare $varname="${!varname} $reg_index"
|
178 |
|
|
fi
|
179 |
|
|
fi
|
180 |
|
|
fi
|
181 |
|
|
|
182 |
|
|
# Display progress status
|
183 |
|
|
progress_idx=`expr $progress_idx + 1`
|
184 |
|
|
progress=$(awk -v idx=$progress_idx -v incr=$progress_incr 'BEGIN{print incr * idx}')
|
185 |
|
|
printf "\b\b\b\b\b\b\b%6.2f%%" $progress
|
186 |
|
|
|
187 |
|
|
done <<< "$tests_list"
|
188 |
|
|
echo ""
|
189 |
|
|
|
190 |
|
|
# Remove duplicate elements in list of test
|
191 |
|
|
testnames_list=$(echo "$testnames_list" | tr ' ' '\n' | sort -u | tr '\n' ' ')
|
192 |
|
|
|
193 |
|
|
# Remove duplicate elements in list of failed regressions
|
194 |
|
|
failed_reg_list=$(echo "$failed_reg_list" | tr ' ' '\n' | sort -u | tr '\n' ' ')
|
195 |
|
|
|
196 |
|
|
#-------------------------------------------------------------------------#
|
197 |
|
|
# Display detailed report #
|
198 |
|
|
#-------------------------------------------------------------------------#
|
199 |
|
|
echo ""
|
200 |
|
|
echo "#=======================================================================================================================================================#"
|
201 |
|
|
echo "# #"
|
202 |
|
|
echo "# DETAILED REPORT #"
|
203 |
|
|
echo "# #"
|
204 |
|
|
echo "#=======================================================================================================================================================#"
|
205 |
|
|
echo "# || RESULTS || DMA IF TRANSFER || #"
|
206 |
|
|
echo "# TEST NAME ||-------------------------------------------------------||-------------------------------|| FAILING REGRESSION INDEXES #"
|
207 |
|
|
echo "# || Passed | Skipped | Failed | Aborted | Total || Total | Error || #"
|
208 |
|
|
echo "#=============================++==========+===========+==========+===========+=========++===============+===============++==============================#"
|
209 |
|
|
echo "# || | | | | || | || #"
|
210 |
|
|
for testname in $testnames_list ; do
|
211 |
|
|
|
212 |
|
|
# Get accumulated results
|
213 |
|
|
prefix=${testname//-/_}
|
214 |
|
|
var_passed=${prefix}_passed_nr;
|
215 |
|
|
var_skipped=${prefix}_skipped_nr;
|
216 |
|
|
var_failed=${prefix}_failed_nr;
|
217 |
|
|
var_aborted=${prefix}_aborted_nr;
|
218 |
|
|
var_total=`expr ${!var_passed} + ${!var_skipped} + ${!var_failed} + ${!var_aborted}`
|
219 |
|
|
var_dma_total=${prefix}_dma_total_nr;
|
220 |
|
|
var_dma_error=${prefix}_dma_error_nr;
|
221 |
|
|
var_failing_indexes=${prefix}_failing_indexes;
|
222 |
|
|
|
223 |
|
|
# Add some color
|
224 |
|
|
if [ ${!var_failed} != 0 ] || [ ${!var_aborted} != 0 ] || [ ${!var_dma_error} != 0 ]; then
|
225 |
|
|
var_testname="${red} $testname ${normal}"
|
226 |
|
|
printf "# %-37s ||" "$var_testname"
|
227 |
|
|
res_passed="${normal} ${!var_passed} ${normal}"
|
228 |
|
|
printf " %20s | %8s |" "$res_passed" ${!var_skipped}
|
229 |
|
|
if [ ${!var_failed} != 0 ]; then
|
230 |
|
|
res_failed="${red} ${!var_failed} ${normal}"
|
231 |
|
|
printf " %19s |" "$res_failed"
|
232 |
|
|
else
|
233 |
|
|
res_failed="${normal} ${!var_failed} ${normal}"
|
234 |
|
|
printf " %20s |" "$res_failed"
|
235 |
|
|
fi
|
236 |
|
|
if [ ${!var_aborted} != 0 ]; then
|
237 |
|
|
res_aborted="${red} ${!var_aborted} ${normal}"
|
238 |
|
|
printf " %20s | %6s || %12s |" "$res_aborted" $var_total ${!var_dma_total}
|
239 |
|
|
else
|
240 |
|
|
res_aborted="${normal} ${!var_aborted} ${normal}"
|
241 |
|
|
printf " %21s | %6s || %12s |" "$res_aborted" $var_total ${!var_dma_total}
|
242 |
|
|
fi
|
243 |
|
|
if [ ${!var_dma_error} != 0 ]; then
|
244 |
|
|
res_dma_error="${red} ${!var_dma_error} ${normal}"
|
245 |
|
|
printf " %23s ||" "$res_dma_error"
|
246 |
|
|
else
|
247 |
|
|
res_dma_error="${normal} ${!var_dma_error} ${normal}"
|
248 |
|
|
printf " %24s ||" "$res_dma_error"
|
249 |
|
|
fi
|
250 |
|
|
else
|
251 |
|
|
var_testname="${normal} $testname ${normal}"
|
252 |
|
|
printf "# %-38s ||" "$var_testname"
|
253 |
|
|
if [ ${!var_passed} != 0 ]; then
|
254 |
|
|
res_passed="${green} ${!var_passed} ${normal}"
|
255 |
|
|
else
|
256 |
|
|
res_passed="${yellow} ${!var_passed} ${normal}"
|
257 |
|
|
fi
|
258 |
|
|
printf " %19s | %8s |" "$res_passed" ${!var_skipped}
|
259 |
|
|
res_failed="${normal} ${!var_failed} ${normal}"
|
260 |
|
|
printf " %20s |" "$res_failed"
|
261 |
|
|
res_aborted="${normal} ${!var_aborted} ${normal}"
|
262 |
|
|
printf " %21s | %6s || %12s |" "$res_aborted" $var_total ${!var_dma_total}
|
263 |
|
|
res_dma_error="${normal} ${!var_dma_error} ${normal}"
|
264 |
|
|
printf " %24s ||" "$res_dma_error"
|
265 |
|
|
fi
|
266 |
|
|
|
267 |
|
|
printf " %-27s #\n" "${!var_failing_indexes}"
|
268 |
|
|
done
|
269 |
|
|
echo "# || | | | | || | || #"
|
270 |
|
|
echo "#=======================================================================================================================================================#"
|
271 |
|
|
echo ""
|
272 |
|
|
|
273 |
|
|
#----------------------------------------------------#
|
274 |
|
|
# Display failed regressions #
|
275 |
|
|
#----------------------------------------------------#
|
276 |
|
|
echo ""
|
277 |
|
|
echo "#=======================================================================================================================================================#"
|
278 |
|
|
echo "# FAILING REGRESSIONS #"
|
279 |
|
|
echo "#=======================================================================================================================================================#"
|
280 |
|
|
echo ""
|
281 |
|
|
for failed_reg_file in $failed_reg_list ; do
|
282 |
|
|
echo " > cat $failed_reg_file"
|
283 |
|
|
done
|
284 |
|
|
echo ""
|
285 |
|
|
|
286 |
|
|
#----------------------------------------------------#
|
287 |
|
|
# Display summary report #
|
288 |
|
|
#----------------------------------------------------#
|
289 |
|
|
echo ""
|
290 |
|
|
echo "#=======================================================================================================================================================#"
|
291 |
|
|
echo "# SUMMARY REPORT #"
|
292 |
|
|
echo "#=======================================================================================================================================================#"
|
293 |
|
|
echo ""
|
294 |
|
|
|
295 |
|
|
# Generate final report
|
296 |
|
|
echo " +-----------------------------------"
|
297 |
|
|
echo " | Number of PASSED tests :${green_bold} $passed_nr ${normal}"
|
298 |
|
|
echo " | Number of SKIPPED tests :${green_bold} $skipped_nr ${normal}"
|
299 |
|
|
echo " | Number of FAILED tests :${red_bold} $failed_nr ${normal}"
|
300 |
|
|
echo " | Number of ABORTED tests :${red_bold} $aborted_nr ${normal}"
|
301 |
|
|
echo " |----------------------------------"
|
302 |
|
|
echo -n " | Number of tests : "
|
303 |
|
|
ls -1 $LOG_DIR/*/*.log | wc -l
|
304 |
|
|
echo " +----------------------------------"
|
305 |
|
|
echo ""
|
306 |
|
|
echo " Make sure passed+skipped == total"
|
307 |
|
|
echo ""
|
308 |
|
|
echo ""
|