with parse_stats.awk
This commit is contained in:
33
parse_stats.awk
Executable file
33
parse_stats.awk
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
BEGIN {
|
||||||
|
total = 0
|
||||||
|
passed = 0
|
||||||
|
failed = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/^┌───────────────┬──────────────────────────┐$/ {
|
||||||
|
in_table = 1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
in_table && /^│ Requests[[:space:]]+│/ {
|
||||||
|
if (match($0, /[0-9]+ \([0-9]+ Passed, [0-9]+ Failed\)/)) {
|
||||||
|
s = substr($0, RSTART, RLENGTH)
|
||||||
|
gsub(/[()]/, "", s)
|
||||||
|
split(s, parts, /[[:space:],]+/)
|
||||||
|
total = parts[1]
|
||||||
|
passed = parts[2]
|
||||||
|
failed = parts[4]
|
||||||
|
in_table = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
in_table && /^└───────────────┴──────────────────────────┘$/ {
|
||||||
|
in_table = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
END {
|
||||||
|
if (total == 0) {
|
||||||
|
print "WARNING: Could not parse stats from logs.txt" > "/dev/stderr"
|
||||||
|
}
|
||||||
|
printf "Total=%d, Passed=%d, Failed=%d\n", total, passed, failed
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user