interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

branch main Branches Tags History

CUDApp / tests / omega / test-runner.sh

44 lines · 2179 bytes Raw Blame History
1#!/bin/sh
2# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3# Refusal paths for tests/omega/run.sh. No compiler checkout is required.
4set -eu
5R=$(cd "$(dirname "$0")/../.." && pwd)
6T=$(mktemp -d)
7trap 'rm -rf "$T"' EXIT HUP INT TERM
8fail() { echo "omega-runner-test: $*" >&2; exit 1; }
9PIN=$(sed -n 's/^PINNED_SOURCE=//p' "$R/tests/omega/run.sh")
10[ -n "$PIN" ] || fail "run.sh does not set PINNED_SOURCE"
11
12# A fresh checkout has no compiler harness configured.
13if env -u OMEGA_OSC_COMPILER_DIR "$R/tests/omega/run.sh" >"$T/missing.log" 2>&1; then
14 fail "missing harness unexpectedly passed"
15fi
16grep -q 'compiler harness not configured' "$T/missing.log" || fail "missing harness diagnostic"
17grep -q "$PIN" "$T/missing.log" || fail "missing harness did not name the pinned commit"
18
19# A missing named slice is reported before a compiler checkout is required.
20mkdir -p "$T/missing/tests/omega" "$T/missing/omega/slices"
21cp "$R/tests/omega/run.sh" "$T/missing/tests/omega/run.sh"
22for f in doorbell.osc sequencer.osc nvrm.osc va.osc open_plan.osc kmod.osc mesa.osc; do
23 : >"$T/missing/omega/slices/$f"
24done
25if "$T/missing/tests/omega/run.sh" >"$T/slice.log" 2>&1; then
26 fail "missing named slice unexpectedly passed"
27fi
28grep -q 'missing required slice .*launch.osc' "$T/slice.log" || fail "missing-slice diagnostic"
29
30# A checkout at another commit fails with the expected and found revisions.
31mkdir -p "$T/wrong/tests/omega" "$T/wrong/omega/slices" "$T/harness"
32cp "$R/tests/omega/run.sh" "$T/wrong/tests/omega/run.sh"
33cp "$R"/omega/slices/*.osc "$T/wrong/omega/slices/"
34env -u GIT_DIR -u GIT_WORK_TREE git -C "$T/harness" init -q
35env -u GIT_DIR -u GIT_WORK_TREE git -C "$T/harness" \
36 -c user.name=test -c user.email=test@example.invalid -c commit.gpgsign=false \
37 commit --allow-empty -qm wrong-pin
38if env -u GIT_DIR -u GIT_WORK_TREE OMEGA_OSC_COMPILER_DIR="$T/harness" \
39 "$T/wrong/tests/omega/run.sh" >"$T/version.log" 2>&1; then
40 fail "wrong harness source unexpectedly passed"
41fi
42grep -q "wrong harness source .*expected $PIN" "$T/version.log" || fail "wrong-version diagnostic"
43
44echo "omega-runner-test: PASS (missing harness, missing slice, wrong source pin)"