Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-gpu-driver/blob/main/qemu/test.sh # omega-gpu-driver aien-dev/omega-gpu-driver Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-gpu-driver / qemu / test.sh` 25 lines ยท 1701 bytes Raw Blame History 1 #!/bin/sh 2 # qemu/test.sh -- build w0, boot the QEMU bench (virt + SMMUv3, edu 0000:00:02.0 on vfio-pci in group 2, 3 # a second edu 0000:00:03.0 left unbound), run qemu/w0.cmds and check every result. 4 # Usage: sh qemu/test.sh [LOG] (KERNEL=... selects the guest kernel, see qemu/bench/run.sh) 5 set -eu 6 R=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) 7 LOG=${1:-$R/build/w0-edu.log} 8 sh "$R/build.sh" >/dev/null 9 sh "$R/qemu/bench/run.sh" "$R/build/w0" "$R/qemu/w0.cmds" "$LOG" 10 fail=0 11 # one rc per command, in order: bind+read, wrong group, unbound edu, virtio (not vfio-pci), 12 # in-range extra read, read at the BAR0 size (oversized), misaligned read, usage, rebind after all 13 want="0 3 4 4 0 103 103 2 0" 14 got=$(tr -d '\r' < "$LOG" | sed -n 's/^\(.*[^0-9a-z_]\)\{0,1\}rc=\([0-9]*\)$/\2/p' | tr '\n' ' ' | sed 's/ $//') 15 [ "$got" = "$want" ] || { echo "FAIL rc sequence: got [$got] want [$want]"; fail=1; } 16 n=$(grep -c 'BOOT_0 \[0x000\] mapget 0x010000ed pread 0x010000ed' "$LOG" || true) 17 [ "$n" = 5 ] || { echo "FAIL edu identity 0x010000ed via map and pread: $n of 5 runs"; fail=1; } 18 n=$(grep -c 'config vendor/device \[0x00\] 0x11e81234' "$LOG" || true) 19 [ "$n" = 5 ] || { echo "FAIL config vendor/device 1234:11e8: $n of 5 runs"; fail=1; } 20 n=$(grep -c 'released device, group and container' "$LOG" || true) 21 [ "$n" = 3 ] || { echo "FAIL release lines: $n of 3"; fail=1; } 22 grep -q 'REFUSED: device iommu_group does not match GROUP' "$LOG" || { echo "FAIL wrong-group refusal"; fail=1; } 23 [ "$(grep -c 'REFUSED: device is not bound to vfio-pci' "$LOG")" = 2 ] || { echo "FAIL unbound refusals"; fail=1; } 24 [ $fail = 0 ] && echo "PASS w0 QEMU bench: bind, read 0x010000ed, release; 5 refusals ($LOG)" 25 exit $fail