Skip to content

Commit

Permalink
Merge summaries
Browse files Browse the repository at this point in the history
Just testing

Requires-builders: none
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
  • Loading branch information
tonyhutter committed Jun 21, 2024
1 parent 704ae68 commit 80640e1
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 15 deletions.
127 changes: 127 additions & 0 deletions .github/workflows/scripts/merge_summary.awk
Original file line number Diff line number Diff line change
@@ -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]
}
14 changes: 8 additions & 6 deletions .github/workflows/scripts/qemu-5-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF > /tmp/user-data
#cloud-config
Expand Down Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/scripts/qemu-6-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/scripts/qemu-7-reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
######################################################################

set -o pipefail
ZFSDIR="$(pwd)"
cd /var/tmp

echo "VM disk usage before:"
Expand Down Expand Up @@ -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
15 changes: 14 additions & 1 deletion .github/workflows/zfs-qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 80640e1

Please sign in to comment.