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/aienux/blob/main/native/argus/tests/test_argus_containment_e2e.c # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. 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 `aienux / native / argus / tests / test_argus_containment_e2e.c` 98 lines ยท 5513 bytes Raw Blame History 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 17 #include "../argus_abi.h" 18 #include "../argus_core.h" 19 #include "../argus_contain.h" 20 #include "../bridge/argus_aegis_bridge.h" 21 22 #include 23 #include 24 #include 25 26 static int checks, failures; 27 #define CHECK(x) do { checks++; if(!(x)) { failures++; fprintf(stderr,"FAIL %s:%d: %s\n",__FILE__,__LINE__,#x); } } while(0) 28 29 int main(void) 30 { 31 AienosCapAdmin *admin=NULL; AienosCapView *view=NULL; AienosCapRef office={0}; 32 CHECK(aienos_cap_start(&admin,&view)==AIENOS_CAP_OK); 33 CHECK(aienos_cap_office(admin,&office)==AIENOS_CAP_OK); 34 35 void *core_mem=calloc(1,argus_core_footprint()); 36 void *contain_mem=calloc(1,argus_contain_footprint()); 37 void *gate_mem=calloc(1,aienos_contain_footprint()); 38 void *bridge_mem=calloc(1,argus_aegis_bridge_footprint()); 39 CHECK(core_mem&&contain_mem&&gate_mem&&bridge_mem); 40 ArgusCore *core=NULL; ArgusContain *contain=NULL; AienosContain *gate=NULL; 41 CHECK(argus_core_init(&core,core_mem,argus_core_footprint())==ARGUS_OK); 42 CHECK(argus_contain_init(&contain,contain_mem,argus_contain_footprint())==ARGUS_OK); 43 uint8_t machine[ARGUS_MACHINE_ID_LEN]={0}; machine[0]=0xA1; 44 ArgusAegisBridge *bridge=NULL; 45 CHECK(argus_aegis_bridge_init(&bridge,bridge_mem,argus_aegis_bridge_footprint(),core,contain, 46 &gate,view,machine)==ARGUS_OK); 47 48 ArgusEvent joined={0}; joined.version=ARGUS_ABI_VERSION; joined.class_=ARGUS_CLASS_SECURITY; 49 joined.kind=ARGUS_EV_MACHINE_JOINED; joined.outcome=ARGUS_OUTCOME_OK; 50 joined.flags=(uint16_t)(1u<=6 && core_health.events_rejected==0); 90 91 /* Stop callbacks before destroying the gate; this is part of its lifetime contract. */ 92 CHECK(aienos_cap_set_observer(admin,NULL,NULL)==AIENOS_CAP_OK); 93 aienos_contain_destroy(gate); argus_aegis_bridge_destroy(bridge); 94 aienos_cap_stop(admin,view); 95 free(bridge_mem); free(gate_mem); free(contain_mem); free(core_mem); 96 printf("ARGUS-1 bridge end-to-end: %d checks, %d failures\n",checks,failures); 97 return failures?1:0; 98 }