Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/blob/main/om/serve/e2e_test.om # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / om / serve / e2e_test.om` 123 lines ยท 3075 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note core/sovereign-core/om/serve/e2e_test.om 3 note Integrated pure-Omega host runtime/CLI end-to-end test: composes kv_cache, scheduler, 4 note http_auth, router, cli, sha256, kv_store, and closure verification in one unit. 5 note Compose with: 6 note si/directives/om2.om core/sovereign-core/om/scheduler/kv_cache.om 7 note core/sovereign-core/om/scheduler/scheduler.om core/sovereign-core/om/serve/http_auth.om 8 note core/sovereign-core/om/serve/router.om core/sovereign-core/om/serve/cli.om 9 note om/tls/sha2.om core/sovereign-core/om/store/closure.om 10 note core/sovereign-core/om/serve/e2e_test.om 11 12 text e2_pass "PASS " 13 text e2_fail "FAIL " 14 text e2_nl "\n" 15 text e2_ok "SOVEREIGN-CORE INTEGRATED RUNTIME E2E PASS\n" 16 text e2_bad "SOVEREIGN-CORE INTEGRATED RUNTIME E2E FAIL\n" 17 text e2_n1 "integrated_cli_auth_router_kv_closure_pos" 18 text e2_n2 "integrated_negative_unauth_smuggling_bad_cli" 19 20 text e2_tok "omega_sovereign_core_e2e_token_42" 21 text e2_cli_ok "serve --port 18091 --max-tokens 2048 --model qwen-native-om" 22 text e2_cli_bad "serve --port 0" 23 text 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}" 24 text 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}" 25 text 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 27 global e2_fails ulong 1 28 29 fn e2_w s view uchar * to void 30 n = len s 31 off = ulong 0 32 while lt off n bound 256 33 k = write 1 s off sub n off 34 if le k 0 35 break 36 end 37 off = add off ulong k 38 end 39 end 40 41 fn e2_rep name view uchar * ok bool to void 42 if ok 43 e2_w e2_pass 44 else 45 e2_w e2_fail 46 put e2_fails 0 add get e2_fails 0 1 47 end 48 e2_w name 49 e2_w e2_nl 50 end 51 52 fn e2_http_lf src view uchar * to ulong 53 buf = new uchar 512 0 54 n = len src 55 w = ulong 0 56 for i ulong n bound 512 57 b = get src i 58 if eq b uchar 10 59 put buf w uchar 13 60 put buf add w 1 uchar 10 61 w = add w 2 62 else 63 put buf w b 64 w = add w 1 65 end 66 end 67 ret srv_handle_http part buf 0 w 68 end 69 70 fn test_e2_pos to bool 71 if ne cli_dispatch e2_cli_ok CLI_OK 72 ret false 73 end 74 if or ne cli_cmd CLI_CMD_SERVE or ne cli_port 18091 ne cli_max_tokens 2048 75 ret false 76 end 77 srv_auth_reset 78 if not srv_auth_set_token e2_tok 79 ret false 80 end 81 if ne e2_http_lf e2_req_chat 200 82 ret false 83 end 84 if ne kv_init 16 8 512 0 85 ret false 86 end 87 if ne kv_available_blocks 16 88 ret false 89 end 90 ret true 91 end 92 93 fn test_e2_neg to bool 94 if ne cli_dispatch e2_cli_bad CLI_ERR_BAD_PORT 95 ret false 96 end 97 srv_auth_reset 98 if ne e2_http_lf e2_req_chat 401 99 ret false 100 end 101 if not srv_auth_set_token e2_tok 102 ret false 103 end 104 if ne e2_http_lf e2_req_noauth 401 105 ret false 106 end 107 if ne e2_http_lf e2_req_smug 400 108 ret false 109 end 110 ret true 111 end 112 113 fn main to int 114 put e2_fails 0 0 115 e2_rep e2_n1 test_e2_pos 116 e2_rep e2_n2 test_e2_neg 117 if eq get e2_fails 0 0 118 e2_w e2_ok 119 ret 0 120 end 121 e2_w e2_bad 122 ret 1 123 end