Skip to content

Commit 07ee907

Browse files
mcmilktonyhutter
andcommitted
ZTS: Use QEMU for tests on Linux and FreeBSD
This commit adds functional tests for these systems: - AlmaLinux 8, AlmaLinux 9 - ArchLinux - CentOS Stream 9 - Fedora 39, Fedora 40 - 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 current cloud image - start and init that image via cloud-init - install deps and poweroff system - start system and build openzfs and then poweroff again - clone the system and start 3 qemu machines for tests - use trimable virtual disks (3x 2GB) - do the functional testings in < 3h Signed-off-by: Tino Reichardt <[email protected]> Co-authored-by: Tony Hutter <[email protected]>
1 parent c98295e commit 07ee907

18 files changed

+1079
-381
lines changed

.github/workflows/checkstyle.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
checkstyle:
99
runs-on: ubuntu-22.04
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v3
1212
with:
1313
ref: ${{ github.event.pull_request.head.sha }}
1414
- name: Install dependencies
@@ -52,7 +52,7 @@ jobs:
5252
if: failure() && steps.CheckABI.outcome == 'failure'
5353
run: |
5454
find -name *.abi | tar -cf abi_files.tar -T -
55-
- uses: actions/upload-artifact@v4
55+
- uses: actions/upload-artifact@v3
5656
if: failure() && steps.CheckABI.outcome == 'failure'
5757
with:
5858
name: New ABI files (use only if you're sure about interface changes)

.github/workflows/codeql.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ jobs:
2424
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
2525
2626
- name: Checkout repository
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v3
2828

2929
- name: Initialize CodeQL
3030
uses: github/codeql-action/init@v2
3131
with:
32-
config-file: .github/codeql-${{ matrix.language }}.yml
3332
languages: ${{ matrix.language }}
3433

3534
- name: Autobuild

.github/workflows/scripts/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
Workflow for each operating system:
3+
- install QEMU on the github runner
4+
- download current cloud image
5+
- start and init that image via cloud-init
6+
- install deps and poweroff system
7+
- start system and build openzfs and then poweroff again
8+
- clone the system and start 4 qemu workers for the testings (4x 3GB RAM)
9+
- use trimable virtual disks (3x 1GB) for each testing system
10+
- do the functional testings < 2h for each os
Lines changed: 106 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,148 @@
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"
129
}
1310

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
1617
}
1718

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+
}
2322

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
2640

2741
# error details
2842
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"
3047

31-
# summary of errors
32-
if [ -s err ]; then
48+
if [ -s uname.txt ]; then
3349
output "<pre>"
34-
$ZTS_REPORT --no-maybes ./list >> Summary.md
50+
outfile uname.txt
3551
output "</pre>"
52+
fi
3653

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>"
4663
fi
4764

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>"
5183

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))
5496
}
5597

5698
# check tarfiles and untar
57-
function check_tarfile() {
99+
function my_untar() {
58100
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
62102
fi
63103
}
64104

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
69109
else
70-
error "Logfile $1 not found"
110+
echo "File $1 not found!" >> error.txt
71111
fi
72112
}
73113

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
93125
done
94-
generate
95126
}
96127

97128
# https://docs.github.com/en/[email protected]/actions/using-workflows/workflow-commands-for-github-actions#step-isolation-and-limits
98129
# Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB.
99130
# [ ] can not show all error findings here
100131
# [x] split files into smaller ones and create additional steps
101132

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
114144
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
117146
fi
118147

119148
exit 0
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 unneeded things
14+
sudo apt-get remove google-chrome-stable snapd
15+
16+
# only install qemu
17+
sudo apt-get update
18+
sudo apt-get install \
19+
axel cloud-image-utils daemonize guestfs-tools virt-manager \
20+
linux-modules-extra-`uname -r`
21+
22+
# disk usage afterwards
23+
sudo df -h /
24+
sudo df -h /mnt
25+
sudo fstrim -a
26+
27+
# generate ssh keys
28+
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N ""

0 commit comments

Comments
 (0)