ZTS: Use QEMU for tests on Linux and FreeBSD #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: zfs-qemu | |
on: | |
push: | |
pull_request: | |
jobs: | |
qemu-vm: | |
name: QEMU | |
env: | |
num_vms: 2 | |
strategy: | |
fail-fast: false | |
matrix: | |
# os: [almalinux8, almalinux9, archlinux, centos-stream9, fedora39, fedora40, debian11, debian12, freebsd13, freebsd14, freebsd15, ubuntu20, ubuntu22, ubuntu24] | |
os: [almalinux8, almalinux9, fedora39, fedora40, freebsd13, freebsd14, freebsd15] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup QEMU | |
timeout-minutes: 10 | |
run: .github/workflows/scripts/qemu-1-setup.sh | |
- name: Start build machine | |
timeout-minutes: 10 | |
run: .github/workflows/scripts/qemu-2-start.sh ${{ matrix.os }} | |
- name: Install dependencies | |
timeout-minutes: 20 | |
run: | | |
echo "Install dependencies in QEMU machine" | |
echo "ConnectTimeout 1" >> $HOME/.ssh/config | |
echo "StrictHostKeyChecking no" >> $HOME/.ssh/config | |
IP=192.168.122.10 | |
while pidof /usr/bin/qemu-system-x86_64 >/dev/null; do | |
ssh 2>/dev/null zfs@$IP "uname -a" && break | |
done | |
scp .github/workflows/scripts/qemu-3-deps.sh zfs@$IP:qemu-3-deps.sh | |
PID=`pidof /usr/bin/qemu-system-x86_64` | |
ssh zfs@$IP '$HOME/qemu-3-deps.sh' ${{ matrix.os }} | |
# wait for poweroff to succeed | |
tail --pid=$PID -f /dev/null | |
sleep 5 # avoid this: "error: Domain is already active" | |
- name: Build modules | |
timeout-minutes: 30 | |
run: | | |
echo "Build modules in QEMU machine" | |
sudo virsh start openzfs | |
rm -f $HOME/.ssh/known_hosts | |
IP=192.168.122.10 | |
while pidof /usr/bin/qemu-system-x86_64 >/dev/null; do | |
ssh 2>/dev/null zfs@$IP "uname -a" && break | |
done | |
rsync -ar $HOME/work/zfs/zfs zfs@$IP:./ | |
ssh zfs@$IP '$HOME/zfs/.github/workflows/scripts/qemu-4-build.sh' ${{ matrix.os }} | |
- name: Setup testing machines | |
timeout-minutes: 5 | |
run: | | |
.github/workflows/scripts/qemu-5-setup.sh | |
# Save the VM's serial output (ttyS0) to /var/tmp/console.txt | |
# - ttyS0 on the VM corresponds to a local /dev/pty/N entry | |
# - use 'virsh ttyconsole' to lookup the /dev/pty/N entry | |
RESPATH="/var/tmp/test_results" | |
for i in $(seq 1 ${{ ENV.num_vms }}) ; do | |
mkdir -p $RESPATH/vm$i | |
read "pty$i" <<< $(sudo virsh ttyconsole "vm$i") | |
sudo nohup bash -c "cat "$pty$i" > $RESPATH/vm$i/console.txt" & | |
done | |
echo "Console logging for ${{ matrix.os }} VMs started." | |
- name: Run tests | |
timeout-minutes: 270 | |
run: | | |
.github/workflows/scripts/qemu-6-tests.sh | |
- name: Test reports | |
timeout-minutes: 10 | |
run: | | |
.github/workflows/scripts/qemu-7-reports.sh | |
- name: Prepare artifacts | |
timeout-minutes: 10 | |
if: success() || failure() | |
run: | | |
RESPATH="/var/tmp/test_results" | |
for i in $(seq 1 ${{ ENV.num_vms }}) ; do | |
rsync -arL [email protected]$i:$RESPATH/current $RESPATH/vm$i || true | |
scp [email protected]$i:"/var/tmp/*.txt" $RESPATH/vm$i || true | |
done | |
cp -f /var/tmp/*.txt $RESPATH || true | |
tar cf qemu-${{ matrix.os }}.tar -C $RESPATH -h . || true | |
- uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: Logs-functional-${{ matrix.os }} | |
path: qemu-${{ matrix.os }}.tar | |
if-no-files-found: ignore | |
cleanup: | |
if: always() | |
name: Cleanup | |
runs-on: ubuntu-latest | |
needs: [ qemu-vm ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/download-artifact@v4 | |
- name: Generating summary | |
run: .github/workflows/scripts/qemu-8-summary.sh | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 2 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 3 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 4 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 5 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 6 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 7 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 8 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 9 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 10 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 11 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 12 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 13 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 14 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 15 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 16 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 17 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 18 | |
- name: Generating summary... | |
run: .github/workflows/scripts/qemu-8-summary.sh 19 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Summary Files | |
path: out-* |