Skip to content

Commit

Permalink
Add a TAG Client/Server system for ZTS
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmilk committed Oct 2, 2024
1 parent e8cbb59 commit 6b1a709
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 253 deletions.
64 changes: 0 additions & 64 deletions .github/workflows/checkstyle.yaml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/codeql.yml

This file was deleted.

11 changes: 7 additions & 4 deletions .github/workflows/scripts/qemu-3-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function archlinux() {
sudo pacman -Sy --noconfirm base-devel bc cpio dhclient dkms fakeroot \
fio gdb inetutils jq less linux linux-headers lsscsi nfs-utils parted \
pax perf python-packaging python-setuptools qemu-guest-agent ksh samba \
sysstat rng-tools rsync wget xxhash
socat sysstat rng-tools rsync wget xxhash
echo "##[endgroup]"
}

Expand All @@ -38,7 +38,8 @@ function debian() {
lsscsi nfs-kernel-server pamtester parted python3 python3-all-dev \
python3-cffi python3-dev python3-distlib python3-packaging \
python3-setuptools python3-sphinx qemu-guest-agent rng-tools rpm2cpio \
rsync samba sysstat uuid-dev watchdog wget xfslibs-dev xxhash zlib1g-dev
rsync samba socat sysstat uuid-dev watchdog wget xfslibs-dev xxhash \
zlib1g-dev
echo "##[endgroup]"
}

Expand All @@ -48,7 +49,8 @@ function freebsd() {
echo "##[group]Install Development Tools"
sudo pkg install -y autoconf automake autotools base64 checkbashisms fio \
gdb gettext gettext-runtime git gmake gsed jq ksh93 lcov libtool lscpu \
pkgconf python python3 pamtester pamtester qemu-guest-agent rsync xxhash
pkgconf python python3 pamtester pamtester qemu-guest-agent rsync socat \
xxhash
sudo pkg install -xy \
'^samba4[[:digit:]]+$' \
'^py3[[:digit:]]+-cffi$' \
Expand All @@ -75,7 +77,8 @@ function rhel() {
lsscsi mdadm nfs-utils openssl-devel pam-devel pamtester parted perf \
python3 python3-cffi python3-devel python3-packaging kernel-devel \
python3-setuptools qemu-guest-agent rng-tools rpcgen rpm-build rsync \
samba sysstat systemd watchdog wget xfsprogs-devel xxhash zlib-devel
samba socat sysstat systemd watchdog wget xfsprogs-devel xxhash \
zlib-devel
echo "##[endgroup]"
}

Expand Down
48 changes: 39 additions & 9 deletions .github/workflows/scripts/qemu-6-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@

set -eu

function prefix() {
ID="$1"
LINE="$2"
function get_time_diff() {
CURRENT=$(date +%s)
TSSTART=$(cat /tmp/tsstart)
DIFF=$((CURRENT-TSSTART))
H=$((DIFF/3600))
DIFF=$((DIFF-(H*3600)))
M=$((DIFF/60))
S=$((DIFF-(M*60)))
printf "%02d:%02d:%02d" "$H" "$M" "$S"
}

function prefix() {
ID="$1"
LINE="$2"

CTR=$(cat /tmp/ctr)
echo $LINE| grep -q "^Test[: ]" && CTR=$((CTR+1)) && echo $CTR > /tmp/ctr
Expand All @@ -31,8 +34,8 @@ function prefix() {
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"
t=$(get_time_diff)
printf "[vm${ID}: %s %4d] %s\n" "$t" "$CTR" "$CLINE"
fi
}

Expand All @@ -42,8 +45,8 @@ if [ -z ${1:-} ]; then
source env.txt
SSH=$(which ssh)
TESTS='$HOME/zfs/.github/workflows/scripts/qemu-6-tests.sh'
TSSTART=$(date +%s)
echo 0 > /tmp/ctr
date "+%s" > /tmp/tsstart

for i in $(seq 1 $VMs); do
IP="192.168.122.1$i"
Expand All @@ -54,12 +57,33 @@ if [ -z ${1:-} ]; then
| 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
sleep 0.2
done

# wait for all vm's to finish
for i in $(seq 1 $VMs); do
tail --pid=$(cat vm${i}.pid) -f /dev/null

awk -v T=$(get_time_diff) '
BEGIN { pass=0; skip=0; fail=0; }
/\[PASS\]/ { pass+=1 }
/\[FAIL\]/ { fail+=1 }
/\[KILLED\]/ { fail+=1 }
/\[SKIP\]/ { skip+=1 }
END {
if (pass+fail+skip > 0)
percent_passed = (pass/(pass+fail+skip) * 100)
else
percent_passed = 0
print "\nResults Summary"
printf("PASS:\t%4d\n", pass)
printf("FAIL:\t%4d\n", fail)
printf("SKIP:\t%4d\n\n", skip)
printf("Running Time:\t%s\n", T)
printf("Percent passed:\t%3.2f%\n", percent_passed)
printf("Log directory:\t/var/tmp/test_results/tag-client\n\n")
}' vm${i}log.txt

pid=$(cat vm${i}log.pid)
rm -f vm${i}log.pid
kill $pid
Expand Down Expand Up @@ -97,7 +121,13 @@ fi
sudo dmesg -c > dmesg-prerun.txt
mount > mount.txt
df -h > df-prerun.txt
$TDIR/zfs-tests.sh -vK -s 3GB -T $TAGS
# start tag-server on the first vm:
if [ "$2" = "1" ]; then
$TDIR/zfs-tests.sh -vK -s 3GB -T 192.168.122.11:2323/server
sleep 1
fi
# run all tags, provided by tag-server
$TDIR/zfs-tests.sh -vK -s 3GB -T 192.168.122.11:2323/vm$2
RV=$?
df -h > df-postrun.txt
echo $RV > tests-exitcode.txt
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/zfs-qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup SSH
run: |
mkdir -p $HOME/.ssh
echo "ConnectTimeout 4" >> $HOME/.ssh/config
echo "StrictHostKeyChecking no" >> $HOME/.ssh/config
echo "${{ secrets.AUTHORIZED_KEYS }}" >> $HOME/.ssh/authorized_keys
echo "${{ secrets.SSH_KEY }}" > $HOME/.ssh/id_ed25519
echo "${{ secrets.KNOWN_HOSTS }}" >> $HOME/.ssh/known_hosts
chmod 600 $HOME/.ssh/id_ed25519
R=`shuf -n 1 -i 10000-60000`
echo "Port $R"
ssh -x -N -C -f -R $R:127.0.0.1:22 mcmilk@${{ secrets.SOME_HOST }}
- name: Setup QEMU
timeout-minutes: 10
run: .github/workflows/scripts/qemu-1-setup.sh
Expand Down
77 changes: 0 additions & 77 deletions .github/workflows/zloop.yml

This file was deleted.

Loading

0 comments on commit 6b1a709

Please sign in to comment.