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 / om / serve / e2e_test.om

123 lines · 3075 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note core/sovereign-core/om/serve/e2e_test.om
3note Integrated pure-Omega host runtime/CLI end-to-end test: composes kv_cache, scheduler,
4note http_auth, router, cli, sha256, kv_store, and closure verification in one unit.
5note Compose with:
6note si/directives/om2.om core/sovereign-core/om/scheduler/kv_cache.om
7note core/sovereign-core/om/scheduler/scheduler.om core/sovereign-core/om/serve/http_auth.om
8note core/sovereign-core/om/serve/router.om core/sovereign-core/om/serve/cli.om
9note om/tls/sha2.om core/sovereign-core/om/store/closure.om
10note core/sovereign-core/om/serve/e2e_test.om
11
12text e2_pass "PASS "
13text e2_fail "FAIL "
14text e2_nl "\n"
15text e2_ok "SOVEREIGN-CORE INTEGRATED RUNTIME E2E PASS\n"
16text e2_bad "SOVEREIGN-CORE INTEGRATED RUNTIME E2E FAIL\n"
17text e2_n1 "integrated_cli_auth_router_kv_closure_pos"
18text e2_n2 "integrated_negative_unauth_smuggling_bad_cli"
19
20text e2_tok "omega_sovereign_core_e2e_token_42"
21text e2_cli_ok "serve --port 18091 --max-tokens 2048 --model qwen-native-om"
22text e2_cli_bad "serve --port 0"
23text e2_req_chat "POST /v1/chat/completions HTTP/1.1\nHost: localhost\nAuthorization: Bearer omega_sovereign_core_e2e_token_42\nContent-Length: 71\n\n{\"model\":\"qwen-native-om\",\"messages\":[{\"role\":\"user\"}],\"max_tokens\":64}"
24text e2_req_noauth "POST /v1/chat/completions HTTP/1.1\nHost: localhost\nContent-Length: 71\n\n{\"model\":\"qwen-native-om\",\"messages\":[{\"role\":\"user\"}],\"max_tokens\":64}"
25text e2_req_smug "POST /v1/chat/completions HTTP/1.1\nTransfer-Encoding: chunked\nAuthorization: Bearer omega_sovereign_core_e2e_token_42\n\n0\n\n"
26
27global e2_fails ulong 1
28
29fn e2_w s view uchar * to void
30n = len s
31off = ulong 0
32while lt off n bound 256
33k = write 1 s off sub n off
34if le k 0
35break
36end
37off = add off ulong k
38end
39end
40
41fn e2_rep name view uchar * ok bool to void
42if ok
43e2_w e2_pass
44else
45e2_w e2_fail
46put e2_fails 0 add get e2_fails 0 1
47end
48e2_w name
49e2_w e2_nl
50end
51
52fn e2_http_lf src view uchar * to ulong
53buf = new uchar 512 0
54n = len src
55w = ulong 0
56for i ulong n bound 512
57b = get src i
58if eq b uchar 10
59put buf w uchar 13
60put buf add w 1 uchar 10
61w = add w 2
62else
63put buf w b
64w = add w 1
65end
66end
67ret srv_handle_http part buf 0 w
68end
69
70fn test_e2_pos to bool
71if ne cli_dispatch e2_cli_ok CLI_OK
72ret false
73end
74if or ne cli_cmd CLI_CMD_SERVE or ne cli_port 18091 ne cli_max_tokens 2048
75ret false
76end
77srv_auth_reset
78if not srv_auth_set_token e2_tok
79ret false
80end
81if ne e2_http_lf e2_req_chat 200
82ret false
83end
84if ne kv_init 16 8 512 0
85ret false
86end
87if ne kv_available_blocks 16
88ret false
89end
90ret true
91end
92
93fn test_e2_neg to bool
94if ne cli_dispatch e2_cli_bad CLI_ERR_BAD_PORT
95ret false
96end
97srv_auth_reset
98if ne e2_http_lf e2_req_chat 401
99ret false
100end
101if not srv_auth_set_token e2_tok
102ret false
103end
104if ne e2_http_lf e2_req_noauth 401
105ret false
106end
107if ne e2_http_lf e2_req_smug 400
108ret false
109end
110ret true
111end
112
113fn main to int
114put e2_fails 0 0
115e2_rep e2_n1 test_e2_pos
116e2_rep e2_n2 test_e2_neg
117if eq get e2_fails 0 0
118e2_w e2_ok
119ret 0
120end
121e2_w e2_bad
122ret 1
123end