aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/scripts
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/scripts')
-rwxr-xr-x.github/workflows/scripts/generate-summary.sh119
-rwxr-xr-x.github/workflows/scripts/reclaim_disk_space.sh23
-rwxr-xr-x.github/workflows/scripts/setup-dependencies.sh93
-rwxr-xr-x.github/workflows/scripts/setup-functional.sh24
4 files changed, 236 insertions, 23 deletions
diff --git a/.github/workflows/scripts/generate-summary.sh b/.github/workflows/scripts/generate-summary.sh
new file mode 100755
index 000000000..cd5ea3421
--- /dev/null
+++ b/.github/workflows/scripts/generate-summary.sh
@@ -0,0 +1,119 @@
+#!/usr/bin/env bash
+
+# for runtime reasons we split functional testings into N parts
+# - use a define to check for missing tarfiles
+FUNCTIONAL_PARTS="4"
+
+ZTS_REPORT="tests/test-runner/bin/zts-report.py"
+chmod +x $ZTS_REPORT
+
+function output() {
+ echo -e $* >> Summary.md
+}
+
+function error() {
+ output ":bangbang: $* :bangbang:\n"
+}
+
+# this function generates the real summary
+# - expects a logfile "log" in current directory
+function generate() {
+ # we issued some error already
+ test ! -s log && return
+
+ # for overview and zts-report
+ cat log | grep '^Test' > list
+
+ # error details
+ awk '/\[FAIL\]|\[KILLED\]/{ show=1; print; next; }
+ /\[SKIP\]|\[PASS\]/{ show=0; } show' log > err
+
+ # summary of errors
+ if [ -s err ]; then
+ output "<pre>"
+ $ZTS_REPORT --no-maybes ./list >> Summary.md
+ output "</pre>"
+
+ # generate seperate error logfile
+ ERRLOGS=$((ERRLOGS+1))
+ errfile="err-$ERRLOGS.md"
+ echo -e "\n## $headline (debugging)\n" >> $errfile
+ echo "<details><summary>Error Listing - with dmesg and dbgmsg</summary><pre>" >> $errfile
+ dd if=err bs=999k count=1 >> $errfile
+ echo "</pre></details>" >> $errfile
+ else
+ output "All tests passed :thumbsup:"
+ fi
+
+ output "<details><summary>Full Listing</summary><pre>"
+ cat list >> Summary.md
+ output "</pre></details>"
+
+ # remove tmp files
+ rm -f err list log
+}
+
+# check tarfiles and untar
+function check_tarfile() {
+ if [ -f "$1" ]; then
+ tar xf "$1" || error "Tarfile $1 returns some error"
+ else
+ error "Tarfile $1 not found"
+ fi
+}
+
+# check logfile and concatenate test results
+function check_logfile() {
+ if [ -f "$1" ]; then
+ cat "$1" >> log
+ else
+ error "Logfile $1 not found"
+ fi
+}
+
+# sanity
+function summarize_s() {
+ headline="$1"
+ output "\n## $headline\n"
+ rm -rf testfiles
+ check_tarfile "$2/sanity.tar"
+ check_logfile "testfiles/log"
+ generate
+}
+
+# functional
+function summarize_f() {
+ headline="$1"
+ output "\n## $headline\n"
+ rm -rf testfiles
+ for i in $(seq 1 $FUNCTIONAL_PARTS); do
+ tarfile="$2/part$i.tar"
+ check_tarfile "$tarfile"
+ check_logfile "testfiles/log"
+ done
+ generate
+}
+
+# https://docs.github.com/en/[email protected]/actions/using-workflows/workflow-commands-for-github-actions#step-isolation-and-limits
+# Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB.
+# [ ] can not show all error findings here
+# [x] split files into smaller ones and create additional steps
+
+ERRLOGS=0
+if [ ! -f Summary/Summary.md ]; then
+ # first call, we do the default summary (~500k)
+ echo -n > Summary.md
+ summarize_s "Sanity Tests Ubuntu 20.04" Logs-20.04-sanity
+ summarize_s "Sanity Tests Ubuntu 22.04" Logs-22.04-sanity
+ summarize_f "Functional Tests Ubuntu 20.04" Logs-20.04-functional
+ summarize_f "Functional Tests Ubuntu 22.04" Logs-22.04-functional
+
+ cat Summary.md >> $GITHUB_STEP_SUMMARY
+ mkdir -p Summary
+ mv *.md Summary
+else
+ # here we get, when errors where returned in first call
+ test -f Summary/err-$1.md && cat Summary/err-$1.md >> $GITHUB_STEP_SUMMARY
+fi
+
+exit 0
diff --git a/.github/workflows/scripts/reclaim_disk_space.sh b/.github/workflows/scripts/reclaim_disk_space.sh
deleted file mode 100755
index ed23ce31d..000000000
--- a/.github/workflows/scripts/reclaim_disk_space.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-set -eu
-
-# remove 4GiB of images
-sudo systemd-run docker system prune --force --all --volumes
-
-# remove unused software
-sudo systemd-run --wait rm -rf \
- "$AGENT_TOOLSDIRECTORY" \
- /opt/* \
- /usr/local/* \
- /usr/share/az* \
- /usr/share/dotnet \
- /usr/share/gradle* \
- /usr/share/miniconda \
- /usr/share/swift \
- /var/lib/gems \
- /var/lib/mysql \
- /var/lib/snapd
-
-# trim the cleaned space
-sudo fstrim /
diff --git a/.github/workflows/scripts/setup-dependencies.sh b/.github/workflows/scripts/setup-dependencies.sh
new file mode 100755
index 000000000..c788f0afa
--- /dev/null
+++ b/.github/workflows/scripts/setup-dependencies.sh
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+
+set -eu
+
+function prerun() {
+ echo "::group::Install build dependencies"
+ # remove snap things, update+upgrade will be faster then
+ for x in lxd core20 snapd; do sudo snap remove $x; done
+ sudo apt-get purge snapd google-chrome-stable firefox
+ # https://github.com/orgs/community/discussions/47863
+ sudo apt-get remove grub-efi-amd64-bin grub-efi-amd64-signed shim-signed --allow-remove-essential
+ sudo apt-get update
+ sudo apt upgrade
+ sudo xargs --arg-file=.github/workflows/build-dependencies.txt apt-get install -qq
+ sudo apt-get clean
+ sudo dmesg -c > /var/tmp/dmesg-prerun
+ echo "::endgroup::"
+}
+
+function mod_build() {
+ echo "::group::Generate debian packages"
+ ./autogen.sh
+ ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan
+ make --no-print-directory --silent native-deb-utils native-deb-kmod
+ mv ../*.deb .
+ rm ./openzfs-zfs-dracut*.deb ./openzfs-zfs-dkms*.deb
+ echo "$ImageOS-$ImageVersion" > tests/ImageOS.txt
+ echo "::endgroup::"
+}
+
+function mod_install() {
+ # install the pre-built module only on the same runner image
+ MOD=`cat tests/ImageOS.txt`
+ if [ "$MOD" != "$ImageOS-$ImageVersion" ]; then
+ rm -f *.deb
+ mod_build
+ fi
+
+ echo "::group::Install and load modules"
+ # delete kernel-shipped zfs modules, be sure about correct modules
+ sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf
+ sudo apt-get install --fix-missing ./*.deb
+
+ # Native Debian packages enable and start the services
+ # Stop zfs-zed daemon, as it may interfere with some ZTS test cases
+ sudo systemctl stop zfs-zed
+ sudo depmod -a
+ sudo modprobe zfs
+ sudo dmesg
+ sudo dmesg -c > /var/tmp/dmesg-module-load
+ echo "::endgroup::"
+
+ echo "::group::Report CPU information"
+ lscpu
+ cat /proc/spl/kstat/zfs/chksum_bench
+ echo "::endgroup::"
+
+ echo "::group::Reclaim and report disk space"
+ # remove 4GiB of images
+ sudo systemd-run docker system prune --force --all --volumes
+
+ # remove unused software
+ sudo systemd-run --wait rm -rf \
+ "$AGENT_TOOLSDIRECTORY" \
+ /opt/* \
+ /usr/local/* \
+ /usr/share/az* \
+ /usr/share/dotnet \
+ /usr/share/gradle* \
+ /usr/share/miniconda \
+ /usr/share/swift \
+ /var/lib/gems \
+ /var/lib/mysql \
+ /var/lib/snapd
+
+ # trim the cleaned space
+ sudo fstrim /
+
+ # disk usage afterwards
+ df -h /
+ echo "::endgroup::"
+}
+
+case "$1" in
+ build)
+ prerun
+ mod_build
+ ;;
+ tests)
+ prerun
+ mod_install
+ ;;
+esac
diff --git a/.github/workflows/scripts/setup-functional.sh b/.github/workflows/scripts/setup-functional.sh
new file mode 100755
index 000000000..08c4d872a
--- /dev/null
+++ b/.github/workflows/scripts/setup-functional.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+set -eu
+
+TDIR="/usr/share/zfs/zfs-tests/tests/functional"
+echo -n "TODO="
+case "$1" in
+ part1)
+ # ~1h 20m
+ echo "cli_root"
+ ;;
+ part2)
+ # ~1h
+ ls $TDIR|grep '^[a-m]'|grep -v "cli_root"|xargs|tr -s ' ' ','
+ ;;
+ part3)
+ # ~1h
+ ls $TDIR|grep '^[n-qs-z]'|xargs|tr -s ' ' ','
+ ;;
+ part4)
+ # ~1h
+ ls $TDIR|grep '^r'|xargs|tr -s ' ' ','
+ ;;
+esac