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/omega-mv/blob/main/tests/compiler/legacy_a64_callers.sh # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / compiler / legacy_a64_callers.sh` 74 lines ยท 3673 bytes Raw Blame History 1 #!/bin/sh 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # OSC-2 item 4: the legacy AArch64 writer (src/aarch64_encoder.c) takes no new callers. 18 # OSC-2 slice; not a general Omega compiler; no self-hosting. 19 # Lists every C source/header in the tree (tracked plus untracked, not ignored) that 20 # includes aarch64_encoder.h or names an aarch64_emit_* function and compares the set 21 # with tests/compiler/legacy_a64_allowlist.txt. Exit 1 with 22 # A64_LEGACY_NEW_CALLER a file not on the frozen list uses the writer 23 # A64_LEGACY_ALLOWLIST_STALE a listed file no longer uses it (drop the line) 24 # Usage: legacy_a64_callers.sh [--selftest] 25 # --selftest first proves both refusals fire on a synthetic tree (a new includer, a 26 # new direct caller, a stale list line), then checks the real tree. 27 # Last line on success: OSC2_LEGACY_CALLERS_PASS callers= [selftest=3/3] 28 set -eu 29 ROOT=$(cd "$(dirname "$0")/../.." && pwd -P) 30 cd "$ROOT" 31 LIST=tests/compiler/legacy_a64_allowlist.txt 32 T=$(mktemp -d) 33 trap 'rm -rf "$T"' EXIT 34 PAT='aarch64_encoder\.h|aarch64_emit_[a-z0-9_]+' 35 36 # compare : writes the refusal lines to , returns 1 if any 37 compare() { 38 : >"$T/found" 39 while IFS= read -r f; do 40 [ -f "$f" ] || continue 41 if grep -qE "$PAT" "$f"; then echo "$f" >>"$T/found"; fi 42 done <"$1" 43 LC_ALL=C sort -u "$T/found" >"$T/found.s" 44 grep -v '^#' "$2" | grep -v '^[[:space:]]*$' | LC_ALL=C sort -u >"$T/allow.s" 45 LC_ALL=C comm -23 "$T/found.s" "$T/allow.s" | sed 's/^/A64_LEGACY_NEW_CALLER /' >"$3" 46 LC_ALL=C comm -13 "$T/found.s" "$T/allow.s" | sed 's/^/A64_LEGACY_ALLOWLIST_STALE /' >>"$3" 47 [ ! -s "$3" ] 48 } 49 50 ST= 51 if [ "${1:-}" = --selftest ]; then 52 mkdir -p "$T/s" 53 printf '#include "aarch64_encoder.h"\n' >"$T/s/new_include.c" 54 printf 'int f(void) { return aarch64_emit_ret(0, 0, 0); }\n' >"$T/s/new_call.c" 55 printf 'int g(void) { return 0; }\n' >"$T/s/clean.c" 56 printf '%s\n' "$T/s/new_include.c" "$T/s/new_call.c" "$T/s/clean.c" >"$T/s/files" 57 printf '# test list\n%s\n' "$T/s/clean.c" >"$T/s/allow" 58 ok=0 59 if compare "$T/s/files" "$T/s/allow" "$T/s/out"; then :; fi 60 grep -qx "A64_LEGACY_NEW_CALLER $T/s/new_include.c" "$T/s/out" && ok=$((ok + 1)) 61 grep -qx "A64_LEGACY_NEW_CALLER $T/s/new_call.c" "$T/s/out" && ok=$((ok + 1)) 62 grep -qx "A64_LEGACY_ALLOWLIST_STALE $T/s/clean.c" "$T/s/out" && ok=$((ok + 1)) 63 [ "$(wc -l <"$T/s/out" | tr -d ' ')" = 3 ] || ok=0 64 if [ "$ok" != 3 ]; then cat "$T/s/out"; echo "selftest: refusals did not fire ($ok/3)"; echo "OSC2_LEGACY_CALLERS_FAIL"; exit 1; fi 65 ST=" selftest=3/3" 66 fi 67 68 if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then 69 git ls-files --cached --others --exclude-standard -- '*.c' '*.h' >"$T/files" 70 else 71 find . -path ./build -prune -o -type f \( -name '*.c' -o -name '*.h' \) -print | sed 's|^\./||' >"$T/files" 72 fi 73 if ! compare "$T/files" "$LIST" "$T/out"; then cat "$T/out"; echo "OSC2_LEGACY_CALLERS_FAIL"; exit 1; fi 74 echo "OSC2_LEGACY_CALLERS_PASS callers=$(wc -l <"$T/found.s" | tr -d ' ')$ST"