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 / e2e_distill_test.sh

199 lines · 6812 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# Sovereign Distillation Workshop E2E Test Suite Runner
18# Strictly adheres to sovereign voice: zero em dashes, zero en dashes.
19
20set -euo pipefail
21
22SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23WORKSPACE_ROOT="${WORKSPACE_ROOT:-$(cd "${SCRIPT_DIR}/.." && pwd)}"
24RESULTS_FILE="${WORKSPACE_ROOT}/tests_results.json"
25
26TIER_SELECTION="all"
27FEATURE_FILTER=""
28VERBOSE=false
29OUTPUT_JSON=false
30
31usage() {
32 cat <<'USAGE_EOF'
33Usage: e2e_distill_test.sh [options]
34
35Options:
36 --all Execute all 4 test tiers (default: 140 tests)
37 --tier <1-4> Execute specific test tier:
38 1: Feature Coverage (65 tests across 13 features)
39 2: Boundary & Corner Cases (65 tests across 13 features)
40 3: Cross-Feature Combinations (5 tests)
41 4: Real-World Scenarios (5 tests)
42 --feature <pattern> Execute tests matching feature pattern (e.g. f01, f02, vault, sanitizer)
43 --json Output results in structured JSON format
44 -v, --verbose Enable verbose cargo output
45 -h, --help Show this help message
46USAGE_EOF
47}
48
49while [[ $# -gt 0 ]]; do
50 case "$1" in
51 --all)
52 TIER_SELECTION="all"
53 shift
54 ;;
55 --tier)
56 TIER_SELECTION="$2"
57 shift 2
58 ;;
59 --feature)
60 FEATURE_FILTER="$2"
61 shift 2
62 ;;
63 --json)
64 OUTPUT_JSON=true
65 shift
66 ;;
67 -v|--verbose)
68 VERBOSE=true
69 shift
70 ;;
71 -h|--help)
72 usage
73 exit 0
74 ;;
75 *)
76 echo "Unknown argument: $1" >&2
77 usage
78 exit 1
79 ;;
80 esac
81done
82
83cd "${WORKSPACE_ROOT}"
84
85TIER1_TARGET="tier1_features"
86TIER2_TARGET="tier2_boundary"
87TIER3_TARGET="tier3_cross_feature"
88TIER4_TARGET="tier4_real_world"
89
90run_tier() {
91 local target="$1"
92 local extra_filter="$2"
93 local cmd=("cargo" "test" "-p" "spark-adapters" "--test" "${target}")
94
95 if [[ -n "${extra_filter}" ]]; then
96 cmd+=("${extra_filter}")
97 fi
98
99 if [[ "${VERBOSE}" == "false" ]]; then
100 cmd+=("--" "--quiet")
101 fi
102
103 "${cmd[@]}" 2>&1 || true
104}
105
106parse_test_counts() {
107 local raw_output="$1"
108 local passed=0
109 local failed=0
110 local ignored=0
111
112 if grep -q "test result:" <<< "${raw_output}"; then
113 passed=$(grep "test result:" <<< "${raw_output}" | tail -n 1 | grep -oE '[0-9]+ passed' | awk '{print $1}')
114 failed=$(grep "test result:" <<< "${raw_output}" | tail -n 1 | grep -oE '[0-9]+ failed' | awk '{print $1}')
115 ignored=$(grep "test result:" <<< "${raw_output}" | tail -n 1 | grep -oE '[0-9]+ ignored' | awk '{print $1}')
116 fi
117
118 echo "${passed:-0} ${failed:-0} ${ignored:-0}"
119}
120
121TOTAL_PASSED=0
122TOTAL_FAILED=0
123TOTAL_IGNORED=0
124
125TIER1_P=0; TIER1_F=0; TIER1_I=0
126TIER2_P=0; TIER2_F=0; TIER2_I=0
127TIER3_P=0; TIER3_F=0; TIER3_I=0
128TIER4_P=0; TIER4_F=0; TIER4_I=0
129
130START_TIME=$(date +%s)
131
132if [[ "${TIER_SELECTION}" == "all" || "${TIER_SELECTION}" == "1" ]]; then
133 OUTPUT=$(run_tier "${TIER1_TARGET}" "${FEATURE_FILTER}")
134 read -r TIER1_P TIER1_F TIER1_I <<< "$(parse_test_counts "${OUTPUT}")"
135fi
136
137if [[ "${TIER_SELECTION}" == "all" || "${TIER_SELECTION}" == "2" ]]; then
138 OUTPUT=$(run_tier "${TIER2_TARGET}" "${FEATURE_FILTER}")
139 read -r TIER2_P TIER2_F TIER2_I <<< "$(parse_test_counts "${OUTPUT}")"
140fi
141
142if [[ "${TIER_SELECTION}" == "all" || "${TIER_SELECTION}" == "3" ]]; then
143 OUTPUT=$(run_tier "${TIER3_TARGET}" "${FEATURE_FILTER}")
144 read -r TIER3_P TIER3_F TIER3_I <<< "$(parse_test_counts "${OUTPUT}")"
145fi
146
147if [[ "${TIER_SELECTION}" == "all" || "${TIER_SELECTION}" == "4" ]]; then
148 OUTPUT=$(run_tier "${TIER4_TARGET}" "${FEATURE_FILTER}")
149 read -r TIER4_P TIER4_F TIER4_I <<< "$(parse_test_counts "${OUTPUT}")"
150fi
151
152TOTAL_PASSED=$((TIER1_P + TIER2_P + TIER3_P + TIER4_P))
153TOTAL_FAILED=$((TIER1_F + TIER2_F + TIER3_F + TIER4_F))
154TOTAL_IGNORED=$((TIER1_I + TIER2_I + TIER3_I + TIER4_I))
155TOTAL_RUN=$((TOTAL_PASSED + TOTAL_FAILED))
156
157END_TIME=$(date +%s)
158DURATION=$((END_TIME - START_TIME))
159
160cat <<JSON_EOF > "${RESULTS_FILE}"
161{
162 "timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
163 "tier_selection": "${TIER_SELECTION}",
164 "total_executed": ${TOTAL_RUN},
165 "passed": ${TOTAL_PASSED},
166 "failed": ${TOTAL_FAILED},
167 "ignored": ${TOTAL_IGNORED},
168 "duration_seconds": ${DURATION},
169 "tiers": {
170 "tier1": { "passed": ${TIER1_P}, "failed": ${TIER1_F} },
171 "tier2": { "passed": ${TIER2_P}, "failed": ${TIER2_F} },
172 "tier3": { "passed": ${TIER3_P}, "failed": ${TIER3_F} },
173 "tier4": { "passed": ${TIER4_P}, "failed": ${TIER4_F} }
174 }
175}
176JSON_EOF
177
178if [[ "${OUTPUT_JSON}" == "true" ]]; then
179 cat "${RESULTS_FILE}"
180else
181 echo "========================================================================"
182 echo "Sovereign Distillation Workshop: E2E Opaque-Box Test Suite Execution"
183 echo "========================================================================"
184 printf "%-10s %-32s %-10s %-10s\n" "TIER" "DESCRIPTION" "PASSED" "FAILED"
185 echo "------------------------------------------------------------------------"
186 printf "%-10s %-32s %-10s %-10s\n" "Tier 1" "Feature Coverage (13 Features)" "${TIER1_P}" "${TIER1_F}"
187 printf "%-10s %-32s %-10s %-10s\n" "Tier 2" "Boundary & Corner Cases" "${TIER2_P}" "${TIER2_F}"
188 printf "%-10s %-32s %-10s %-10s\n" "Tier 3" "Cross-Feature Combinations" "${TIER3_P}" "${TIER3_F}"
189 printf "%-10s %-32s %-10s %-10s\n" "Tier 4" "Real-World Scenarios (DGX Spark)" "${TIER4_P}" "${TIER4_F}"
190 echo "------------------------------------------------------------------------"
191 printf "%-10s %-32s %-10s %-10s\n" "TOTAL" "All Categories" "${TOTAL_PASSED}" "${TOTAL_FAILED}"
192 echo "========================================================================"
193 echo "Duration: ${DURATION}s | Results saved to: ${RESULTS_FILE}"
194 if [[ ${TOTAL_FAILED} -gt 0 ]]; then
195 echo "Status: ${TOTAL_FAILED} tests failing (maps to active milestone implementations)."
196 else
197 echo "Status: ALL TESTS PASSED."
198 fi
199fi