From 80640e14ee6747fe9d136aa4d44ca604554d434b Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Thu, 20 Jun 2024 15:54:37 -0700 Subject: [PATCH] Merge summaries Just testing Requires-builders: none Signed-off-by: Tony Hutter --- .github/workflows/scripts/merge_summary.awk | 127 ++++++++++++++++++++ .github/workflows/scripts/qemu-5-setup.sh | 14 ++- .github/workflows/scripts/qemu-6-tests.sh | 19 +-- .github/workflows/scripts/qemu-7-reports.sh | 13 ++ .github/workflows/zfs-qemu.yml | 15 ++- 5 files changed, 173 insertions(+), 15 deletions(-) create mode 100755 .github/workflows/scripts/merge_summary.awk diff --git a/.github/workflows/scripts/merge_summary.awk b/.github/workflows/scripts/merge_summary.awk new file mode 100755 index 000000000000..b55100677ef6 --- /dev/null +++ b/.github/workflows/scripts/merge_summary.awk @@ -0,0 +1,127 @@ +#!/bin/awk -f +# +# Merge multiple ZTS tests results summaries into a single summary. This is +# needed when you're running different parts of ZTS on different tests +# runners or VMs. +# +# Usage: +# +# ./merge_summary.awk summary1.txt [summary2.txt] [summary3.txt] ... +# +# or: +# +# cat summary*.txt | ./merge_summary.awk +# +# NOTE!!! Make sure all ANSI color is removed before running this script or +# it's not going to work correctly. To remove ANSI colors: +# +# sed -e 's/\x1b\[[0-9;]*m//g' +# +BEGIN { + i=-1 + pass=0 + fail=0 + skip=0 + state="config_lines" + cl=0 + el=0 + epl=0 + ul=0 + + # Total seconds of tests runtime + total=0; +} + +/Configuration/{ + i++; + if (state != "config_lines") { + # new file, clear our state + state=""; + } +} + +# Skip empty lines +/^\s*$/{next} + +# When we see "test-runner.py" stop saving config lines, and +# save test runner lines +/test-runner.py/{state="testrunner"; runner=runner$0"\n"; next} + +# We need to differentiate the PASS counts from test result lines that start +# with PASS, like: +# +# PASS mv_files/setup +# +# Use state="pass_count" to differentiate +# +/Results Summary/{state="pass_count"; next} +/PASS/{ if (state=="pass_count") {pass += $2}} +/FAIL/{ if (state=="pass_count") {fail += $2}} +/SKIP/{ if (state=="pass_count") {skip += $2}} +/Running Time/{ + state=""; + running[i]=$3; + split($3, arr, ":") + total += arr[1] * 60 * 60; + total += arr[2] * 60; + total += arr[3] + next; +} + +# Just save the log directory from the first summary since we probably don't +# care what the value is. +/Log directory/{if (i == 0) {logdir_line=$0"\n"}; next} +/Tests with results other than PASS that are expected/{state="expected_lines"; next} +/Tests with result of PASS that are unexpected/{state="unexpected_pass_lines"; next} +/Tests with results other than PASS that are unexpected/{state="unexpected_lines"; next} +{ + # Save the opening configuration lines from first summary file. These + # should be relatively common to all the summaries. + if (state == "config_lines") { + config_lines[cl] = $0 + cl++; + } + + if (state == "expected_lines") { + expected_lines[el] = $0 + el++ + } + + if (state == "unexpected_pass_lines") { + unexpected_pass_lines[upl] = $0 + upl++ + } + if (state == "unexpected_lines") { + unexpected_lines[ul] = $0 + ul++ + } +} + +# Reproduce summary +END { + for (j in config_lines) + print config_lines[j] + print "" + print runner; + print " Results Summary" + print " PASS\t"pass + print " FAIL\t"fail + print " SKIP\t"skip + print "" + print " Running Time:\t"strftime("%T", total, 1) + + percent_passed=(pass/(pass+fail+skip) * 100) + printf " Percent passed:\t%3.2f%\n", percent_passed + print logdir_line + print " Tests with results other than PASS that are expected:" + for (j in expected_lines) + print expected_lines[j] + print "" + print " Tests with result of PASS that are unexpected:" + for (j in unexpected_pass_lines) + print unexpected_pass_lines[j] + print "" + print " Tests with results other than PASS that are unexpected:" + for (j in unexpected_lines) + print unexpected_lines[j] +} diff --git a/.github/workflows/scripts/qemu-5-setup.sh b/.github/workflows/scripts/qemu-5-setup.sh index 22be2555e7a6..912896cb8e2d 100755 --- a/.github/workflows/scripts/qemu-5-setup.sh +++ b/.github/workflows/scripts/qemu-5-setup.sh @@ -33,9 +33,9 @@ for i in `seq 1 3`; do echo "Generating vm$i with 3x${SIZE}GiB disks." sudo mkdir -p $BASE sudo qemu-img create $OPTS -b /mnt/openzfs.qcow2 -F qcow2 "$BASE/vm$i.qcow2" - sudo qemu-img create $OPTS "$BASE/vm$i-1.qcow2" ${SIZE}G - sudo qemu-img create $OPTS "$BASE/vm$i-2.qcow2" ${SIZE}G - sudo qemu-img create $OPTS "$BASE/vm$i-3.qcow2" ${SIZE}G +# sudo qemu-img create $OPTS "$BASE/vm$i-1.qcow2" ${SIZE}G +# sudo qemu-img create $OPTS "$BASE/vm$i-2.qcow2" ${SIZE}G +# sudo qemu-img create $OPTS "$BASE/vm$i-3.qcow2" ${SIZE}G cat < /tmp/user-data #cloud-config @@ -72,10 +72,12 @@ EOF --cloud-init user-data=/tmp/user-data \ --network bridge=virbr0,model=virtio,mac="52:54:00:83:79:0$i" \ --disk "$BASE/vm$i.qcow2",format=qcow2,bus=virtio,driver.discard=unmap \ - --disk "$BASE/vm$i-1.qcow2",format=qcow2,bus=virtio,driver.discard=unmap \ - --disk "$BASE/vm$i-2.qcow2",format=qcow2,bus=virtio,driver.discard=unmap \ - --disk "$BASE/vm$i-3.qcow2",format=qcow2,bus=virtio,driver.discard=unmap \ --import --noautoconsole >/dev/null + +# --disk "$BASE/vm$i-1.qcow2",format=qcow2,bus=virtio,driver.discard=unmap \ +# --disk "$BASE/vm$i-2.qcow2",format=qcow2,bus=virtio,driver.discard=unmap \ +# --disk "$BASE/vm$i-3.qcow2",format=qcow2,bus=virtio,driver.discard=unmap \ +# --import --noautoconsole >/dev/null done # check if the machines are okay diff --git a/.github/workflows/scripts/qemu-6-tests.sh b/.github/workflows/scripts/qemu-6-tests.sh index 2840c58aeac1..0d278890ad39 100755 --- a/.github/workflows/scripts/qemu-6-tests.sh +++ b/.github/workflows/scripts/qemu-6-tests.sh @@ -66,14 +66,17 @@ function gettests() { part1) # ~1h 40m (archlinux) echo "cli_root" +# echo "zpool_add,zpool_create,zpool_export" ;; part2) # ~2h 5m (archlinux) ls $TF|grep '^[a-m]'|grep -v "cli_root"|xargs|tr -s ' ' ',' +# echo "zfs_receive,zpool_initialize" ;; part3) # ~2h ls $TF|grep '^[n-z]'|xargs|tr -s ' ' ',' +# echo "zfs_unshare,zpool_destroy" ;; esac } @@ -102,19 +105,19 @@ case "$1" in TDIR="/usr/local/share/zfs" freebsd OPTS=`gettests $2` - if [ -e /dev/vtbd1 ] && [ -e /dev/vtbd2 ] && [ -e /dev/vtbd3 ] ; then - DISKS="/dev/vtbd1 /dev/vtbd2 /dev/vtbd3" - export DISKS - fi +# if [ -e /dev/vtbd1 ] && [ -e /dev/vtbd2 ] && [ -e /dev/vtbd3 ] ; then +# DISKS="/dev/vtbd1 /dev/vtbd2 /dev/vtbd3" +# export DISKS +# fi ;; *) TDIR="/usr/share/zfs" OPTS=`gettests $2` linux - if [ -e /dev/vdb ] && [ -e /dev/vdc ] && [ -e /dev/vdd ] ; then - DISKS="/dev/vdb /dev/vdc /dev/vdd" - export DISKS - fi +# if [ -e /dev/vdb ] && [ -e /dev/vdc ] && [ -e /dev/vdd ] ; then +# DISKS="/dev/vdb /dev/vdc /dev/vdd" +# export DISKS +# fi ;; esac diff --git a/.github/workflows/scripts/qemu-7-reports.sh b/.github/workflows/scripts/qemu-7-reports.sh index 924b783d937d..a13ee7d34d61 100755 --- a/.github/workflows/scripts/qemu-7-reports.sh +++ b/.github/workflows/scripts/qemu-7-reports.sh @@ -5,6 +5,7 @@ ###################################################################### set -o pipefail +ZFSDIR="$(pwd)" cd /var/tmp echo "VM disk usage before:" @@ -35,4 +36,16 @@ for i in `seq 1 3`; do echo "##[endgroup]" done +# Merge all summaries +echo "Merging summaries1, zfsdir $ZFSDIR" +echo "current dir: $(ls -l)" +echo "homedir dir: $(ls -l ~)" + +# The 'sed' line here removes ANSI color. This is needed for merge_summary.awk +# to work. We add the color back in on the final line. +cat vm*log.txt | grep -v 'Test[ :]' | \ + sed -e 's/\x1b\[[0-9;]*m//g' | \ + $ZFSDIR/.github/workflows/scripts/merge_summary.awk | \ + $ZFSDIR/scripts/zfs-tests-color.sh + exit $exitcode diff --git a/.github/workflows/zfs-qemu.yml b/.github/workflows/zfs-qemu.yml index 52b972d13a7a..f0de68429d39 100644 --- a/.github/workflows/zfs-qemu.yml +++ b/.github/workflows/zfs-qemu.yml @@ -11,7 +11,9 @@ jobs: strategy: fail-fast: false matrix: - os: [almalinux8, almalinux9, archlinux, centos-stream9, fedora39, fedora40, debian11, debian12, freebsd13, freebsd14, freebsd15, ubuntu22, ubuntu24] +# os: [almalinux8, almalinux9, archlinux, centos-stream9, fedora39, fedora40, debian11, debian12, freebsd13, freebsd14, freebsd15, ubuntu22, ubuntu24] + os: [almalinux8, almalinux9, fedora39, fedora40, debian11, debian12, freebsd13, freebsd14, freebsd15, ubuntu22, ubuntu24] + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -102,6 +104,17 @@ jobs: path: qemu-${{ matrix.os }}.tar if-no-files-found: ignore + - name: Simple test results + if: success() || failure() + run: | + ZFSDIR="$(pwd)" + cd /var/tmp/test_results + cat vm*log.txt | grep -v 'Test[ :]' | \ + sed -e 's/\x1b\[[0-9;]*m//g' | \ + $ZFSDIR/.github/workflows/scripts/merge_summary.awk | \ + $ZFSDIR/scripts/zfs-tests-color.sh + awk '/\[FAIL\]|\[KILLED\]/{ show=1; print; next; }; /\[SKIP\]|\[PASS\]/{ show=0; } show' ./vm*/current/log + cleanup: if: always() name: Cleanup