Skip to content

Commit b7bc334

Browse files
authored
Split functional testings via github action matrix
This commit changes the workflow of the github actions. We split the workflow into different parts: 1) build zfs modules for Ubuntu 20.04 and 22.04 (~25m) 2) 2x zloop test (~10m) + 2x sanity test (~25m) 3) functional testings in parts 1..5 (each ~1h) - these could be triggered, when sanity tests are ok - currently I just start them all in the same time 4) cleanup and create summary When everything is fine, the full run with all testings should be done in around 2 hours. The codeql.yml and checkstyle.yml are not part in this circle. The testings are also modified a bit: - report info about CPU and checksum benchmarks - reset the debugging logs for each test - when some error occurred, we call dmesg with -c to get only the log output for the last failed test - we empty also the dbgsys Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tino Reichardt <[email protected]> Closes openzfs#14078
1 parent f55d6ee commit b7bc334

File tree

13 files changed

+477
-257
lines changed

13 files changed

+477
-257
lines changed

.github/workflows/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
## The testings are done this way
3+
4+
```mermaid
5+
flowchart TB
6+
subgraph CleanUp and Summary
7+
Part1-20.04-->CleanUp+nice+Summary
8+
Part2-20.04-->CleanUp+nice+Summary
9+
PartN-20.04-->CleanUp+nice+Summary
10+
Part1-22.04-->CleanUp+nice+Summary
11+
Part2-22.04-->CleanUp+nice+Summary
12+
PartN-22.04-->CleanUp+nice+Summary
13+
end
14+
15+
subgraph Functional Testings
16+
functional-testing-20.04-->Part1-20.04
17+
functional-testing-20.04-->Part2-20.04
18+
functional-testing-20.04-->PartN-20.04
19+
functional-testing-22.04-->Part1-22.04
20+
functional-testing-22.04-->Part2-22.04
21+
functional-testing-22.04-->PartN-22.04
22+
end
23+
24+
subgraph Sanity and zloop Testings
25+
sanity-checks-20.04-->functional-testing-20.04
26+
sanity-checks-22.04-->functional-testing-22.04
27+
zloop-checks-20.04-->functional
28+
zloop-checks-22.04-->functional
29+
end
30+
31+
subgraph Code Checking + Building
32+
codeql.yml
33+
checkstyle.yml
34+
Build-Ubuntu-20.04-->sanity-checks-20.04
35+
Build-Ubuntu-22.04-->sanity-checks-22.04
36+
Build-Ubuntu-20.04-->zloop-checks-20.04
37+
Build-Ubuntu-22.04-->zloop-checks-22.04
38+
end
39+
```
40+
41+
42+
1) build zfs modules for Ubuntu 20.04 and 22.04 (~15m)
43+
2) 2x zloop test (~10m) + 2x sanity test (~25m)
44+
3) functional testings in parts 1..5 (each ~1h)
45+
4) cleanup and create summary
46+
- content of summary depends on the results of the steps
47+
48+
When everything runs fine, the full run should be done in
49+
about 2 hours.
50+
51+
The codeql.yml and checkstyle.yml are not part in this circle.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#!/usr/bin/env bash
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
9+
10+
function output() {
11+
echo -e $* >> Summary.md
12+
}
13+
14+
function error() {
15+
output ":bangbang: $* :bangbang:\n"
16+
}
17+
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
23+
24+
# for overview and zts-report
25+
cat log | grep '^Test' > list
26+
27+
# error details
28+
awk '/\[FAIL\]|\[KILLED\]/{ show=1; print; next; }
29+
/\[SKIP\]|\[PASS\]/{ show=0; } show' log > err
30+
31+
# summary of errors
32+
if [ -s err ]; then
33+
output "<pre>"
34+
$ZTS_REPORT --no-maybes ./list >> Summary.md
35+
output "</pre>"
36+
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:"
46+
fi
47+
48+
output "<details><summary>Full Listing</summary><pre>"
49+
cat list >> Summary.md
50+
output "</pre></details>"
51+
52+
# remove tmp files
53+
rm -f err list log
54+
}
55+
56+
# check tarfiles and untar
57+
function check_tarfile() {
58+
if [ -f "$1" ]; then
59+
tar xf "$1" || error "Tarfile $1 returns some error"
60+
else
61+
error "Tarfile $1 not found"
62+
fi
63+
}
64+
65+
# check logfile and concatenate test results
66+
function check_logfile() {
67+
if [ -f "$1" ]; then
68+
cat "$1" >> log
69+
else
70+
error "Logfile $1 not found"
71+
fi
72+
}
73+
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.tar"
91+
check_tarfile "$tarfile"
92+
check_logfile "testfiles/log"
93+
done
94+
generate
95+
}
96+
97+
# https://docs.github.com/en/[email protected]/actions/using-workflows/workflow-commands-for-github-actions#step-isolation-and-limits
98+
# Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB.
99+
# [ ] can not show all error findings here
100+
# [x] split files into smaller ones and create additional steps
101+
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
114+
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
117+
fi
118+
119+
exit 0

.github/workflows/scripts/reclaim_disk_space.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
function prerun() {
6+
echo "::group::Install build dependencies"
7+
# remove snap things, update+upgrade will be faster then
8+
for x in lxd core20 snapd; do sudo snap remove $x; done
9+
sudo apt-get purge snapd google-chrome-stable firefox
10+
# https://github.com/orgs/community/discussions/47863
11+
sudo apt-get remove grub-efi-amd64-bin grub-efi-amd64-signed shim-signed --allow-remove-essential
12+
sudo apt-get update
13+
sudo apt upgrade
14+
sudo xargs --arg-file=.github/workflows/build-dependencies.txt apt-get install -qq
15+
sudo apt-get clean
16+
sudo dmesg -c > /var/tmp/dmesg-prerun
17+
echo "::endgroup::"
18+
}
19+
20+
function mod_build() {
21+
echo "::group::Generate debian packages"
22+
./autogen.sh
23+
./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan
24+
make --no-print-directory --silent native-deb-utils native-deb-kmod
25+
mv ../*.deb .
26+
rm ./openzfs-zfs-dracut*.deb ./openzfs-zfs-dkms*.deb
27+
echo "$ImageOS-$ImageVersion" > tests/ImageOS.txt
28+
echo "::endgroup::"
29+
}
30+
31+
function mod_install() {
32+
# install the pre-built module only on the same runner image
33+
MOD=`cat tests/ImageOS.txt`
34+
if [ "$MOD" != "$ImageOS-$ImageVersion" ]; then
35+
rm -f *.deb
36+
mod_build
37+
fi
38+
39+
echo "::group::Install and load modules"
40+
# delete kernel-shipped zfs modules, be sure about correct modules
41+
sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
42+
sudo apt-get install --fix-missing ./*.deb
43+
44+
# Native Debian packages enable and start the services
45+
# Stop zfs-zed daemon, as it may interfere with some ZTS test cases
46+
sudo systemctl stop zfs-zed
47+
sudo depmod -a
48+
sudo modprobe zfs
49+
sudo dmesg
50+
sudo dmesg -c > /var/tmp/dmesg-module-load
51+
echo "::endgroup::"
52+
53+
echo "::group::Report CPU information"
54+
lscpu
55+
cat /proc/spl/kstat/zfs/chksum_bench
56+
echo "::endgroup::"
57+
58+
echo "::group::Reclaim and report disk space"
59+
# remove 4GiB of images
60+
sudo systemd-run docker system prune --force --all --volumes
61+
62+
# remove unused software
63+
sudo systemd-run --wait rm -rf \
64+
"$AGENT_TOOLSDIRECTORY" \
65+
/opt/* \
66+
/usr/local/* \
67+
/usr/share/az* \
68+
/usr/share/dotnet \
69+
/usr/share/gradle* \
70+
/usr/share/miniconda \
71+
/usr/share/swift \
72+
/var/lib/gems \
73+
/var/lib/mysql \
74+
/var/lib/snapd
75+
76+
# trim the cleaned space
77+
sudo fstrim /
78+
79+
# disk usage afterwards
80+
df -h /
81+
echo "::endgroup::"
82+
}
83+
84+
case "$1" in
85+
build)
86+
prerun
87+
mod_build
88+
;;
89+
tests)
90+
prerun
91+
mod_install
92+
;;
93+
esac
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
TDIR="/usr/share/zfs/zfs-tests/tests/functional"
6+
echo -n "TODO="
7+
case "$1" in
8+
part1)
9+
# ~1h 20m
10+
echo "cli_root"
11+
;;
12+
part2)
13+
# ~1h
14+
ls $TDIR|grep '^[a-m]'|grep -v "cli_root"|xargs|tr -s ' ' ','
15+
;;
16+
part3)
17+
# ~1h
18+
ls $TDIR|grep '^[n-qs-z]'|xargs|tr -s ' ' ','
19+
;;
20+
part4)
21+
# ~1h
22+
ls $TDIR|grep '^r'|xargs|tr -s ' ' ','
23+
;;
24+
esac

0 commit comments

Comments
 (0)