interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / scripts / test-omega-checkout.sh

130 lines · 4876 bytes Raw Blame History
1#!/usr/bin/env bash
2# SPDX-License-Identifier: Apache-2.0
3# Copyright 2026 Drake Stapleton (AIEN / aien-dev)
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Pinned-checkout checks in the aien-omega-gpu build script (build::require_pinned_checkout).
18# Needs the pinned omega checkout (AIEN_OMEGA_DIR, from scripts/pins.sh --gpu). Each case runs
19# against a scratch clone of it, so the pinned checkout is never modified:
20# - a clean clone at omega.lock builds
21# - untracked and ignored files in the clone are allowed (they are not the source)
22# - a modified tracked file (seed/out/omc) is refused
23# - the same edit hidden with git update-index --assume-unchanged is refused
24# - the same edit hidden with git update-index --skip-worktree is refused
25# - a checkout at another commit is refused
26# - a prebuilt archive with a wrong sha256 is refused
27# Exit 0 when every case behaves, 1 otherwise, 2 when the pinned checkout is missing.
28set -euo pipefail
29ROOT=$(cd "$(dirname "$0")/.." && pwd)
30PINNED=${AIEN_OMEGA_DIR:-}
31if [ -z "$PINNED" ] || ! git -C "$PINNED" rev-parse -q --verify HEAD >/dev/null; then
32 echo "omega checkout: AIEN_OMEGA_DIR is not a git checkout (run scripts/pins.sh --gpu and source target/pins/env.sh)"
33 exit 2
34fi
35PHYSICS=${AIEN_PHYSICS_DIR:-$PINNED/../physics}
36WORK=$(mktemp -d)
37trap 'rm -rf "$WORK"' EXIT
38export CARGO_TARGET_DIR="${AIEN_CHECKOUT_TARGET_DIR:-$ROOT/target/omega-checkout}"
39for v in $(env | sed -n 's/^\(AIEN_[A-Z0-9_]*\)=.*/\1/p'); do unset "$v"; done
40export AIEN_PHYSICS_DIR="$PHYSICS"
41
42fails=0
43pass() { echo "ok $1"; }
44fail() { echo "FAIL $1"; fails=$((fails + 1)); }
45
46# expect_built <case> [VAR=value ...]
47expect_built() {
48 local name=$1
49 shift
50 if env "$@" cargo check -q -p aien-omega-gpu >"$WORK/log" 2>&1; then
51 pass "$name"
52 else
53 fail "$name (refused, rc $?)"
54 tail -5 "$WORK/log"
55 fi
56}
57
58# expect_refused <case> <pattern> [VAR=value ...]: cargo must exit 101 and print the pattern
59expect_refused() {
60 local name=$1 pat=$2 rc=0
61 shift 2
62 env "$@" cargo check -q -p aien-omega-gpu >"$WORK/log" 2>&1 || rc=$?
63 if [ "$rc" -ne 101 ]; then
64 fail "$name (rc $rc, expected 101)"
65 tail -5 "$WORK/log"
66 elif grep -qF -- "$pat" "$WORK/log"; then
67 pass "$name"
68 else
69 fail "$name (refused, but not with '$pat')"
70 tail -5 "$WORK/log"
71 fi
72}
73
74# fresh <dir>: a scratch clone of the pinned checkout, at the same commit
75fresh() {
76 rm -rf "$1"
77 git clone -q --no-checkout "$PINNED" "$1"
78 git -C "$1" checkout -q --detach "$(git -C "$PINNED" rev-parse HEAD)"
79}
80
81OMC=seed/out/omc
82C="$WORK/omega"
83cd "$ROOT"
84
85fresh "$C"
86expect_built "clean checkout at omega.lock builds" AIEN_OMEGA_DIR="$C"
87
88touch "$C/untracked-probe"
89echo probe >"$C/seed/out/ignored-probe.o"
90if git -C "$C" check-ignore -q seed/out/ignored-probe.o; then
91 expect_built "untracked and ignored files are allowed" AIEN_OMEGA_DIR="$C"
92else
93 fail "untracked and ignored files are allowed (seed/out/ignored-probe.o is not ignored in omega)"
94fi
95
96fresh "$C"
97printf x >>"$C/$OMC"
98expect_refused "modified tracked file is refused" "has uncommitted changes to tracked files" \
99 AIEN_OMEGA_DIR="$C"
100
101fresh "$C"
102git -C "$C" update-index --assume-unchanged "$OMC"
103printf x >>"$C/$OMC"
104expect_refused "edit hidden by assume-unchanged is refused" "assume-unchanged or skip-worktree" \
105 AIEN_OMEGA_DIR="$C"
106
107fresh "$C"
108git -C "$C" update-index --skip-worktree "$OMC"
109printf x >>"$C/$OMC"
110expect_refused "edit hidden by skip-worktree is refused" "assume-unchanged or skip-worktree" \
111 AIEN_OMEGA_DIR="$C"
112
113STALE="$WORK/stale"
114git init -q "$STALE"
115git -C "$STALE" -c user.name=t -c user.email=t@t commit -q --allow-empty -m stale
116expect_refused "checkout at another commit is refused" "is at '" AIEN_OMEGA_DIR="$STALE"
117
118ARCHIVE=$(find "$CARGO_TARGET_DIR/debug/build" -path '*aien-omega-gpu-*/out/omega-build/libomega_gpu.a' | head -1)
119if [ -n "$ARCHIVE" ]; then
120 expect_refused "prebuilt archive with a wrong sha256 is refused" "expects" \
121 AIEN_OMEGA_GPU_LIB="$ARCHIVE" AIEN_OMEGA_GPU_LIB_SHA256="$(printf '0%.0s' {1..64})"
122else
123 fail "prebuilt archive with a wrong sha256 is refused (the clean build left no archive)"
124fi
125
126if [ "$fails" -ne 0 ]; then
127 echo "omega checkout: $fails case(s) failed"
128 exit 1
129fi
130echo "omega checkout: all cases behave"