mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-29 12:29:35 +03:00
bca9b64e7b
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 - Debian 11, Debian 12 - Fedora 39, Fedora 40 - FreeBSD 13, FreeBSD 14 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 2 instances of it - run functional testings and complete in around 3h - when tests are done, do some logfile preparing - show detailed results for each system - in the end, generate the job summary Real-world benefits from this PR: 1. The github runner scripts are in the zfs repo itself. That means you can just open a PR against zfs, like "Add Fedora 41 tester", and see the results directly in the PR. ZFS admins no longer need manually to login to the buildbot server to update the buildbot config with new version of Fedora/Almalinux. 2. Github runners allow you to run the entire test suite against your private branch before submitting a formal PR to openzfs. Just open a PR against your private zfs repo, and the exact same Fedora/Alma/FreeBSD runners will fire up and run ZTS. This can be useful if you want to iterate on a ZTS change before submitting a formal PR. 3. buildbot is incredibly cumbersome. Our buildbot config files alone are ~1500 lines (not including any build/setup scripts)! It's a huge pain to setup. 4. We're running the super ancient buildbot 0.8.12. It's so ancient it requires python2. We actually have to build python2 from source for almalinux9 just to get it to run. Ugrading to a more modern buildbot is a huge undertaking, and the UI on the newer versions is worse. 5. Buildbot uses EC2 instances. EC2 is a pain because: * It costs money * They throttle IOPS and CPU usage, leading to mysterious, * hard-to-diagnose, failures and timeouts in ZTS. * EC2 is high maintenance. We have to setup security groups, SSH * keys, networking, users, etc, in AWS and it's a pain. We also * have to periodically go in an kill zombie EC2 instances that * buildbot is unable to kill off. 6. Buildbot doesn't always handle failures well. One of the things we saw in the past was the FreeBSD builders would often die, and each builder death would take up a "slot" in buildbot. So we would periodically have to restart buildbot via a cron job to get the slots back. 7. This PR divides up the ZTS test list into two parts, launches two VMs, and on each VM runs half the test suite. The test results are then merged and shown in the sumary page. So we're basically parallelizing ZTS on the same github runner. This leads to lower overall ZTS runtimes (2.5-3 hours vs 4+ hours on buildbot), and one unified set of results per runner, which is nice. 8. Since the tests are running on a VM, we have much more control over what happens. We can capture the serial console output even if the test completely brings down the VM. In the future, we could also restart the test on the VM where it left off, so that if a single test panics the VM, we can just restart it and run the remaining ZTS tests (this functionaly is not yet implemented though, just an idea). 9. Using the runners, users can manually kill or restart a test run via the github IU. That really isn't possible with buildbot unless you're an admin. 10. Anecdotally, the tests seem to be more stable and constant under the QEMU runners. Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #16537
103 lines
2.6 KiB
Bash
Executable File
103 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
######################################################################
|
|
# 6) load openzfs module and run the tests
|
|
#
|
|
# called on runner: qemu-6-tests.sh
|
|
# called on qemu-vm: qemu-6-tests.sh $OS $2/$3
|
|
######################################################################
|
|
|
|
set -eu
|
|
|
|
function prefix() {
|
|
ID="$1"
|
|
LINE="$2"
|
|
CURRENT=$(date +%s)
|
|
TSSTART=$(cat /tmp/tsstart)
|
|
DIFF=$((CURRENT-TSSTART))
|
|
H=$((DIFF/3600))
|
|
DIFF=$((DIFF-(H*3600)))
|
|
M=$((DIFF/60))
|
|
S=$((DIFF-(M*60)))
|
|
|
|
CTR=$(cat /tmp/ctr)
|
|
echo $LINE| grep -q "^Test[: ]" && CTR=$((CTR+1)) && echo $CTR > /tmp/ctr
|
|
|
|
BASE="$HOME/work/zfs/zfs"
|
|
COLOR="$BASE/scripts/zfs-tests-color.sh"
|
|
CLINE=$(echo $LINE| grep "^Test[ :]" | sed -e 's|/usr/local|/usr|g' \
|
|
| sed -e 's| /usr/share/zfs/zfs-tests/tests/| |g' | $COLOR)
|
|
if [ -z "$CLINE" ]; then
|
|
printf "vm${ID}: %s\n" "$LINE"
|
|
else
|
|
# [vm2: 00:15:54 256] Test: functional/checksum/setup (run as root) [00:00] [PASS]
|
|
printf "[vm${ID}: %02d:%02d:%02d %4d] %s\n" \
|
|
"$H" "$M" "$S" "$CTR" "$CLINE"
|
|
fi
|
|
}
|
|
|
|
# called directly on the runner
|
|
if [ -z ${1:-} ]; then
|
|
cd "/var/tmp"
|
|
source env.txt
|
|
SSH=$(which ssh)
|
|
TESTS='$HOME/zfs/.github/workflows/scripts/qemu-6-tests.sh'
|
|
echo 0 > /tmp/ctr
|
|
date "+%s" > /tmp/tsstart
|
|
|
|
for i in $(seq 1 $VMs); do
|
|
IP="192.168.122.1$i"
|
|
daemonize -c /var/tmp -p vm${i}.pid -o vm${i}log.txt -- \
|
|
$SSH zfs@$IP $TESTS $OS $i $VMs
|
|
# handly line by line and add info prefix
|
|
stdbuf -oL tail -fq vm${i}log.txt \
|
|
| while read -r line; do prefix "$i" "$line"; done &
|
|
echo $! > vm${i}log.pid
|
|
# don't mix up the initial --- Configuration --- part
|
|
sleep 0.13
|
|
done
|
|
|
|
# wait for all vm's to finish
|
|
for i in $(seq 1 $VMs); do
|
|
tail --pid=$(cat vm${i}.pid) -f /dev/null
|
|
pid=$(cat vm${i}log.pid)
|
|
rm -f vm${i}log.pid
|
|
kill $pid
|
|
done
|
|
|
|
exit 0
|
|
fi
|
|
|
|
# this part runs inside qemu vm
|
|
export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/bin"
|
|
case "$1" in
|
|
freebsd*)
|
|
sudo kldstat -n zfs 2>/dev/null && sudo kldunload zfs
|
|
sudo -E ./zfs/scripts/zfs.sh
|
|
TDIR="/usr/local/share/zfs"
|
|
;;
|
|
*)
|
|
# use xfs @ /var/tmp for all distros
|
|
sudo mv -f /var/tmp/*.txt /tmp
|
|
sudo mkfs.xfs -fq /dev/vdb
|
|
sudo mount -o noatime /dev/vdb /var/tmp
|
|
sudo chmod 1777 /var/tmp
|
|
sudo mv -f /tmp/*.txt /var/tmp
|
|
sudo -E modprobe zfs
|
|
TDIR="/usr/share/zfs"
|
|
;;
|
|
esac
|
|
|
|
# run functional testings and save exitcode
|
|
cd /var/tmp
|
|
TAGS=$2/$3
|
|
sudo dmesg -c > dmesg-prerun.txt
|
|
mount > mount.txt
|
|
df -h > df-prerun.txt
|
|
$TDIR/zfs-tests.sh -vK -s 3GB -T $TAGS
|
|
RV=$?
|
|
df -h > df-postrun.txt
|
|
echo $RV > tests-exitcode.txt
|
|
sync
|
|
exit 0
|