Fix dependency install on Debian 11 (#16683)
[zfs.git] / .github / workflows / scripts / merge_summary.awk
blob2b00d00226c9eba4f5b48f27334057e8d7918c7a
1 #!/bin/awk -f
3 # Merge multiple ZTS tests results summaries into a single summary. This is
4 # needed when you're running different parts of ZTS on different tests
5 # runners or VMs.
7 # Usage:
9 # ./merge_summary.awk summary1.txt [summary2.txt] [summary3.txt] ...
11 # or:
13 # cat summary*.txt | ./merge_summary.awk
15 BEGIN {
16 i=-1
17 pass=0
18 fail=0
19 skip=0
20 state=""
21 cl=0
22 el=0
23 upl=0
24 ul=0
26 # Total seconds of tests runtime
27 total=0;
30 # Skip empty lines
31 /^\s*$/{next}
33 # Skip Configuration and Test lines
34 /^Test:/{state=""; next}
35 /Configuration/{state="";next}
37 # When we see "test-runner.py" stop saving config lines, and
38 # save test runner lines
39 /test-runner.py/{state="testrunner"; runner=runner$0"\n"; next}
41 # We need to differentiate the PASS counts from test result lines that start
42 # with PASS, like:
44 # PASS mv_files/setup
46 # Use state="pass_count" to differentiate
48 /Results Summary/{state="pass_count"; next}
49 /PASS/{ if (state=="pass_count") {pass += $2}}
50 /FAIL/{ if (state=="pass_count") {fail += $2}}
51 /SKIP/{ if (state=="pass_count") {skip += $2}}
52 /Running Time/{
53 state="";
54 running[i]=$3;
55 split($3, arr, ":")
56 total += arr[1] * 60 * 60;
57 total += arr[2] * 60;
58 total += arr[3]
59 next;
62 /Tests with results other than PASS that are expected/{state="expected_lines"; next}
63 /Tests with result of PASS that are unexpected/{state="unexpected_pass_lines"; next}
64 /Tests with results other than PASS that are unexpected/{state="unexpected_lines"; next}
66 if (state == "expected_lines") {
67 expected_lines[el] = $0
68 el++
71 if (state == "unexpected_pass_lines") {
72 unexpected_pass_lines[upl] = $0
73 upl++
75 if (state == "unexpected_lines") {
76 unexpected_lines[ul] = $0
77 ul++
81 # Reproduce summary
82 END {
83 print runner;
84 print "\nResults Summary"
85 print "PASS\t"pass
86 print "FAIL\t"fail
87 print "SKIP\t"skip
88 print ""
89 print "Running Time:\t"strftime("%T", total, 1)
90 if (pass+fail+skip > 0) {
91 percent_passed=(pass/(pass+fail+skip) * 100)
93 printf "Percent passed:\t%3.2f%", percent_passed
95 print "\n\nTests with results other than PASS that are expected:"
96 asort(expected_lines, sorted)
97 for (j in sorted)
98 print sorted[j]
100 print "\n\nTests with result of PASS that are unexpected:"
101 asort(unexpected_pass_lines, sorted)
102 for (j in sorted)
103 print sorted[j]
105 print "\n\nTests with results other than PASS that are unexpected:"
106 asort(unexpected_lines, sorted)
107 for (j in sorted)
108 print sorted[j]