Skip to content

Commit 788b66f

Browse files
committed
ZTS: Use QEMU for tests on Linux and FreeBSD
This commit adds functional tests for these systems: - AlmaLinux 8, AlmaLinux 9 - ArchLinux - CentOS Stream 8, CentOS Stream 9 - Fedora 38, Fedora 39 - Debian 11, Debian 12 - FreeBSD 13, FreeBSD 14, FreeBSD 15 - Ubuntu 22.04, Ubuntu 24.04 Workflow for each operating system: - install QEMU on the github runner - download cloud image for this system - start and init that image via cloud-init - install deps, build openzfs, load the module - do the functional testings, hopefully < 5h Signed-off-by: Tino Reichardt <[email protected]>
1 parent 454c0b0 commit 788b66f

File tree

10 files changed

+704
-76
lines changed

10 files changed

+704
-76
lines changed
Lines changed: 119 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,179 @@
11
#!/usr/bin/env bash
22

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+
######################################################################
96

107
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
1217
}
1318

1419
function error() {
1520
output ":bangbang: $* :bangbang:\n"
1621
}
1722

18-
# this function generates the real summary
19-
# - expects a logfile "log" in current directory
23+
# generate summary of one test
2024
function generate() {
2125
# we issued some error already
2226
test ! -s log && return
2327

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
2646

2747
# error details
2848
awk '/\[FAIL\]|\[KILLED\]/{ show=1; print; next; }
29-
/\[SKIP\]|\[PASS\]/{ show=0; } show' log > err
49+
/\[SKIP\]|\[PASS\]/{ show=0; } show' log > debug.txt
3050

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
3355
output "<pre>"
34-
$ZTS_REPORT --no-maybes ./list >> Summary.md
56+
outfile uname.txt
3557
output "</pre>"
58+
fi
3659

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>"
4464
else
4565
output "All tests passed :thumbsup:"
4666
fi
4767

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
5197

5298
# remove tmp files
53-
rm -f err list log
99+
rm -f log results *.txt
100+
logfile=$((logfile+1))
54101
}
55102

56103
# check tarfiles and untar
57-
function check_tarfile() {
104+
function my_untar() {
58105
if [ -f "$1" ]; then
59106
tar xf "$1" || error "Tarfile $1 returns some error"
60107
else
61108
error "Tarfile $1 not found"
62109
fi
63110
}
64111

65-
# check logfile and concatenate test results
66-
function check_logfile() {
112+
# check file and copy
113+
function my_copy() {
67114
if [ -f "$1" ]; then
68-
cat "$1" >> log
115+
cat "$1" >> "$2"
69116
else
70-
error "Logfile $1 not found"
117+
error "File $1 not found"
71118
fi
72119
}
73120

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"
78124
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
81127
generate
82128
}
83129

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"
88133
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
93138
done
94139
generate
95140
}
96141

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+
97155
# https://docs.github.com/en/[email protected]/actions/using-workflows/workflow-commands-for-github-actions#step-isolation-and-limits
98156
# Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB.
99157
# [ ] can not show all error findings here
100158
# [x] split files into smaller ones and create additional steps
101159

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
114175
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
117177
fi
118178

119179
exit 0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
######################################################################
4+
# 1) setup the action runner to start some qemu instance
5+
######################################################################
6+
7+
set -eu
8+
9+
# docker isn't needed, free some memory
10+
sudo systemctl stop docker.socket
11+
sudo apt-get remove docker-ce-cli docker-ce podman
12+
13+
# remove snapd, not needed
14+
for x in lxd core20 snapd; do sudo snap remove $x; done
15+
sudo apt-get remove google-chrome-stable firefox snapd
16+
17+
# only install qemu
18+
sudo apt-get update
19+
sudo apt-get install axel cloud-image-utils guestfs-tools virt-manager
20+
21+
# no swap needed
22+
sudo swapoff -a
23+
24+
# disk usage afterwards
25+
sudo df -h /
26+
sudo df -h /mnt
27+
sudo fstrim -a
28+
29+
# generate ssh keys
30+
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N ""

0 commit comments

Comments
 (0)