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, write to the Free Software Foundation,
18 # Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
20 # This file was written by Jacob Bachmeyer.
23 # #Usage: dejagnu report card [ OPTION | TOOL | FILE ]...
24 # #Usage: dejagnu report-card [ OPTION | TOOL | FILE ]...
25 # # --verbose, -v Emit additional messages
28 # Arrays storing lists in this program store items in numbered keys, with a
29 # count in the "C" key, similar to Awk's ARGV/ARGC.
31 # The Tools array stores a list of tools in 1..N.
33 # The Passes array stores a global list of passes seen, a per-tool list of
34 # passes seen, and a global index of passes seen if DejaGnu's multipass
37 # "" -- global list: 1..N; "C"
38 # "t", <tool> -- per-tool list: 1..N; "C"
40 # "p", <pass> -- count of tools using <pass>
42 # The Totals array stores counts of test results, indexed by tool and pass.
43 # A summarization step adds per-tool, per-pass, and grand totals.
45 # "tp", <Tool>, <Pass>, <result>
46 # "t", <Tool>, <result>
47 # "p", <Pass>, <result>
51 ## Get list of files to scan
59 # remove arguments from ARGV
60 for (i =
1; i
< ARGC; i
++) {
62 if (ARGV[i
] ~
/^
--?v
(erb.
*)?$
/)
64 else if (ARGV[i
] ==
"--")
71 if (Verbose
) print "Verbose level is "Verbose
72 # adjust filenames in ARGV
74 for (i =
1; i
< ARGC; i
++) {
75 if (i in
ARGV) FileCount
++
77 if (ARGV[i
] ~
/\.sum$
/) continue
78 else if (ARGV[i
] ~
/\.log$
/) sub(/\.log$
/, ".sum", ARGV[i
])
79 else if (ARGV[i
] ~
/\.$
/) sub(/\.$
/, ".sum", ARGV[i
])
80 else ARGV[i
] =
(ARGV[i
]".sum")
83 cmd_ls_files =
"ls -1 *.sum"
84 while (cmd_ls_files
| getline File
) {
91 print "Reading "FileCount
" file(s)"
92 for (i =
1; i
< ARGC; i
++)
99 ## Read files and collect data
103 print "Reading `"FILENAME"' ..."
105 Tool = File =
FILENAME
106 sub(/\.sum$
/, "", Tool
)
107 if (length(Tool
) > ToolWidth
)
108 ToolWidth =
length(Tool
)
109 Tools
[Tools
["C"]++] = Tool
110 Passes
["t", Tool
, "C"] =
1
111 Passes
["t", Tool
, 1] =
"" # will be overwritten if multipass is used
114 /^Running pass `
[^
']*' ...
/ {
118 if (("p", Pass) in Passes)
121 if (length(Pass) > PassWidth)
122 PassWidth = length(Pass)
123 Passes["", Passes["", "C"]++] = Pass
124 Passes["p", Pass] = 1
126 Passes["t", Tool, Passes["t", Tool, "C"]++] = Pass
129 $1 ~ /:$/ { sub(/:$/, "", $1); Totals["tp", Tool, Pass, $1]++ }
135 $0 = ("PASS FAIL KPASS KFAIL XPASS XFAIL UNSUPPORTED UNRESOLVED UNTESTED")
136 for (i = 1; i in Tools; i++)
137 for (j = 1; ("t", Tools[i], j) in Passes; j++)
138 for (k = 1; k <= NF; k++) {
140 += Totals["tp", Tools[i], Passes["t", Tools[i], j], $k]
141 Totals["t", Tools[i], $k] \
142 += Totals["tp", Tools[i], Passes["t", Tools[i], j], $k]
143 Totals["p", Passes["t", Tools[i], j], $k] \
144 += Totals["tp", Tools[i], Passes["t", Tools[i], j], $k]
149 ## Compute total name column width
152 if (Passes["", "C"] > 1)
153 NameWidth = ToolWidth + 3 + PassWidth
155 NameWidth = ToolWidth
162 printf "%*s __________________________________________________\n", \
164 printf "%*s / %6s %6s %6s %6s %6s %6s %6s\n", NameWidth, "", \
165 "PASS", "FAIL", "?PASS", "?FAIL", "UNSUP", "UNRES", "UNTEST"
166 printf "%*s |--------------------------------------------------\n", \
174 for (i = 1; i in Tools; i++) {
176 for (j = 1; ("t", Tool, j) in Passes; j++) {
177 Pass = Passes["t", Tool, j]
178 if (Passes["t", Tool, "C"] > 1)
179 printf "%*s / %-*s | ", ToolWidth, Tool, PassWidth, Pass
180 else if (Passes["", "C"] > 1)
181 printf "%*s %*s | ", ToolWidth, Tool, PassWidth, ""
183 printf "%*s | ", NameWidth, Tool
184 # Passes["t", <tool>, 1] is a pass name or a null string if
185 # <tool> did not use multipass.
186 printf " %6d %6d %6d %6d %6d %6d %6d%s%s\n", \
187 Totals["tp", Tool, Pass, "PASS"], \
188 Totals["tp", Tool, Pass, "FAIL"], \
189 Totals["tp", Tool, Pass, "KPASS"] \
190 + Totals["tp", Tool, Pass, "XPASS"], \
191 Totals["tp", Tool, Pass, "KFAIL"] \
192 + Totals["tp", Tool, Pass, "XFAIL"], \
193 Totals["tp", Tool, Pass, "UNSUPPORTED"], \
194 Totals["tp", Tool, Pass, "UNRESOLVED"], \
195 Totals["tp", Tool, Pass, "UNTESTED"], \
196 (Totals["tp", Tool, Pass, "ERROR" ] > 0 ? " !E!" : ""), \
197 (Totals["tp", Tool, Pass, "WARNING"] > 0 ? " !W!" : "")
206 if (Passes["", "C"] > 1) {
207 printf "%*s |--------------------------------------------------\n", \
209 for (i = 1; ("", i) in Passes; i++)
210 printf "%*s %-*s | %6d %6d %6d %6d %6d %6d %6d\n", \
211 ToolWidth, "", PassWidth, Passes["", i], \
212 Totals["p", Passes["", i], "PASS"], \
213 Totals["p", Passes["", i], "FAIL"], \
214 Totals["p", Passes["", i], "KPASS"] \
215 + Totals["p", Passes["", i], "XPASS"], \
216 Totals["p", Passes["", i], "KFAIL"] \
217 + Totals["p", Passes["", i], "XFAIL"], \
218 Totals["p", Passes["", i], "UNSUPPORTED"], \
219 Totals["p", Passes["", i], "UNRESOLVED"], \
220 Totals["p", Passes["", i], "UNTESTED"]
228 printf "%*s |--------------------------------------------------\n", \
230 printf "%*s | %6d %6d %6d %6d %6d %6d %6d\n", NameWidth, "", \
231 Totals["PASS"], Totals["FAIL"], \
232 Totals["KPASS"] + Totals["XPASS"], Totals["KFAIL"] + Totals["XFAIL"], \
233 Totals["UNSUPPORTED"], Totals["UNRESOLVED"], Totals["UNTESTED"]
234 printf "%*s \\__________________________________________________\n", \