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_setup_wizard_test.sh

31 lines · 1834 bytes Raw Blame History
1#!/bin/sh
2# ck_setup_wizard_test.sh -- host test of Allen's setup wizard: the machine
3# inventory and host-description reader (native/kernel/svc/setup_inv.c) and
4# the wizard's screens, choices and records (native/kernel/svc/setup_wizard.c)
5# and their two copies on disk (native/kernel/svc/setup_store.c),
6# walked with keys and the clock against the three machine fixtures in
7# native/kernel/svc/tests/fixtures/setup. See
8# native/kernel/svc/tests/setup_wizard_test.c. Hosted only. Ends with
9# "AIENOS_SETUP_WIZARD: PASS" or "AIENOS_SETUP_WIZARD: FAIL <why>".
10set -u
11cd "$(dirname "$0")/.."
12K=native/kernel
13N=native
14W=$(mktemp -d "${TMPDIR:-/tmp}/ck_setup_wizard.XXXXXX")
15trap 'rm -rf "$W"' EXIT
16fail() { echo "AIENOS_SETUP_WIZARD: FAIL $*"; exit 1; }
17CC=${HOSTCC:-cc}
18$CC -std=c11 -D_DEFAULT_SOURCE -O2 -Wall -Wextra -Werror -fsanitize=address,undefined -fno-sanitize-recover=all \
19 -I$K/svc -I$N/disk -I$N/argus -o "$W/test" $K/svc/tests/setup_wizard_test.c $K/svc/setup_wizard.c $K/svc/setup_inv.c \
20 $K/svc/setup_store.c $N/disk/disk.c $N/disk/disk_file.c $N/argus/sha256.c ||
21 fail "test does not build"
22"$W/test" $K/svc/tests/fixtures/setup "$W" || fail "wizard checks"
23# freestanding: the two files build for the kernel with no libc
24$CC -std=c11 -ffreestanding -fno-builtin -nostdlib -O2 -Wall -Wextra -Werror -I$K/svc -c -o "$W/inv.o" $K/svc/setup_inv.c ||
25 fail "setup_inv.c is not freestanding"
26$CC -std=c11 -ffreestanding -fno-builtin -nostdlib -O2 -Wall -Wextra -Werror -I$K/svc -c -o "$W/wiz.o" $K/svc/setup_wizard.c ||
27 fail "setup_wizard.c is not freestanding"
28ld -r -o "$W/both.o" "$W/inv.o" "$W/wiz.o" || fail "the two objects do not link together"
29u=$(nm -u "$W/both.o" | grep -vE ' (memset|memcpy)$' || true)
30[ -z "$u" ] || fail "freestanding objects call out: $u"
31echo "AIENOS_SETUP_WIZARD: PASS"