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
aien-sovereign-core-mv / scripts / test-pins.sh
| 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. |
| 21 | set -euo pipefail |
| 22 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" |
| 23 | T=$(mktemp -d); trap 'rm -rf "$T"' EXIT |
| 24 | fail=0 |
| 25 | chk() { if eval "$1"; then echo " ok $2"; else echo " FAIL $2"; fail=1; fi; } |
| 26 | mk() { # 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 | } |
| 32 | P=$(mk physics); A=$(mk aienos); O=$(mk omega physics.lock "$P" aienos.lock "$A") |
| 33 | mkdir -p "$T/root"; printf '%s\n' "$O" > "$T/root/omega.lock" |
| 34 | run() { AIEN_PINS_ROOT="$T/root" AIEN_PINS_REMOTE_BASE="$T/mirror" bash "$ROOT/scripts/pins.sh" "$@"; } |
| 35 | echo "test-pins: full run against a local mirror" |
| 36 | chk 'run "$T/pins" >/dev/null' "pins.sh materializes omega, physics, aienos" |
| 37 | chk '[ "$(git -C "$T/pins/omega" rev-parse HEAD)" = "$O" ]' "omega at omega.lock" |
| 38 | chk '[ "$(git -C "$T/pins/physics" rev-parse HEAD)" = "$P" ]' "physics at omega physics.lock" |
| 39 | chk '[ "$(git -C "$T/pins/aienos" rev-parse HEAD)" = "$A" ]' "aienos at omega aienos.lock" |
| 40 | chk '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" |
| 41 | chk '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" |
| 42 | chk 'grep -q "AIEN_REQUIRE_NATIVE_LIBS=1" "$T/pins/env.sh"' "env.sh: stubs refused (AIEN_REQUIRE_NATIVE_LIBS=1)" |
| 43 | chk 'run --check "$T/pins" >/dev/null' "--check passes when every clone is at its pin" |
| 44 | echo "test-pins: refusals" |
| 45 | git -C "$T/pins/physics" -c user.name=t -c user.email=t@t commit -q --allow-empty -m drift |
| 46 | rc=0; run --check "$T/pins" >/dev/null 2>&1 || rc=$? |
| 47 | chk '[ "$rc" -eq 3 ]' "--check refuses a checkout off its pin (exit 3, got $rc)" |
| 48 | chk 'run "$T/pins" >/dev/null && [ "$(git -C "$T/pins/physics" rev-parse HEAD)" = "$P" ]' "a full run moves it back to the pin" |
| 49 | printf 'not-a-sha\n' > "$T/root/omega.lock" |
| 50 | rc=0; run "$T/pins" >/dev/null 2>&1 || rc=$? |
| 51 | chk '[ "$rc" -eq 3 ]' "malformed omega.lock refused (exit 3, got $rc)" |
| 52 | rc=0; run --bogus >/dev/null 2>&1 || rc=$? |
| 53 | chk '[ "$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; } |