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/tools/r16_prod_refuses.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 / tools / r16_prod_refuses.sh` 92 lines ยท 4791 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 # Lane 32: negative build test. The production program must REFUSE, at build 18 # time, every test-only piece (docs/r16-production-entry-point.md). Each case 19 # compiles with the production flags (no AIEN_TEST_BUILD) and must FAIL with 20 # its guard's message; three controls must SUCCEED, so a failure is the guard, 21 # not a broken setup. Run by `make test-prod-refuses-test-pieces` (rx-host CI). 22 # 23 # Environment (set by the Makefile): CC, CFLAGS, ARGUS_SRC, OUT, MAKE, PROD_BIN. 24 set -u 25 : "${CC:=cc}" "${PROD_BIN:?}" "${CFLAGS?}" "${ARGUS_SRC:?}" "${OUT:?}" "${MAKE:=make}" 26 mkdir -p "$OUT" || exit 2 27 INC="-Isrc -Itests/runtime -Itests/fabric -Isrc/runtime -Isrc/fabric" 28 ARGUSF="-DRX_ARGUS=2 -DRX_ARGUS_AUTHORITY_OBSERVER -I$ARGUS_SRC" 29 PROD="$ARGUSF $INC" 30 bad=0; n=0 31 expect_fail() { # tag message-regex compile-args... 32 tag=$1; want=$2; shift 2; n=$((n + 1)) 33 # shellcheck disable=SC2086 34 if $CC $CFLAGS $PROD "$@" -c -o "$OUT/$tag.o" > "$OUT/$tag.log" 2>&1; then 35 echo "R16 refuse FAIL: $tag compiled in the production build (it must not)"; bad=1 36 elif grep -Eq "$want" "$OUT/$tag.log"; then 37 echo "R16 refuse: $tag refused at build time ($(grep -Eo "$want" "$OUT/$tag.log" | head -1))" 38 else 39 echo "R16 refuse FAIL: $tag failed to compile, but not on its guard ($want):" 40 head -5 "$OUT/$tag.log"; bad=1 41 fi 42 } 43 expect_ok() { # tag compile-args... 44 tag=$1; shift; n=$((n + 1)) 45 # shellcheck disable=SC2086 46 if $CC $CFLAGS "$@" -c -o "$OUT/$tag.o" > "$OUT/$tag.log" 2>&1; then 47 echo "R16 refuse: control $tag compiles" 48 else 49 echo "R16 refuse FAIL: control $tag does not compile:"; head -5 "$OUT/$tag.log"; bad=1 50 fi 51 } 52 53 guard='test and simulation only: build with -DAIEN_TEST_BUILD=1' 54 expect_fail fab_loopback "$guard" src/fabric/fab_loopback.c 55 expect_fail fab_hmac "$guard" src/fabric/fab_hmac.c 56 expect_fail fab_dispatch "$guard" src/fabric/fab_dispatch.c 57 printf '#include "fab_living_phase.h"\nint main(void) { return 0; }\n' > "$OUT/living_phase.c" 58 expect_fail fab_living_phase "$guard" "$OUT/living_phase.c" 59 expect_fail rxc_test_hooks 'RXC_TEST_HOOKS .*needs -DAIEN_TEST_BUILD=1' -DRXC_TEST_HOOKS src/runtime/rx_compose.c 60 # ARGUS flags left out: the production R13 source refuses to build. 61 n=$((n + 1)); tag=r13_without_argus 62 # shellcheck disable=SC2086 63 if $CC $CFLAGS $INC tests/runtime/rx_r13_living.c -c -o "$OUT/$tag.o" > "$OUT/$tag.log" 2>&1; then 64 echo "R16 refuse FAIL: $tag compiled without ARGUS (it must not)"; bad=1 65 elif grep -q "production R13 program links ARGUS" "$OUT/$tag.log"; then 66 echo "R16 refuse: $tag refused at build time (production R13 program links ARGUS)" 67 else 68 echo "R16 refuse FAIL: $tag failed, but not on its guard:"; head -5 "$OUT/$tag.log"; bad=1 69 fi 70 # Controls: the production R13 source and rx_compose.c compile in the 71 # production build; the Fabric loopback compiles in the test build. 72 expect_ok r13_production $PROD tests/runtime/rx_r13_living.c 73 expect_ok rx_compose_production $PROD src/runtime/rx_compose.c 74 expect_ok fab_loopback_testbuild -DAIEN_TEST_BUILD=1 -Isrc -Isrc/runtime -Isrc/fabric src/fabric/fab_loopback.c 75 76 # The Makefile refuses the flag in CFLAGS for the production binaries. Dry run 77 # (-n), only the production binary considered out of date (-W on its main 78 # source; the Makefile target builds it first, so no prerequisite is remade). 79 n=$((n + 1)) 80 if $MAKE --no-print-directory -n -W tests/runtime/rx_r13_living.c "CFLAGS=$CFLAGS -DAIEN_TEST_BUILD=1" "$PROD_BIN" \ 81 > "$OUT/make_flag.log" 2>&1; then 82 echo "R16 refuse FAIL: make accepted AIEN_TEST_BUILD in CFLAGS for the production program"; bad=1 83 elif grep -q 'the production program never builds with AIEN_TEST_BUILD' "$OUT/make_flag.log"; then 84 echo "R16 refuse: make refuses AIEN_TEST_BUILD in CFLAGS for the production program" 85 else 86 echo "R16 refuse FAIL: make failed, but not on the production guard:"; head -5 "$OUT/make_flag.log"; bad=1 87 fi 88 89 if [ $bad -ne 0 ]; then 90 echo "R16 prod: PROD_REFUSES_TEST_PIECES=FAIL ($n cases)"; exit 1 91 fi 92 echo "R16 prod: PROD_REFUSES_TEST_PIECES=PASS ($n cases: 6 refusals, 3 controls, 1 make guard)"