|
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" |
12 | 9 | }
|
13 | 10 |
|
14 |
| -function error() { |
15 |
| - output ":bangbang: $* :bangbang:\n" |
| 11 | +function outfile() { |
| 12 | + if [ -f $1 ]; then |
| 13 | + cat "$1" >> "out-$logfile.md" |
| 14 | + else |
| 15 | + echo "File $1 not found!" >> error.txt |
| 16 | + fi |
16 | 17 | }
|
17 | 18 |
|
18 |
| -# this function generates the real summary |
19 |
| -# - expects a logfile "log" in current directory |
20 |
| -function generate() { |
21 |
| - # we issued some error already |
22 |
| - test ! -s log && return |
| 19 | +function send2github() { |
| 20 | + test -f "$1" && dd if="$1" bs=999k count=1 >> $GITHUB_STEP_SUMMARY |
| 21 | +} |
23 | 22 |
|
24 |
| - # for overview and zts-report |
25 |
| - cat log | grep '^Test' > list |
| 23 | +# generate summary of one test |
| 24 | +function generate() { |
| 25 | + test -f log || return |
| 26 | + |
| 27 | + ###################################################### |
| 28 | + # input: |
| 29 | + # - 3x log -> full debug output |
| 30 | + # - 3x results -> full list with summary in the end |
| 31 | + ###################################################### |
| 32 | + # output: |
| 33 | + # - info.txt -> short summary list (zts-report) |
| 34 | + # - list.txt -> full list, but without debugging |
| 35 | + # - debug.txt -> full list with debugging info |
| 36 | + ###################################################### |
| 37 | + |
| 38 | + cat log | grep '^Test[: ]' > list.txt |
| 39 | + ./zts-report.py --no-maybes ./list.txt > info.txt |
26 | 40 |
|
27 | 41 | # error details
|
28 | 42 | awk '/\[FAIL\]|\[KILLED\]/{ show=1; print; next; }
|
29 |
| - /\[SKIP\]|\[PASS\]/{ show=0; } show' log > err |
| 43 | + /\[SKIP\]|\[PASS\]/{ show=0; } show' log > debug.txt |
| 44 | + |
| 45 | + # headline of this summary |
| 46 | + output "\n## $headline\n" |
30 | 47 |
|
31 |
| - # summary of errors |
32 |
| - if [ -s err ]; then |
| 48 | + if [ -s uname.txt ]; then |
33 | 49 | output "<pre>"
|
34 |
| - $ZTS_REPORT --no-maybes ./list >> Summary.md |
| 50 | + outfile uname.txt |
35 | 51 | output "</pre>"
|
| 52 | + fi |
36 | 53 |
|
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 |
44 |
| - else |
45 |
| - output "All tests passed :thumbsup:" |
| 54 | + echo "VM disk usage before:" |
| 55 | + cat disk-before.txt |
| 56 | + echo "and afterwards:" |
| 57 | + cat disk-afterwards.txt |
| 58 | + |
| 59 | + if [ -s info.txt ]; then |
| 60 | + output "<details><summary>Summary of all tests</summary><pre>" |
| 61 | + outfile info.txt |
| 62 | + output "</pre></details>" |
46 | 63 | fi
|
47 | 64 |
|
48 |
| - output "<details><summary>Full Listing</summary><pre>" |
49 |
| - cat list >> Summary.md |
50 |
| - output "</pre></details>" |
| 65 | + if [ -s list.txt ]; then |
| 66 | + output "<details><summary>List of all tests</summary><pre>" |
| 67 | + outfile list.txt |
| 68 | + output "</pre></details>" |
| 69 | + fi |
| 70 | + |
| 71 | + for i in `seq 1 3`; do |
| 72 | + output "<details><summary>vm$i - serial console</summary><pre>" |
| 73 | + outfile vm$i/console.txt |
| 74 | + output "</pre></details>" |
| 75 | + |
| 76 | + output "<details><summary>vm$i - stderr of build</summary><pre>" |
| 77 | + outfile vm$i/build-stderr.txt |
| 78 | + output "</pre></details>" |
| 79 | + |
| 80 | + output "<details><summary>vm$i - dmesg prerun</summary><pre>" |
| 81 | + outfile vm$i/dmesg-prerun.txt |
| 82 | + output "</pre></details>" |
51 | 83 |
|
52 |
| - # remove tmp files |
53 |
| - rm -f err list log |
| 84 | + output "<details><summary>vm$i - dmesg module load</summary><pre>" |
| 85 | + outfile vm$i/dmesg-module-load.txt |
| 86 | + output "</pre></details>" |
| 87 | + done |
| 88 | + |
| 89 | + if [ -s error.txt ]; then |
| 90 | + output "<pre>" |
| 91 | + outfile error.txt |
| 92 | + output "</pre>" |
| 93 | + fi |
| 94 | + |
| 95 | + logfile=$((logfile+1)) |
54 | 96 | }
|
55 | 97 |
|
56 | 98 | # check tarfiles and untar
|
57 |
| -function check_tarfile() { |
| 99 | +function my_untar() { |
58 | 100 | if [ -f "$1" ]; then
|
59 |
| - tar xf "$1" || error "Tarfile $1 returns some error" |
60 |
| - else |
61 |
| - error "Tarfile $1 not found" |
| 101 | + tar xf "$1" || echo "Tarfile $1 returns some error" >> error.txt |
62 | 102 | fi
|
63 | 103 | }
|
64 | 104 |
|
65 |
| -# check logfile and concatenate test results |
66 |
| -function check_logfile() { |
67 |
| - if [ -f "$1" ]; then |
68 |
| - cat "$1" >> log |
| 105 | +# check file and copy |
| 106 | +function my_copy() { |
| 107 | + if [ -f $1 ]; then |
| 108 | + cat $1 >> $2 |
69 | 109 | else
|
70 |
| - error "Logfile $1 not found" |
| 110 | + echo "File $1 not found!" >> error.txt |
71 | 111 | fi
|
72 | 112 | }
|
73 | 113 |
|
74 |
| -# sanity |
75 |
| -function summarize_s() { |
76 |
| - headline="$1" |
77 |
| - output "\n## $headline\n" |
78 |
| - rm -rf testfiles |
79 |
| - check_tarfile "$2/sanity.tar" |
80 |
| - check_logfile "testfiles/log" |
81 |
| - generate |
82 |
| -} |
83 |
| - |
84 |
| -# functional |
85 |
| -function summarize_f() { |
86 |
| - headline="$1" |
87 |
| - output "\n## $headline\n" |
88 |
| - 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" |
| 114 | +# functional tests via qemu |
| 115 | +function summarize() { |
| 116 | + for tarfile in Logs-functional-*/qemu-*.tar; do |
| 117 | + rm -rf vm* *.txt log |
| 118 | + my_untar "$tarfile" |
| 119 | + osname=`cat osname.txt` |
| 120 | + headline="Functional Tests: $osname" |
| 121 | + my_copy "vm1/current/log" log |
| 122 | + my_copy "vm2/current/log" log |
| 123 | + my_copy "vm3/current/log" log |
| 124 | + generate |
93 | 125 | done
|
94 |
| - generate |
95 | 126 | }
|
96 | 127 |
|
97 | 128 | # https://docs.github.com/en/[email protected]/actions/using-workflows/workflow-commands-for-github-actions#step-isolation-and-limits
|
98 | 129 | # Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB.
|
99 | 130 | # [ ] can not show all error findings here
|
100 | 131 | # [x] split files into smaller ones and create additional steps
|
101 | 132 |
|
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 |
| 133 | +# first call, generate all summaries |
| 134 | +if [ ! -f out-0.md ]; then |
| 135 | + # create ./zts-report.py for generate() |
| 136 | + TEMPLATE="tests/test-runner/bin/zts-report.py.in" |
| 137 | + cat $TEMPLATE| sed -e 's|@PYTHON_SHEBANG@|python3|' > ./zts-report.py |
| 138 | + chmod +x ./zts-report.py |
| 139 | + |
| 140 | + logfile="0" |
| 141 | + summarize |
| 142 | + |
| 143 | + send2github out-0.md |
114 | 144 | 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 |
| 145 | + send2github out-$1.md |
117 | 146 | fi
|
118 | 147 |
|
119 | 148 | exit 0
|
0 commit comments