# scripts/lib/timing-extract.awk # Extract per-test durations from bats JUnit report XML. # # Emits TSV: "\t\t" for each . # The caller sorts and renders. Handles testcase elements that span the line # regardless of whether they are self-closing or contain children. function attr(line, key, re, s) { re = key "=\"" if (index(line, re) == 0) return "" s = line sub(".*" re, "", s) # drop up to opening quote sub(/".*/, "", s) # drop from closing quote return s } function unesc(s) { gsub(/"/, "\"", s) gsub(/'/, "'", s) gsub(/</, "<", s) gsub(/>/, ">", s) gsub(/&/, "\\&", s) return s } /