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_numeric_oracle_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_numeric_oracle_conversion_equiv.sh` 64 lines ยท 3437 bytes Raw Blame History 1 #!/bin/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 # Proof that tools/numeric_oracle_mutations.sh, now an adapter over 18 # tools/mutation_runner.sh, behaves exactly like the old standalone sweep from 19 # pinned commit `2dc9dd8`: same stdout, same exit code, same per-mutant verdicts. 20 # Host only, CPU only. Runs both full sweeps (13 mutants each) on the same tree. 21 # The old script is extracted into tools/ (it cd's to dirname/..) and removed by 22 # a trap. Normalised, and only this: temp directory paths such as /tmp/tmp.AbC123 23 # (replaced by TMPDIR). No timings appear in either script's output. 24 # The sweep is not a JSON writer, so there is no JSON to compare. 25 set -u 26 ROOT=$(cd -P "$(dirname "$0")/.." && pwd) 27 PIN=`2dc9dd8` 28 OLD=$ROOT/tools/.old_numeric_oracle_mutations.$$.sh 29 W=$(mktemp -d) 30 trap 'rm -f "$OLD"; rm -rf "$W"' EXIT INT TERM 31 git -C "$ROOT" show "$PIN:tools/numeric_oracle_mutations.sh" > "$OLD" || { echo "FAIL: cannot extract old script from $PIN"; exit 1; } 32 chmod +x "$OLD" 33 34 norm() { sed -E 's#/[^ :]*/tmp\.[A-Za-z0-9]+#TMPDIR#g' "$1"; } 35 verdicts() { norm "$1" | sed -n -E 's/^ \[(KILLED|SURVIVED|BROKEN)\] +([A-Za-z0-9_]+).*/\2 \1/p' | sed 's/BROKEN$/ERROR/'; } 36 # differs : 0 if any difference in stdout, exit code or verdict list. 37 differs() { 38 ! { diff <(norm "$1") <(norm "$3") >/dev/null && [ "$2" = "$4" ] && diff <(verdicts "$1") <(verdicts "$3") >/dev/null; } 39 } 40 41 bash "$OLD" > "$W/old.out" 2>&1; old_rc=$? 42 bash "$ROOT/tools/numeric_oracle_mutations.sh" > "$W/new.out" 2>&1; new_rc=$? 43 44 fails=0 45 n=$(verdicts "$W/old.out" | wc -l) 46 if [ "$n" -lt 1 ]; then echo "FAIL: old sweep produced no verdicts"; fails=$((fails + 1)); fi 47 if differs "$W/old.out" "$old_rc" "$W/new.out" "$new_rc"; then 48 echo "FAIL: old and new sweeps differ"; diff <(norm "$W/old.out") <(norm "$W/new.out") | head -20 49 echo "exit old=$old_rc new=$new_rc"; fails=$((fails + 1)) 50 else 51 echo "ok stdout, exit code ($new_rc) and verdict list identical" 52 fi 53 if [ "$(verdicts "$W/old.out")" != "$(verdicts "$W/new.out")" ]; then echo "FAIL: verdict lists differ"; fails=$((fails + 1)); fi 54 55 # Negative checks: the comparison must be able to fail. 56 sed '0,/\[KILLED\]/s//[SURVIVED]/' "$W/new.out" > "$W/alt.out" 57 if differs "$W/old.out" "$old_rc" "$W/alt.out" "$new_rc"; then echo "ok altered verdict line is reported different" 58 else echo "FAIL: comparison missed an altered verdict line"; fails=$((fails + 1)); fi 59 if differs "$W/old.out" "$old_rc" "$W/new.out" "$((new_rc + 1))"; then echo "ok altered exit code is reported different" 60 else echo "FAIL: comparison missed an altered exit code"; fails=$((fails + 1)); fi 61 62 echo "mutants compared: $n" 63 if [ "$fails" -eq 0 ]; then echo "numeric oracle conversion equivalence: PASS ($n mutants compared)"; exit 0; fi 64 echo "numeric oracle conversion equivalence: FAIL"; exit 1