interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / scripts / ck_allen_code_test.sh

32 lines · 1871 bytes Raw Blame History
1#!/bin/sh
2# ck_allen_code_test.sh -- host test of code from the Spark: recorded model
3# replies (native/kernel/svc/tests/fixtures/code) turned into wire lines by
4# the courier itself (allen-courier --split, crates/allen-courier/src/code.rs)
5# and taken by the kernel's side (native/kernel/svc/allen_code.c): short code,
6# long code in many pieces, a lost piece asked again, a spoiled piece, hostile
7# lines, a slow and a silent Spark, the screen's rows and scroll, and Allen's
8# coding requests told from talk (svc/allen_intent.c). See
9# native/kernel/svc/tests/allen_code_test.c. Hosted only. Ends with
10# "AIENOS_ALLEN_CODE: PASS" or "AIENOS_ALLEN_CODE: FAIL <why>".
11set -u
12cd "$(dirname "$0")/.."
13K=native/kernel
14F=$K/svc/tests/fixtures/code
15W=$(mktemp -d "${TMPDIR:-/tmp}/ck_allen_code.XXXXXX")
16trap 'rm -rf "$W"' EXIT
17fail() { echo "AIENOS_ALLEN_CODE: FAIL $*"; exit 1; }
18CC=${HOSTCC:-cc}
19cargo build -q --release -p allen-courier --bin allen-courier || fail "allen-courier does not build"
20for n in short long; do
21 target/release/allen-courier --split "$F/$n.txt" > "$W/$n.wire" || fail "allen-courier --split $n"
22done
23$CC -std=c11 -D_DEFAULT_SOURCE -O1 -g -Wall -Wextra -Werror -fsanitize=address,undefined -fno-sanitize-recover=all \
24 -I$K/svc -o "$W/test" $K/svc/tests/allen_code_test.c $K/svc/allen_code.c $K/svc/allen_intent.c \
25 $K/svc/allen_reply.c $K/svc/allen_notes.c || fail "test does not build"
26"$W/test" "$F" "$W" || fail "code checks"
27# freestanding: the kernel side builds with no libc and no floating point
28$CC -std=c11 -ffreestanding -fno-builtin -nostdlib -O2 -Wall -Wextra -Werror -mgeneral-regs-only -I$K/svc \
29 -c -o "$W/code.o" $K/svc/allen_code.c || fail "allen_code.c is not freestanding"
30u=$(nm -u "$W/code.o" | grep -vE ' (memset|memcpy)$' || true)
31[ -z "$u" ] || fail "allen_code.c calls out: $u"
32echo "AIENOS_ALLEN_CODE: PASS"