interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / host / irq.sh

52 lines · 2018 bytes Raw Blame History
1#!/bin/sh
2# Host-only qualification. GCC/QEMU/ptrace/Python are verification oracles only.
3# Never opens /dev/vfio or /dev/nvidia, alters bindings, or touches a GPU service.
4set -eu
5cd "$(dirname "$0")/../.."
6R=$PWD
7OMC=${OMC:-"$R/seed/out/omc"}
8B=${IRQ_WORK:-"$R/build/seed/irq"}
9mkdir -p "$B"
10B=$(CDPATH= cd -- "$B" && pwd)
11expectrc() {
12 want=$1
13 shift
14 set +e
15 "$@"
16 got=$?
17 set -e
18 [ "$got" = "$want" ] || { printf 'FAIL exit=%s expected=%s command=%s\n' "$got" "$want" "$*" >&2; return 1; }
19}
20compile() {
21 "$OMC" < "seed/host/tests/$1.om" > "$B/$1" 2> "$B/$1.err"
22 chmod +x "$B/$1"
23}
24for name in eventfd vfioirq irqlayout irqcheck irqnovfio; do compile "$name"; done
25"${CC:-gcc}" -std=c11 -O2 -Wall -Wextra -Werror seed/host/irq-oracle.c -o "$B/oracle"
26"$B/oracle" --layout > "$B/layout.txt"
27cat "$B/layout.txt"
28"$B/oracle" --bytes > "$B/gcc-layout.bin"
29"$B/irqlayout" > "$B/omega-layout.bin"
30cmp "$B/gcc-layout.bin" "$B/omega-layout.bin"
31printf 'PASS GCC/Omega IRQ wire-layout differential\n'
32"$B/eventfd"
33"$B/eventfd" 2
34printf 'PASS real eventfd initial/read/write/drain/poll/close and table capacity\n'
35(cd "$B"; ./irqcheck "$OMC")
36"$B/oracle" "$B/vfioirq" 0 0 0
37"$B/oracle" "$B/vfioirq" 0 0 1
38"$B/oracle" "$B/vfioirq" '?' 0 0
39for mode in 1 2 3 4 5 6 7 8 9 ':' ';' '<' '=' '>'; do
40 "$B/oracle" "$B/vfioirq" "$mode" 103 0
41done
42expectrc 103 "$B/irqnovfio"
43QEMU=${QEMU_AARCH64:-qemu-aarch64}
44"$B/oracle" "$B/vfioirq" '@' 0 0
45"$B/oracle" "$B/vfioirq" A 103 0
46command -v "$QEMU" >/dev/null || { printf 'NOT_RUN QEMU VFIO-less negative: missing qemu-aarch64\n' >&2; exit 3; }
47expectrc 103 "$QEMU" "$B/irqnovfio"
48"$QEMU" "$B/eventfd"
49printf 'PASS QEMU user-mode VFIO-less refusal and real translated eventfd behavior (not system/hardware qualification)\n'
50python3 seed/host/irq-mutants.py "$OMC" "$B/oracle" "$B/mutants"
51sha256sum "$OMC" seed/omc/omc.om "$B/eventfd" "$B/vfioirq" "$B/irqlayout"
52printf 'PASS typed VFIO IRQ/eventfd host qualification; real device IRQ delivery NOT_RUN\n'