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 / native / omega / allen / test-build.sh

47 lines · 1934 bytes Raw Blame History
1#!/bin/sh
2# Build orchestration tests. The actual program is compiled seeded Omega.
3set -eu
4[ "$#" = 2 ] || { echo 'usage: test-build.sh PINNED_COMPILER FRESH_OUTPUT' >&2; exit 64; }
5root=$(CDPATH= cd -- "$(dirname "$0")/../../.." && pwd)
6compiler=$1
7out=$2
8mkdir "$out"
9out=$(CDPATH= cd -- "$out" && pwd)
10cp "$compiler" "$out/compiler with spaces"
11chmod u+w "$out/compiler with spaces"
12export OMEGA_COMPILER="$out/compiler with spaces"
13build="$root/native/omega/allen/build-one.sh"
14probe="$root/native/omega/allen/tests/build-probe.om"
15"$build" "$probe" "$out/program with spaces"
16set +e
17"$out/program with spaces"
18rc=$?
19set -e
20[ "$rc" = 23 ]
21echo 'PASS relocated compiler and actual native program'
22before=$(sha256sum "$out/program with spaces")
23if "$build" "$probe" "$out/program with spaces"; then exit 1; fi
24[ "$(sha256sum "$out/program with spaces")" = "$before" ]
25echo 'PASS existing output preserved'
26ln -s "$out/missing-target" "$out/dangling"
27if "$build" "$probe" "$out/dangling"; then exit 1; fi
28[ -L "$out/dangling" ] && [ ! -e "$out/missing-target" ]
29echo 'PASS dangling output link refused'
30printf '\000' >> "$out/compiler with spaces"
31if "$build" "$probe" "$out/wrong-compiler"; then exit 1; fi
32[ ! -e "$out/wrong-compiler" ]
33echo 'PASS changed compiler refused before output creation'
34cp "$compiler" "$out/compiler with spaces"
35printf 'fn main to int\nret\nend\n' > "$out/invalid.om"
36if "$build" "$out/invalid.om" "$out/invalid-program"; then exit 1; fi
37[ ! -e "$out/invalid-program" ]
38echo 'PASS failed compilation publishes no executable'
39if "$build" "$probe"; then exit 1; fi
40OMEGA_COMPILER="$out/no-compiler"
41export OMEGA_COMPILER
42if "$build" "$probe" "$out/missing-compiler-output"; then exit 1; fi
43[ ! -e "$out/missing-compiler-output" ]
44echo 'PASS missing compiler and missing argument refused'
45leftovers=$(find "$out" -name '*.build.*' -print)
46[ -z "$leftovers" ]
47echo 'PASS no temporary build files retained'