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 / turing / test_ty_energy_fixtures.sh
| 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 | # Synthetic input checks. These fixtures cannot qualify hardware measurement. |
| 18 | set -eu |
| 19 | RED=$1 |
| 20 | OUT=$2 |
| 21 | GEN=$3 |
| 22 | mkdir -p "$OUT" |
| 23 | case_run() { |
| 24 | name=$1; fault=$2; expected=$3 |
| 25 | dir=$OUT/$name |
| 26 | mkdir -p "$dir" |
| 27 | "$GEN" IDLE 0 none > "$dir/00-idle.jsonl" |
| 28 | "$GEN" A 2000000000 none > "$dir/01-a.jsonl" |
| 29 | "$GEN" B 4000000000 none > "$dir/02-b.jsonl" |
| 30 | "$GEN" AB 6000000000 "$fault" > "$dir/03-ab.jsonl" |
| 31 | "$RED" --check "$dir" > "$dir/result.txt" |
| 32 | grep -q "$expected" "$dir/result.txt" |
| 33 | } |
| 34 | case_run valid none 'ROUND S1 r1 OK' |
| 35 | case_run sensor sensor SENSOR_UNAVAILABLE |
| 36 | case_run wrap wrap COUNTER_WRAP |
| 37 | case_run overflow overflow COUNTER_WRAP |
| 38 | case_run oracle oracle PARTIAL_RUN |
| 39 | case_run multiplexed multiplexed PMU_MULTIPLEXED |
| 40 | mkdir -p "$OUT/missing-edge" |
| 41 | printf '%s\n' '{"run":"bad","config":"S1","level":"AB","tool_cpu":0}' > "$OUT/missing-edge/bad.jsonl" |
| 42 | "$RED" --check "$OUT/missing-edge" > "$OUT/missing-edge/result.txt" |
| 43 | grep -q BAD_ARGUMENT "$OUT/missing-edge/result.txt" |
| 44 | mkdir -p "$OUT/empty" "$OUT/malformed" |
| 45 | printf '%s\n' '[]' > "$OUT/malformed/bad.jsonl" |
| 46 | if "$RED" --check "$OUT/empty" >/dev/null 2>&1; then exit 1; fi |
| 47 | if "$RED" --check "$OUT/malformed" >/dev/null 2>&1; then exit 1; fi |
| 48 | printf '%s\n' 'ty_energy fixtures: nine valid/refusal cases passed' |