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-pins.sh

54 lines · 3484 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# test-pins.sh: offline self-test of scripts/pins.sh with throwaway git repositories
18# (no network). Proves: correct pins pass (--check and a full run against a local mirror),
19# a checkout off its pin is refused (exit 3), a malformed lock is refused (exit 3), and
20# env.sh carries the three directories and the AIEN_OMEGA_DIR choice.
21set -euo pipefail
22ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
23T=$(mktemp -d); trap 'rm -rf "$T"' EXIT
24fail=0
25chk() { if eval "$1"; then echo " ok $2"; else echo " FAIL $2"; fail=1; fi; }
26mk() { # mk NAME [FILE CONTENT]...: a one-commit repo under $T/mirror/NAME, prints its sha
27 local d="$T/mirror/$1"; shift; mkdir -p "$d"
28 git -C "$d" init -q; while [ $# -ge 2 ]; do printf '%s\n' "$2" > "$d/$1"; shift 2; done
29 [ -n "$(ls -A "$d" | grep -v '^.git$')" ] || : > "$d/.keep"
30 git -C "$d" add -A; git -C "$d" -c user.name=t -c user.email=t@t commit -q -m pin; git -C "$d" rev-parse HEAD
31}
32P=$(mk physics); A=$(mk aienos); O=$(mk omega physics.lock "$P" aienos.lock "$A")
33mkdir -p "$T/root"; printf '%s\n' "$O" > "$T/root/omega.lock"
34run() { AIEN_PINS_ROOT="$T/root" AIEN_PINS_REMOTE_BASE="$T/mirror" bash "$ROOT/scripts/pins.sh" "$@"; }
35echo "test-pins: full run against a local mirror"
36chk 'run "$T/pins" >/dev/null' "pins.sh materializes omega, physics, aienos"
37chk '[ "$(git -C "$T/pins/omega" rev-parse HEAD)" = "$O" ]' "omega at omega.lock"
38chk '[ "$(git -C "$T/pins/physics" rev-parse HEAD)" = "$P" ]' "physics at omega physics.lock"
39chk '[ "$(git -C "$T/pins/aienos" rev-parse HEAD)" = "$A" ]' "aienos at omega aienos.lock"
40chk 'grep -q "AIEN_OMEGA_COMPOSE_DIR=.*pins/omega" "$T/pins/env.sh" && grep -q "unset AIEN_OMEGA_DIR" "$T/pins/env.sh"' "env.sh: composition only without --gpu"
41chk 'run --gpu "$T/pins" >/dev/null && grep -q "export AIEN_OMEGA_DIR=.*pins/omega" "$T/pins/env.sh"' "env.sh: --gpu sets AIEN_OMEGA_DIR"
42chk 'grep -q "AIEN_REQUIRE_NATIVE_LIBS=1" "$T/pins/env.sh"' "env.sh: stubs refused (AIEN_REQUIRE_NATIVE_LIBS=1)"
43chk 'run --check "$T/pins" >/dev/null' "--check passes when every clone is at its pin"
44echo "test-pins: refusals"
45git -C "$T/pins/physics" -c user.name=t -c user.email=t@t commit -q --allow-empty -m drift
46rc=0; run --check "$T/pins" >/dev/null 2>&1 || rc=$?
47chk '[ "$rc" -eq 3 ]' "--check refuses a checkout off its pin (exit 3, got $rc)"
48chk 'run "$T/pins" >/dev/null && [ "$(git -C "$T/pins/physics" rev-parse HEAD)" = "$P" ]' "a full run moves it back to the pin"
49printf 'not-a-sha\n' > "$T/root/omega.lock"
50rc=0; run "$T/pins" >/dev/null 2>&1 || rc=$?
51chk '[ "$rc" -eq 3 ]' "malformed omega.lock refused (exit 3, got $rc)"
52rc=0; run --bogus >/dev/null 2>&1 || rc=$?
53chk '[ "$rc" -eq 2 ]' "unknown flag is a usage error (exit 2, got $rc)"
54[ "$fail" -eq 0 ] && echo "test-pins: PASS" || { echo "test-pins: FAIL"; exit 1; }