Skip to content

Commit

Permalink
Add a TAG Client/Server system for ZTS
Browse files Browse the repository at this point in the history
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
  • Loading branch information
mcmilk committed Nov 17, 2024
1 parent ff3df12 commit 2f2c86d
Show file tree
Hide file tree
Showing 13 changed files with 276 additions and 260 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 cryptsetup 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
samba 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 Down Expand Up @@ -81,7 +83,8 @@ function rhel() {
libuuid-devel 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 \
rpm-build rsync samba socat sysstat systemd watchdog wget \
xfsprogs-devel xxhash \
zlib-devel
echo "##[endgroup]"
}
Expand Down
38 changes: 28 additions & 10 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 @@ -27,12 +30,13 @@ function prefix() {
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"
t=$(get_time_diff)
printf "[vm${ID}: %s %4d] %s\n" "$t" "$CTR" "$CLINE"
fi
}

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

echo 0 > /tmp/ctr
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 -- \
Expand All @@ -54,7 +58,7 @@ 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
Expand All @@ -65,6 +69,8 @@ if [ -z ${1:-} ]; then
kill $pid
done

echo "VMs finished... kill tag server"
kill $(cat /tmp/tag-server/tag-server.pid)
exit 0
fi

Expand Down Expand Up @@ -97,8 +103,20 @@ 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
fi

# wait for tag-server on first VM
sleep 1

# run all tags, provided by tag-server
$TDIR/zfs-tests.sh -vK -s 3GB -T 192.168.122.11:2323/vm$2
RV=$?

# get some stats
df -h > df-postrun.txt
echo $RV > tests-exitcode.txt
sync
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 @@ -59,6 +59,19 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup SSH
run: |
mkdir -p $HOME/.ssh
echo "ConnectTimeout 5" >> $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 2f2c86d

Please sign in to comment.