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
omega-mv / tests / omegatool_path / no_embedded_path_test.sh
| 1 | #!/usr/bin/env bash |
| 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 | # Build omegatool from a copy of this tree at a distinctive path against $PHYSICS_DIR and |
| 18 | # prove the binary contains neither the copy's absolute path nor the physics path, and |
| 19 | # that the same bytes come out of a second copy at a different path. Host only, no chip. |
| 20 | set -eu |
| 21 | here=$(cd "$(dirname "$0")/../.." && pwd) |
| 22 | phys=$(realpath "${PHYSICS_DIR:-../physics}") |
| 23 | tmp=$(mktemp -d /tmp/omega_nopath_XXXXXX); trap 'rm -rf "$tmp"' EXIT |
| 24 | dig="" |
| 25 | for n in alpha-checkout beta/deeper-checkout; do |
| 26 | d="$tmp/$n"; mkdir -p "$d" |
| 27 | tar -C "$here" --exclude=./build --exclude=./.git --exclude=./target -cf - . | tar -C "$d" -xf - |
| 28 | make -C "$d" -j4 PHYSICS_DIR="$phys" PHYSICS_LOCK_CHECK=0 OUT_DIR=build/np build/np/omegatool >/dev/null |
| 29 | b="$d/build/np/omegatool" |
| 30 | for needle in "$d" "$phys" "$tmp"; do |
| 31 | if grep -aqF -- "$needle" "$b"; then echo "FAIL: omegatool embeds '$needle'"; exit 1; fi |
| 32 | done |
| 33 | s=$(sha256sum "$b" | cut -c1-64) |
| 34 | if [ -n "$dig" ] && [ "$dig" != "$s" ]; then echo "FAIL: omegatool differs between checkout paths ($dig vs $s)"; exit 1; fi |
| 35 | dig=$s |
| 36 | done |
| 37 | echo "test-omegatool-path-embed: PASS (no checkout or physics path in omegatool; identical across two checkout paths, sha256 $dig)" |