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 / crates / aien-serve-http / tests / version.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | //! `--version` prints the build identity without loading a model or touching the GPU, so |
| 17 | //! install.sh and tools/serve-27b.sh can refuse a binary that linked only the CPU stubs. |
| 18 | //! Host only: the engine lines say `native` or `STUB` depending on how this test was built. |
| 19 | |
| 20 | use std::process::Command; |
| 21 | |
| 22 | #[test] |
| 23 | fn version_prints_build_identity_and_exits_zero() { |
| 24 | let out = Command::new(env!("CARGO_BIN_EXE_aien-serve-http")) |
| 25 | .arg("--version") |
| 26 | .output() |
| 27 | .unwrap(); |
| 28 | assert!(out.status.success(), "exit {:?}", out.status); |
| 29 | let text = String::from_utf8(out.stdout).unwrap(); |
| 30 | for want in [ |
| 31 | "aien-serve-http ", |
| 32 | "omega.lock: ", |
| 33 | "omega gpu engine: ", |
| 34 | "qwen38 engine: ", |
| 35 | "default model dir: $HOME/models/qwen3.8-27b-fp8-017b9c7a", |
| 36 | ] { |
| 37 | assert!(text.contains(want), "missing {want:?} in:\n{text}"); |
| 38 | } |
| 39 | let pin = |
| 40 | std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/../../omega.lock")).unwrap(); |
| 41 | assert!( |
| 42 | text.contains(&format!("omega.lock: {}", pin.trim())), |
| 43 | "omega.lock line does not match the repository pin:\n{text}" |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | #[test] |
| 48 | fn version_wins_over_other_flags_and_loads_nothing() { |
| 49 | // A missing model dir would fail any real start; --version must not look at it. |
| 50 | let out = Command::new(env!("CARGO_BIN_EXE_aien-serve-http")) |
| 51 | .args([ |
| 52 | "--engine", |
| 53 | "omega", |
| 54 | "--model-dir", |
| 55 | "/nonexistent-version-test", |
| 56 | "--version", |
| 57 | ]) |
| 58 | .output() |
| 59 | .unwrap(); |
| 60 | assert!(out.status.success(), "exit {:?}", out.status); |
| 61 | assert!(String::from_utf8_lossy(&out.stdout).contains("qwen38 engine: ")); |
| 62 | } |