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