1 # report-card.awk -- Test summary tool
2 # Copyright (C) 2018, 2021 Free Software Foundation, Inc.
4 # This file is part of DejaGnu.
6 # DejaGnu is free software: you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # DejaGnu is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with DejaGnu. If not, see <http://www.gnu.org/licenses/>.
19 # This file was written by Jacob Bachmeyer.
22 # #Usage: dejagnu report card [ OPTION | TOOL | FILE ]...
23 # #Usage: dejagnu report-card [ OPTION | TOOL | FILE ]...
24 # # --verbose, -v Emit additional messages
27 # Arrays storing lists in this program store items in numbered keys, with a
28 # count in the "C" key, similar to Awk's ARGV/ARGC.
30 # The Tools array stores a list of tools in 1..N.
32 # The Passes array stores a global list of passes seen, a per-tool list of
33 # passes seen, and a global index of passes seen if DejaGnu's multipass
36 # "" -- global list: 1..N; "C"
37 # "t", <tool> -- per-tool list: 1..N; "C"
39 # "p", <pass> -- count of tools using <pass>
41 # The Totals array stores counts of test results, indexed by tool and pass.
42 # A summarization step adds per-tool, per-pass, and grand totals.
44 # "tp", <Tool>, <Pass>, <result>
45 # "t", <Tool>, <result>
46 # "p", <Pass>, <result>
50 ## Get list of files to scan
58 # remove arguments from ARGV
59 for (i =
1; i
< ARGC; i
++) {
61 if (ARGV[i
] ~
/^
--?v
(erb.
*)?$
/)
63 else if (ARGV[i
] ==
"--")
70 if (Verbose
) print "Verbose level is "Verbose
71 # adjust filenames in ARGV
73 for (i =
1; i
< ARGC; i
++) {
74 if (i in
ARGV) FileCount
++
76 if (ARGV[i
] ~
/\.sum$
/) continue
77 else if (ARGV[i
] ~
/\.log$
/) sub(/\.log$
/, ".sum", ARGV[i
])
78 else if (ARGV[i
] ~
/\.$
/) sub(/\.$
/, ".sum", ARGV[i
])
79 else ARGV[i
] =
(ARGV[i
]".sum")
82 cmd_ls_files =
"ls -1 *.sum"
83 while (cmd_ls_files
| getline File
) {
90 print "Reading "FileCount
" file(s)"
91 for (i =
1; i
< ARGC; i
++)
98 ## Read files and collect data
102 print "Reading `"FILENAME"' ..."
104 Tool = File =
FILENAME
105 sub(/\.sum$
/, "", Tool
)
106 if (length(Tool
) > ToolWidth
)
107 ToolWidth =
length(Tool
)
108 Tools
[Tools
["C"]++] = Tool
109 Passes
["t", Tool
, "C"] =
1
110 Passes
["t", Tool
, 1] =
"" # will be overwritten if multipass is used
113 /^Running pass `
[^
']*' ...
/ {
117 if (("p", Pass) in Passes)
120 if (length(Pass) > PassWidth)
121 PassWidth = length(Pass)
122 Passes["", Passes["", "C"]++] = Pass
123 Passes["p", Pass] = 1
125 Passes["t", Tool, Passes["t", Tool, "C"]++] = Pass
128 $1 ~ /:$/ { sub(/:$/, "", $1); Totals["tp", Tool, Pass, $1]++ }
134 $0 = ("PASS FAIL KPASS KFAIL XPASS XFAIL UNSUPPORTED UNRESOLVED UNTESTED")
135 for (i = 1; i in Tools; i++)
136 for (j = 1; ("t", Tools[i], j) in Passes; j++)
137 for (k = 1; k <= NF; k++) {
139 += Totals["tp", Tools[i], Passes["t", Tools[i], j], $k]
140 Totals["t", Tools[i], $k] \
141 += Totals["tp", Tools[i], Passes["t", Tools[i], j], $k]
142 Totals["p", Passes["t", Tools[i], j], $k] \
143 += Totals["tp", Tools[i], Passes["t", Tools[i], j], $k]
148 ## Compute total name column width
151 if (Passes["", "C"] > 1)
152 NameWidth = ToolWidth + 3 + PassWidth
154 NameWidth = ToolWidth
161 printf "%*s __________________________________________________\n", \
163 printf "%*s / %6s %6s %6s %6s %6s %6s %6s\n", NameWidth, "", \
164 "PASS", "FAIL", "?PASS", "?FAIL", "UNSUP", "UNRES", "UNTEST"
165 printf "%*s |--------------------------------------------------\n", \
173 for (i = 1; i in Tools; i++) {
175 for (j = 1; ("t", Tool, j) in Passes; j++) {
176 Pass = Passes["t", Tool, j]
177 if (Passes["t", Tool, "C"] > 1)
178 printf "%*s / %-*s | ", ToolWidth, Tool, PassWidth, Pass
179 else if (Passes["", "C"] > 1)
180 printf "%*s %*s | ", ToolWidth, Tool, PassWidth, ""
182 printf "%*s | ", NameWidth, Tool
183 # Passes["t", <tool>, 1] is a pass name or a null string if
184 # <tool> did not use multipass.
185 printf " %6d %6d %6d %6d %6d %6d %6d%s%s\n", \
186 Totals["tp", Tool, Pass, "PASS"], \
187 Totals["tp", Tool, Pass, "FAIL"], \
188 Totals["tp", Tool, Pass, "KPASS"] \
189 + Totals["tp", Tool, Pass, "XPASS"], \
190 Totals["tp", Tool, Pass, "KFAIL"] \
191 + Totals["tp", Tool, Pass, "XFAIL"], \
192 Totals["tp", Tool, Pass, "UNSUPPORTED"], \
193 Totals["tp", Tool, Pass, "UNRESOLVED"], \
194 Totals["tp", Tool, Pass, "UNTESTED"], \
195 (Totals["tp", Tool, Pass, "ERROR" ] > 0 ? " !E!" : ""), \
196 (Totals["tp", Tool, Pass, "WARNING"] > 0 ? " !W!" : "")
205 if (Passes["", "C"] > 1) {
206 printf "%*s |--------------------------------------------------\n", \
208 for (i = 1; ("", i) in Passes; i++)
209 printf "%*s %-*s | %6d %6d %6d %6d %6d %6d %6d\n", \
210 ToolWidth, "", PassWidth, Passes["", i], \
211 Totals["p", Passes["", i], "PASS"], \
212 Totals["p", Passes["", i], "FAIL"], \
213 Totals["p", Passes["", i], "KPASS"] \
214 + Totals["p", Passes["", i], "XPASS"], \
215 Totals["p", Passes["", i], "KFAIL"] \
216 + Totals["p", Passes["", i], "XFAIL"], \
217 Totals["p", Passes["", i], "UNSUPPORTED"], \
218 Totals["p", Passes["", i], "UNRESOLVED"], \
219 Totals["p", Passes["", i], "UNTESTED"]
227 printf "%*s |--------------------------------------------------\n", \
229 printf "%*s | %6d %6d %6d %6d %6d %6d %6d\n", NameWidth, "", \
230 Totals["PASS"], Totals["FAIL"], \
231 Totals["KPASS"] + Totals["XPASS"], Totals["KFAIL"] + Totals["XFAIL"], \
232 Totals["UNSUPPORTED"], Totals["UNRESOLVED"], Totals["UNTESTED"]
233 printf "%*s \\__________________________________________________\n", \