|
1 | 1 | #!/usr/bin/env bash
|
2 | 2 |
|
3 |
| -# for runtime reasons we split functional testings into N parts |
4 |
| -# - use a define to check for missing tarfiles |
5 |
| -FUNCTIONAL_PARTS="4" |
6 |
| - |
7 |
| -ZTS_REPORT="tests/test-runner/bin/zts-report.py" |
8 |
| -chmod +x $ZTS_REPORT |
| 3 | +###################################################################### |
| 4 | +# generate github summary page of all the testings |
| 5 | +###################################################################### |
9 | 6 |
|
10 | 7 | function output() {
|
11 |
| - echo -e $* >> Summary.md |
| 8 | + echo -e $* >> "out-$logfile.md" |
| 9 | +} |
| 10 | + |
| 11 | +function outfile() { |
| 12 | + cat "$1" >> "out-$logfile.md" |
| 13 | +} |
| 14 | + |
| 15 | +function send2github() { |
| 16 | + test -f "$1" && dd if="$1" bs=999k count=1 >> $GITHUB_STEP_SUMMARY |
12 | 17 | }
|
13 | 18 |
|
14 | 19 | function error() {
|
15 | 20 | output ":bangbang: $* :bangbang:\n"
|
16 | 21 | }
|
17 | 22 |
|
18 |
| -# this function generates the real summary |
19 |
| -# - expects a logfile "log" in current directory |
| 23 | +# generate summary of one test |
20 | 24 | function generate() {
|
21 | 25 | # we issued some error already
|
22 | 26 | test ! -s log && return
|
23 | 27 |
|
24 |
| - # for overview and zts-report |
25 |
| - cat log | grep '^Test' > list |
| 28 | + ###################################################### |
| 29 | + # input: |
| 30 | + # - log -> full debug output |
| 31 | + # - results -> full list with summary in the end |
| 32 | + ###################################################### |
| 33 | + # output: |
| 34 | + # - info.txt -> short summary list (zts-report) |
| 35 | + # - list.txt -> full list, but without debugging |
| 36 | + # - debug.txt -> full list with debugging info |
| 37 | + ###################################################### |
| 38 | + |
| 39 | + if [ -s results ]; then |
| 40 | + cat results | grep '^Test[: ]' > list.txt |
| 41 | + cat results | grep -v '^Test[: ]' > info.txt |
| 42 | + else |
| 43 | + cat log | grep '^Test[: ]' > list.txt |
| 44 | + ./zts-report.py --no-maybes ./list.txt > info.txt |
| 45 | + fi |
26 | 46 |
|
27 | 47 | # error details
|
28 | 48 | awk '/\[FAIL\]|\[KILLED\]/{ show=1; print; next; }
|
29 |
| - /\[SKIP\]|\[PASS\]/{ show=0; } show' log > err |
| 49 | + /\[SKIP\]|\[PASS\]/{ show=0; } show' log > debug.txt |
30 | 50 |
|
31 |
| - # summary of errors |
32 |
| - if [ -s err ]; then |
| 51 | + # headline of this summary |
| 52 | + output "\n## $headline\n" |
| 53 | + |
| 54 | + if [ -s uname.txt ]; then |
33 | 55 | output "<pre>"
|
34 |
| - $ZTS_REPORT --no-maybes ./list >> Summary.md |
| 56 | + outfile uname.txt |
35 | 57 | output "</pre>"
|
| 58 | + fi |
36 | 59 |
|
37 |
| - # generate seperate error logfile |
38 |
| - ERRLOGS=$((ERRLOGS+1)) |
39 |
| - errfile="err-$ERRLOGS.md" |
40 |
| - echo -e "\n## $headline (debugging)\n" >> $errfile |
41 |
| - echo "<details><summary>Error Listing - with dmesg and dbgmsg</summary><pre>" >> $errfile |
42 |
| - dd if=err bs=999k count=1 >> $errfile |
43 |
| - echo "</pre></details>" >> $errfile |
| 60 | + if [ -s info.txt ]; then |
| 61 | + output "<pre>" |
| 62 | + outfile info.txt |
| 63 | + output "</pre>" |
44 | 64 | else
|
45 | 65 | output "All tests passed :thumbsup:"
|
46 | 66 | fi
|
47 | 67 |
|
48 |
| - output "<details><summary>Full Listing</summary><pre>" |
49 |
| - cat list >> Summary.md |
50 |
| - output "</pre></details>" |
| 68 | + if [ -s dmesg-prerun.txt ]; then |
| 69 | + output "<details><summary>Dmesg - systemstart</summary><pre>" |
| 70 | + outfile dmesg-prerun.txt |
| 71 | + output "</pre></details>" |
| 72 | + fi |
| 73 | + |
| 74 | + if [ -s dmesg-module-load.txt ]; then |
| 75 | + output "<details><summary>Dmesg - module loading</summary><pre>" |
| 76 | + outfile dmesg-module-load.txt |
| 77 | + output "</pre></details>" |
| 78 | + fi |
| 79 | + |
| 80 | + if [ -s make-stderr.txt ]; then |
| 81 | + output "<details><summary>Stderr of make</summary><pre>" |
| 82 | + outfile make-stderr.txt |
| 83 | + output "</pre></details>" |
| 84 | + fi |
| 85 | + |
| 86 | + if [ -s list.txt ]; then |
| 87 | + output "<details><summary>List of all tests</summary><pre>" |
| 88 | + outfile list.txt |
| 89 | + output "</pre></details>" |
| 90 | + fi |
| 91 | + |
| 92 | + if [ -s debug.txt ]; then |
| 93 | + output "<details><summary>Debug list with dmesg and dbgmsg</summary><pre>" |
| 94 | + outfile debug.txt |
| 95 | + output "</pre></details>" |
| 96 | + fi |
51 | 97 |
|
52 | 98 | # remove tmp files
|
53 |
| - rm -f err list log |
| 99 | + rm -f log results *.txt |
| 100 | + logfile=$((logfile+1)) |
54 | 101 | }
|
55 | 102 |
|
56 | 103 | # check tarfiles and untar
|
57 |
| -function check_tarfile() { |
| 104 | +function my_untar() { |
58 | 105 | if [ -f "$1" ]; then
|
59 | 106 | tar xf "$1" || error "Tarfile $1 returns some error"
|
60 | 107 | else
|
61 | 108 | error "Tarfile $1 not found"
|
62 | 109 | fi
|
63 | 110 | }
|
64 | 111 |
|
65 |
| -# check logfile and concatenate test results |
66 |
| -function check_logfile() { |
| 112 | +# check file and copy |
| 113 | +function my_copy() { |
67 | 114 | if [ -f "$1" ]; then
|
68 |
| - cat "$1" >> log |
| 115 | + cat "$1" >> "$2" |
69 | 116 | else
|
70 |
| - error "Logfile $1 not found" |
| 117 | + error "File $1 not found" |
71 | 118 | fi
|
72 | 119 | }
|
73 | 120 |
|
74 |
| -# sanity |
75 |
| -function summarize_s() { |
76 |
| - headline="$1" |
77 |
| - output "\n## $headline\n" |
| 121 | +# sanity checks on ubuntu runner |
| 122 | +function summarize_sanity() { |
| 123 | + headline="Sanity Tests Ubuntu $1" |
78 | 124 | rm -rf testfiles
|
79 |
| - check_tarfile "$2/sanity.tar" |
80 |
| - check_logfile "testfiles/log" |
| 125 | + my_untar "Logs-$1-sanity/sanity.tar" |
| 126 | + my_copy "testfiles/log" log |
81 | 127 | generate
|
82 | 128 | }
|
83 | 129 |
|
84 |
| -# functional |
85 |
| -function summarize_f() { |
86 |
| - headline="$1" |
87 |
| - output "\n## $headline\n" |
| 130 | +# functional on ubuntu runner matrix |
| 131 | +function summarize_functional() { |
| 132 | + headline="Functional Tests Ubuntu $1" |
88 | 133 | rm -rf testfiles
|
89 |
| - for i in $(seq 1 $FUNCTIONAL_PARTS); do |
90 |
| - tarfile="$2-part$i/part$i.tar" |
91 |
| - check_tarfile "$tarfile" |
92 |
| - check_logfile "testfiles/log" |
| 134 | + for i in $(seq 1 4); do |
| 135 | + tarfile="Logs-$1-functional-part$i/part$i.tar" |
| 136 | + my_untar "$tarfile" |
| 137 | + my_copy "testfiles/log" log |
93 | 138 | done
|
94 | 139 | generate
|
95 | 140 | }
|
96 | 141 |
|
| 142 | +# functional tests via qemu |
| 143 | +function summarize_qemu() { |
| 144 | + for tarfile in Logs-functional*/qemu-*.tar; do |
| 145 | + rm -rf current |
| 146 | + my_untar "$tarfile" |
| 147 | + osname=`cat osname.txt` |
| 148 | + headline="Functional Tests: $osname" |
| 149 | + my_copy "current/log" log |
| 150 | + my_copy "current/results" results |
| 151 | + generate |
| 152 | + done |
| 153 | +} |
| 154 | + |
97 | 155 | # https://docs.github.com/en/[email protected]/actions/using-workflows/workflow-commands-for-github-actions#step-isolation-and-limits
|
98 | 156 | # Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB.
|
99 | 157 | # [ ] can not show all error findings here
|
100 | 158 | # [x] split files into smaller ones and create additional steps
|
101 | 159 |
|
102 |
| -ERRLOGS=0 |
103 |
| -if [ ! -f Summary/Summary.md ]; then |
104 |
| - # first call, we do the default summary (~500k) |
105 |
| - echo -n > Summary.md |
106 |
| - summarize_s "Sanity Tests Ubuntu 20.04" Logs-20.04-sanity |
107 |
| - summarize_s "Sanity Tests Ubuntu 22.04" Logs-22.04-sanity |
108 |
| - summarize_f "Functional Tests Ubuntu 20.04" Logs-20.04-functional |
109 |
| - summarize_f "Functional Tests Ubuntu 22.04" Logs-22.04-functional |
110 |
| - |
111 |
| - cat Summary.md >> $GITHUB_STEP_SUMMARY |
112 |
| - mkdir -p Summary |
113 |
| - mv *.md Summary |
| 160 | +# first call, generate all summaries |
| 161 | +if [ ! -f out-0.md ]; then |
| 162 | + # create ./zts-report.py for generate() |
| 163 | + TEMPLATE="tests/test-runner/bin/zts-report.py.in" |
| 164 | + cat $TEMPLATE| sed -e 's|@PYTHON_SHEBANG@|python3|' > ./zts-report.py |
| 165 | + chmod +x ./zts-report.py |
| 166 | + |
| 167 | + logfile="0" |
| 168 | + summarize_sanity "20.04" |
| 169 | + summarize_sanity "22.04" |
| 170 | + summarize_functional "20.04" |
| 171 | + summarize_functional "22.04" |
| 172 | + summarize_qemu |
| 173 | + |
| 174 | + send2github out-0.md |
114 | 175 | else
|
115 |
| - # here we get, when errors where returned in first call |
116 |
| - test -f Summary/err-$1.md && cat Summary/err-$1.md >> $GITHUB_STEP_SUMMARY |
| 176 | + send2github out-$1.md |
117 | 177 | fi
|
118 | 178 |
|
119 | 179 | exit 0
|
0 commit comments