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-linked-compose.sh

89 lines · 5868 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# Mandatory gate for the tests that need the REAL omega composition library.
18#
19# The normal `cargo test --workspace` CI step builds the stub (no omega checkout), where every
20# compose-linked test is `#[ignore]`, so a failure in them never shows (sovereign-core #306: c25 failed
21# on main for days behind the stub). This script builds the library from an omega checkout at
22# omega.lock and RUNS those tests, ignored ones included. It fails if the library is not really linked
23# or if no linked test ran, so it cannot pass vacuously.
24#
25# Usage: scripts/test-linked-compose.sh OMEGA_DIR PHYSICS_DIR AIENOS_REPO
26# OMEGA_DIR omega checkout whose HEAD equals omega.lock
27# PHYSICS_DIR physics checkout at omega's physics.lock
28# AIENOS_REPO aienos clone holding omega's aienos.lock commit
29# Env: CARGO_TARGET_DIR (optional), LINKED_REPEAT (default 3: how many times the approved_attacks suite runs).
30# CPU only: never sets AIEN_OMEGA_DIR (that would link the GPU engine) and unsets the stub/fallback switches.
31set -euo pipefail
32ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
33OMW=$(cd "${1:?OMEGA_DIR}" && pwd); PHW=$(cd "${2:?PHYSICS_DIR}" && pwd); AO=$(cd "${3:?AIENOS_REPO}" && pwd)
34die() { echo "test-linked-compose: $*" >&2; exit 3; }
35pin=$(tr -d '[:space:]' <"$ROOT/omega.lock")
36[ "$(git -C "$OMW" rev-parse HEAD)" = "$pin" ] || die "omega HEAD != omega.lock $pin"
37[ "$(git -C "$PHW" rev-parse HEAD)" = "$(tr -d '[:space:]' <"$OMW/physics.lock")" ] || die "physics HEAD != omega physics.lock"
38[ "$(git -C "$AO" rev-parse HEAD)" = "$(tr -d '[:space:]' <"$OMW/aienos.lock")" ] || die "aienos HEAD != omega aienos.lock"
39REPEAT=${LINKED_REPEAT:-3}
40export AIEN_OMEGA_COMPOSE_DIR="$OMW" AIEN_PHYSICS_DIR="$PHW" AIEN_AIENOS_LOCK_REPO="$AO"
41unset AIEN_OMEGA_DIR AIEN_OMEGA_GPU_LIB AIEN_OMEGA_COMPOSE_LIB AIEN_OMEGA_COMPOSE_SHA AIEN_FORCE_CPU_STUB AIEN_DEV_FALLBACK
42cd "$ROOT"
43LOG=$(mktemp); trap 'rm -f "$LOG"' EXIT
44run() { # run test targets with --include-ignored; the tests are serial (one process-wide compose home)
45 cargo test "$@" -- --include-ignored --test-threads=1 2>&1 | tee -a "$LOG"
46}
47count() { # how many tests the targets hold, ignored ones included
48 cargo test "$@" -- --list --include-ignored 2>/dev/null | grep -c ": test$" || true
49}
50# Every aien-runtime test target, discovered from the directory so a new one is gated
51# automatically (sovereign-core #323: minted_grant_test, refusal_table_test and the rest
52# were linked-only and outside this gate). Left out, each needing what CI does not have:
53# prefill_e2e0/1/2 a real TinyLlama checkpoint (AIEN_E2E_CHECKPOINT).
54# aien-cli: compose_ordinary_flow_test and allen_concurrency_test (sc#325, real daemon + CLI,
55# no model) are gated. Outside this gate, in other crates: aien-cli recovery_matrix_test and
56# provenance_link_live_test (a real SmolLM2 on disk, minutes of CPU per case; run on the
57# Spark, receipts on the PR), and the GB10/real-checkpoint inference tests (heavy queue).
58# The aien-runtime library (unit) tests run too (`--lib`, sc#364): six of them open a compose home and take the
59# home_guard slot (sc#363); run() is serial (--test-threads=1) regardless.
60RT=() # 46 targets on 2026-10-08; the floor below catches a lost glob or a deleted target
61for f in "$ROOT"/crates/aien-runtime/tests/*.rs; do
62 t=$(basename "$f" .rs)
63 case "$t" in prefill_e2e*) continue ;; esac
64 RT+=(--test "$t")
65done
66[ "${#RT[@]}" -ge 90 ] || die "found only $((${#RT[@]} / 2)) aien-runtime test targets"
67# aien-omega-compose: the compose suite, callback safety (abi-qual) and the ABI manifest + native identity.
68OC=(--test compose --test callbacks --test abi_manifest)
69CLI=(--test compose_ordinary_flow_test --test allen_concurrency_test)
70ATT=$(count -p aien-runtime --test approved_attacks_test)
71ALL=$(( $(count -p aien-omega-compose "${OC[@]}") + $(count -p aien-runtime --lib) + $(count -p aien-runtime "${RT[@]}") + $(count -p aien-cli "${CLI[@]}") ))
72[ "$ATT" -gt 0 ] && [ "$ALL" -gt "$ATT" ] || die "could not list the linked tests"
73: >"$LOG"
74run -p aien-omega-compose "${OC[@]}"
75run -p aien-runtime --lib
76run -p aien-runtime "${RT[@]}"
77run -p aien-cli "${CLI[@]}"
78# The approved_attacks suite again (it once hid a race, #306): REPEAT runs in all.
79for i in $(seq 2 "$REPEAT"); do
80 echo "== approved_attacks run $i/$REPEAT"
81 run -p aien-runtime --test approved_attacks_test
82done
83# Not vacuous: the library was linked (no stub warning) and the tests really ran.
84if grep -q "building the stub" "$LOG"; then die "a stub was built: the composition library is not linked"; fi
85want=$(( ALL + ATT * (REPEAT - 1) ))
86ran=$(grep -E '^test result: ok\. [0-9]+ passed' "$LOG" | awk '{s += $4} END {print s + 0}')
87[ "$ran" -ge "$want" ] || die "only $ran linked tests passed (expected $want: $ALL linked tests + approved_attacks $ATT x $((REPEAT - 1)) more)"
88if grep -E '^test result:.* [1-9][0-9]* ignored' "$LOG" >/dev/null; then die "tests were still ignored"; fi
89echo "test-linked-compose: PASS ($ran linked tests passed: $ALL across compose + callbacks + abi_manifest, aien-runtime library tests, every aien-runtime test target but prefill_e2e*, aien-cli ordinary flow + ALLEN concurrency; approved_attacks x$REPEAT)"