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/test_m20_receipt_mutations_conversion_equiv.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 / test_m20_receipt_mutations_conversion_equiv.sh` 79 lines ยท 3559 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 # Proof that tools/m20_receipt_mutations.sh (now a thin adapter over 18 # tools/mutation_runner.sh) behaves exactly like the pre-conversion script 19 # from pinned commit `2dc9dd8`: same stdout bytes, same exit code, same 20 # per-mutant verdicts. Host only, CPU only, light. Run from anywhere. 21 # 22 # The old script is extracted into tools/ (it does cd dirname/..) under a 23 # temporary name and removed by a trap. Both sweeps run on the same tree. 24 # Nothing is normalised: the sweep prints no temp paths or timings, so the 25 # stdout is compared byte for byte. This sweep writes no JSON. 26 # A negative check proves the comparison can fail. 27 set -u 28 root=$(cd "$(dirname "$0")/.." && pwd) 29 cd "$root" || exit 2 30 PIN=`2dc9dd8` 31 tmp=$(mktemp -d "${TMPDIR:-/tmp}/m20-equiv.XXXXXX") || exit 2 32 old=tools/.m20_receipt_mutations_old.$$.sh 33 trap 'rm -rf "$tmp" "$root/$old"' EXIT INT TERM 34 35 git show "$PIN:tools/m20_receipt_mutations.sh" > "$old" || { echo "FAIL cannot extract old script from $PIN"; exit 2; } 36 chmod +x "$old" 37 38 sh "$old" > "$tmp/old.out" 2>&1; echo $? > "$tmp/old.rc" 39 sh tools/m20_receipt_mutations.sh > "$tmp/new.out" 2>&1; echo $? > "$tmp/new.rc" 40 41 # verdict list: " KILLED|SURVIVED|ERROR" from the MUTATION lines 42 verdicts() { 43 sed -n 's/^MUTATION \([A-Z0-9_]*\): caught.*/\1 KILLED/p; 44 s/^MUTATION \([A-Z0-9_]*\): NOT CAUGHT.*/\1 SURVIVED/p; 45 s/^MUTATION \([A-Z0-9_]*\): NOT APPLIED.*/\1 ERROR/p' "$1" 46 } 47 # compare OLDOUT OLDRC NEWOUT NEWRC: returns 0 only if identical 48 compare() { 49 cmp -s "$1" "$3" || return 1 50 [ "$(cat "$2")" = "$(cat "$4")" ] || return 1 51 [ "$(verdicts "$1")" = "$(verdicts "$3")" ] || return 1 52 return 0 53 } 54 55 fail=0 56 n=$(verdicts "$tmp/old.out" | wc -l) 57 if [ "$n" -lt 1 ]; then echo "FAIL old sweep produced no mutant verdicts"; fail=1; fi 58 if compare "$tmp/old.out" "$tmp/old.rc" "$tmp/new.out" "$tmp/new.rc"; then 59 echo "PASS old and new sweeps identical (stdout, exit code $(cat "$tmp/new.rc"), $n mutants compared)" 60 else 61 echo "FAIL old and new sweeps differ"; diff "$tmp/old.out" "$tmp/new.out" | head -10; fail=1 62 fi 63 64 # Negative check: one verdict line altered must be reported different. 65 sed '0,/: caught/s//: NOT CAUGHT/' "$tmp/new.out" > "$tmp/bad.out" 66 if compare "$tmp/old.out" "$tmp/old.rc" "$tmp/bad.out" "$tmp/new.rc"; then 67 echo "FAIL negative check: altered verdict was not detected"; fail=1 68 else 69 echo "PASS negative check: altered verdict line is reported different" 70 fi 71 # Negative check 2: a different exit code must be reported different. 72 echo 1 > "$tmp/bad.rc" 73 if compare "$tmp/old.out" "$tmp/old.rc" "$tmp/new.out" "$tmp/bad.rc" && [ "$(cat "$tmp/old.rc")" != 1 ]; then 74 echo "FAIL negative check: altered exit code was not detected"; fail=1 75 else 76 echo "PASS negative check: altered exit code is reported different" 77 fi 78 [ $fail -eq 0 ] && echo "m20 conversion equivalence: PASS" || echo "m20 conversion equivalence: FAIL" 79 exit $fail