interplane.Get Omega
Read in your language

omega-gpu-driver

aien-dev/omega-gpu-driver

Brought by drakestapleton

branch main Branches Tags History

omega-gpu-driver / tests / boot_dma.sh

29 lines · 1728 bytes Raw Blame History
1#!/bin/sh
2# Host only. Explicit DMA oracle replaces chan/dma.om at link time; no actual VFIO calls.
3set -eu
4R=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
5OMC=${OMC:-$R/build/omc}
6a=$(sha256sum "$OMC"); a=${a%% *}
7[ "$a" = bcfa582892afca8f65e551fe56867d918d86e84540c7381be8fa9ef18d0cf0f6 ] || exit 2
8t=$(mktemp -d /tmp/boot-dma.XXXXXX)
9trap 'rm -rf "$t"' EXIT HUP INT TERM
10sed 's/fn main to int/fn dmatests to int/' "$R/tests/dma_check.om" > "$t/dma.om"
11sed 's/fn main to int/fn artests to int/' "$R/tests/arena_trace.om" > "$t/arena.om"
12build() {
13 cat "$R/tests/dma_replay.om" "$R/chan/gmmu.om" "$R/chan/mem.om" "$R/chan/chan.om" "$R/chan/sim.om" "$t/dma.om" "$R/gsp/rpc.om" "$R/gsp/replay.om" "$R/gsp/sysinfo.om" "$R/chan/params.om" "$R/gsp/boot.om" "$R/gsp/arena.om" "$R/gsp/connect.om" "$t/arena.om" "$1" "$R/tests/boot_dma.om" > "$t/all.om"
14 if ! "$OMC" < "$t/all.om" > "$t/replay"; then echo 'boot_dma: INVALID compile'; exit 2; fi
15 chmod +x "$t/replay"
16}
17build "$R/gsp/owned.om"
18"$t/replay"
19echo 'boot_dma: PASS exact owned staging, generations, publication refusal and timeout quarantine; hardware NOT_RUN'
20sha256sum "$t/all.om" "$t/replay"
21sed 's/if not arstdata get mmwh 0 get arused 0/if false/' "$R/gsp/owned.om" > "$t/nocopy.om"
22build "$t/nocopy.om"
23if "$t/replay"; then echo 'boot_dma: SURVIVED staging'; exit 1; else rc=$?; fi
24[ "$rc" = 1 ] || { echo 'boot_dma: INVALID staging mutant'; exit 2; }
25sed 's/ret mmwquar gen/ret MMOK/' "$R/gsp/owned.om" > "$t/noquar.om"
26build "$t/noquar.om"
27if "$t/replay"; then echo 'boot_dma: SURVIVED quarantine'; exit 1; else rc=$?; fi
28[ "$rc" = 1 ] || { echo 'boot_dma: INVALID quarantine mutant'; exit 2; }
29echo 'boot_dma: PASS both behavior mutants detected; hardware NOT_RUN'