Skip to content

Commit 8f9a8e2

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 9, Fedora 39, Fedora 40 - Debian 11, Debian 12 - FreeBSD 13, FreeBSD 14, FreeBSD 15 - Ubuntu 20.04, Ubuntu 22.04, Ubuntu 24.04 - enabled by default: - AlmaLinux 8, AlmaLinux 9 - Fedora 39, Fedora 40 - FreeBSD 13, FreeBSD 14, FreeBSD 15 Workflow for each operating system: - install qemu on the github runner - download current cloud image of operating system - start and init that image via cloud-init - install dependencies and poweroff system - start system and build openzfs and then poweroff again - clone build system and start 3 instances of it - the functional testings complete within times < 3h Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de> Signed-off-by: Tony Hutter <hutter2@llnl.gov>
1 parent c420640 commit 8f9a8e2

18 files changed

+1476
-3
lines changed
File renamed without changes.

.github/workflows/scripts/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
Workflow for each operating system:
3+
- install qemu on the github runner
4+
- download current cloud image of operating system
5+
- start and init that image via cloud-init
6+
- install dependencies and poweroff system
7+
- start system and build openzfs and then poweroff again
8+
- clone build system and start 3 instances of it
9+
- the functional testings complete within times < 3h
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#!/bin/awk -f
2+
#
3+
# Merge multiple ZTS tests results summaries into a single summary. This is
4+
# needed when you're running different parts of ZTS on different tests
5+
# runners or VMs.
6+
#
7+
# Usage:
8+
#
9+
# ./merge_summary.awk summary1.txt [summary2.txt] [summary3.txt] ...
10+
#
11+
# or:
12+
#
13+
# cat summary*.txt | ./merge_summary.awk
14+
#
15+
BEGIN {
16+
i=-1
17+
pass=0
18+
fail=0
19+
skip=0
20+
state=""
21+
cl=0
22+
el=0
23+
upl=0
24+
ul=0
25+
26+
# Total seconds of tests runtime
27+
total=0;
28+
}
29+
30+
# Skip empty lines
31+
/^\s*$/{next}
32+
33+
# Skip Configuration and Test lines
34+
/^Test:/{state=""; next}
35+
/Configuration/{state="";next}
36+
37+
# When we see "test-runner.py" stop saving config lines, and
38+
# save test runner lines
39+
/test-runner.py/{state="testrunner"; runner=runner$0"\n"; next}
40+
41+
# We need to differentiate the PASS counts from test result lines that start
42+
# with PASS, like:
43+
#
44+
# PASS mv_files/setup
45+
#
46+
# Use state="pass_count" to differentiate
47+
#
48+
/Results Summary/{state="pass_count"; next}
49+
/PASS/{ if (state=="pass_count") {pass += $2}}
50+
/FAIL/{ if (state=="pass_count") {fail += $2}}
51+
/SKIP/{ if (state=="pass_count") {skip += $2}}
52+
/Running Time/{
53+
state="";
54+
running[i]=$3;
55+
split($3, arr, ":")
56+
total += arr[1] * 60 * 60;
57+
total += arr[2] * 60;
58+
total += arr[3]
59+
next;
60+
}
61+
62+
/Tests with results other than PASS that are expected/{state="expected_lines"; next}
63+
/Tests with result of PASS that are unexpected/{state="unexpected_pass_lines"; next}
64+
/Tests with results other than PASS that are unexpected/{state="unexpected_lines"; next}
65+
{
66+
if (state == "expected_lines") {
67+
expected_lines[el] = $0
68+
el++
69+
}
70+
71+
if (state == "unexpected_pass_lines") {
72+
unexpected_pass_lines[upl] = $0
73+
upl++
74+
}
75+
if (state == "unexpected_lines") {
76+
unexpected_lines[ul] = $0
77+
ul++
78+
}
79+
}
80+
81+
# Reproduce summary
82+
END {
83+
# print runner;
84+
print "\nResults Summary"
85+
print "PASS\t"pass
86+
print "FAIL\t"fail
87+
print "SKIP\t"skip
88+
print "------------"
89+
print "TOTAL\t"pass+fail+skip
90+
print ""
91+
print "Running Time:\t"strftime("%T", total, 1)
92+
if (pass+fail+skip > 0) {
93+
percent_passed=(pass/(pass+fail+skip) * 100)
94+
}
95+
printf "Percent passed:\t%3.2f%", percent_passed
96+
97+
print "\n\nTests with results other than PASS that are expected:"
98+
asort(expected_lines, sorted)
99+
for (j in sorted)
100+
print sorted[j]
101+
102+
print "\n\nTests with result of PASS that are unexpected:"
103+
asort(unexpected_pass_lines, sorted)
104+
for (j in sorted)
105+
print sorted[j]
106+
107+
print "\n\nTests with results other than PASS that are unexpected:"
108+
asort(unexpected_lines, sorted)
109+
for (j in sorted)
110+
print sorted[j]
111+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env bash
2+
3+
######################################################################
4+
# 1) setup qemu instance on action runner
5+
######################################################################
6+
7+
set -eu
8+
9+
# install needed packages
10+
export DEBIAN_FRONTEND="noninteractive"
11+
sudo apt-get -y update
12+
sudo apt-get install -y axel cloud-image-utils daemonize guestfs-tools \
13+
ksmtuned virt-manager linux-modules-extra-$(uname -r) zfsutils-linux
14+
15+
# generate ssh keys
16+
rm -f ~/.ssh/id_ed25519
17+
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N ""
18+
19+
# we expect RAM shortage
20+
cat << EOF | sudo tee /etc/ksmtuned.conf > /dev/null
21+
# https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/chap-ksm
22+
KSM_MONITOR_INTERVAL=60
23+
24+
# Millisecond sleep between ksm scans for 16Gb server.
25+
# Smaller servers sleep more, bigger sleep less.
26+
KSM_SLEEP_MSEC=10
27+
KSM_NPAGES_BOOST=300
28+
KSM_NPAGES_DECAY=-50
29+
KSM_NPAGES_MIN=64
30+
KSM_NPAGES_MAX=2048
31+
32+
KSM_THRES_COEF=20
33+
KSM_THRES_CONST=2048
34+
35+
LOGFILE=/var/log/ksmtuned.log
36+
DEBUG=1
37+
EOF
38+
sudo systemctl restart ksm
39+
sudo systemctl restart ksmtuned
40+
41+
# not needed
42+
sudo systemctl stop docker.socket
43+
sudo systemctl stop multipathd.socket
44+
45+
# remove default swapfile and /mnt
46+
sudo swapoff -a
47+
sudo umount -l /mnt
48+
DISK="/dev/disk/cloud/azure_resource-part1"
49+
sudo sed -e "s|^$DISK.*||g" -i /etc/fstab
50+
sudo wipefs -aq $DISK
51+
sudo systemctl daemon-reload
52+
53+
sudo modprobe loop
54+
sudo modprobe zfs
55+
56+
# partition the disk as needed
57+
DISK="/dev/disk/cloud/azure_resource"
58+
sudo sgdisk --zap-all $DISK
59+
sudo sgdisk -p \
60+
-n 1:0:+16G -c 1:"swap" \
61+
-n 2:0:0 -c 2:"tests" \
62+
$DISK
63+
sync
64+
sleep 1
65+
66+
# swap with same size as RAM
67+
sudo mkswap $DISK-part1
68+
sudo swapon $DISK-part1
69+
70+
# 60GB data disk
71+
SSD1="$DISK-part2"
72+
73+
# 10GB data disk on ext4
74+
sudo fallocate -l 10G /test.ssd1
75+
SSD2=$(sudo losetup -b 4096 -f /test.ssd1 --show)
76+
77+
# adjust zfs module parameter and create pool
78+
exec 1>/dev/null
79+
ARC_MIN=$((1024*1024*256))
80+
ARC_MAX=$((1024*1024*512))
81+
echo $ARC_MIN | sudo tee /sys/module/zfs/parameters/zfs_arc_min
82+
echo $ARC_MAX | sudo tee /sys/module/zfs/parameters/zfs_arc_max
83+
echo 1 | sudo tee /sys/module/zfs/parameters/zvol_use_blk_mq
84+
sudo zpool create -f -o ashift=12 zpool $SSD1 $SSD2 \
85+
-O relatime=off -O atime=off -O xattr=sa -O compression=lz4 \
86+
-O mountpoint=/mnt/tests
87+
88+
# no need for some scheduler
89+
for i in /sys/block/s*/queue/scheduler; do
90+
echo "none" | sudo tee $i > /dev/null
91+
done

0 commit comments

Comments
 (0)