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_common_d.h # 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_common_d.h` 53 lines ยท 1730 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 /* test_common_d.h -- tiny check harness + event builder for lane D tests. */ 18 #ifndef TEST_COMMON_D_H 19 #define TEST_COMMON_D_H 20 #include "../argus_core.h" 21 #include "stub_lanes_d.h" 22 #include 23 #include 24 25 static int t_fail = 0, t_pass = 0; 26 #define CHECK(c) do { if (c) t_pass++; else { t_fail++; fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #c); } } while (0) 27 28 static inline void mid(uint8_t id[ARGUS_MACHINE_ID_LEN], uint32_t n) 29 { 30 memset(id, 0, ARGUS_MACHINE_ID_LEN); 31 id[0] = 0xA5; id[1] = (uint8_t)n; id[2] = (uint8_t)(n >> 8); 32 } 33 34 static inline void dg(uint8_t d[ARGUS_DIGEST_LEN], uint32_t n) 35 { 36 memset(d, 0, ARGUS_DIGEST_LEN); 37 d[31] = 0x5A; d[0] = (uint8_t)n; d[1] = (uint8_t)(n >> 8); 38 } 39 40 static inline ArgusEvent ev_make(uint16_t kind, uint64_t seq) 41 { 42 ArgusEvent e; 43 memset(&e, 0, sizeof e); 44 e.version = ARGUS_ABI_VERSION; 45 e.class_ = ARGUS_CLASS_SECURITY; 46 e.kind = kind; 47 e.outcome = ARGUS_OUTCOME_OK; 48 e.flags = ARGUS_FLAG_SYNTHETIC; 49 e.sequence = seq; 50 mid(e.machine_id, 1); 51 return e; 52 } 53 #endif