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/runtime/r11_own_hold_test.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 / runtime / r11_own_hold_test.sh` 86 lines ยท 4750 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 # R11 living run inside its own quiet hold (tests/runtime/rx_r11_aien.c 18 # quiet_flag_state / quiet_flag_is_mine). With a fake HOME whose 19 # ~/workspace/.spark-quiet carries hold=q1-abc: no QUIETLOCK_HOLD, a prefix and 20 # an extension of the id must all be refused because of the flag (someone 21 # else's measurement); QUIETLOCK_HOLD=q1-abc must be let through to the living 22 # run. 23 # 24 # What is judged, and what is not. The program also refuses the living run 25 # when the machine is loaded (1-minute load average above 2). That is a second, 26 # unrelated reason, and on the shared Spark judge it is always true, so it 27 # used to hide the answer this test is about. The test therefore raises that 28 # limit for its own runs (R11_LOAD_LIMIT; it can only raise it) and reads 29 # the two decisions the program prints and takes: 30 # "quiet flag: " 31 # "[*] living run: ..." (printed when the living run starts) 32 # Refused cases: the flag line must say another measurement's hold, the reason 33 # given must be the flag, and the living run must not start. Own-hold case: the 34 # flag line must say this run's own hold and the living run must start. 35 # The physical verdict of that living run (its speed checks) is judged here 36 # only when the machine was calm when it began (1-minute load average <= 2, 37 # the condition the living run is specified for): then "checks N failures 0" 38 # is required, exactly as before. On a loaded machine its verdict is printed 39 # and not judged. Measured at load 25 with Omega's CPU-time clock (cost_ns), 40 # the living run still failed 4 of 40 runs (AIEN acting on a preempted 41 # interval), so the load limit is a real property of the living run, not noise 42 # in this test. A loaded machine is never a pass for that part; it is simply 43 # not this test's question, and test-r11 runs it where the machine is calm. 44 # usage: r11_own_hold_test.sh 45 B=${1:?rx_r11_aien_test binary}; H=$(mktemp -d); fail=0 46 trap 'rm -rf "$H"' EXIT 47 mkdir -p "$H/workspace" 48 echo "other quietlock X start=2026-10-05T00:00:00Z expected_end=2099-01-01T00:00:00Z pid=1 hold=q1-abc" > "$H/workspace/.spark-quiet" 49 FLAG_WHY='holds ~/workspace/.spark-quiet' 50 for hold in "" q1-ab q1-abcd q1-abc; do 51 calm=$(awk '{ if ($1 <= 2.0) print "yes"; else print "no" }' /proc/loadavg) 52 out=$(HOME=$H QUIETLOCK_HOLD=$hold R11_LOAD_LIMIT=`1000000` "$B" 2>&1) 53 flag=$(printf '%s\n' "$out" | sed -n 's/^quiet flag: //p' | head -n 1) 54 printf '%s\n' "$out" | grep -Fq '[*] living run:' && started=yes || started=no 55 printf '%s\n' "$out" | grep -Fq "$FLAG_WHY" && why_flag=yes || why_flag=no 56 if [ "$hold" = q1-abc ]; then 57 # let through: the flag is ours, the flag is not the reason, the living run starts 58 if [ "$flag" = "this run's own hold" ] && [ "$why_flag" = no ] && [ "$started" = yes ]; then 59 got=ran 60 else 61 got="refused or not started (flag='$flag', flag reason $why_flag, started $started)" 62 fi 63 want=ran 64 else 65 # refused because of the flag: it says so, gives it as the reason, and does not start 66 if [ "$flag" = "another measurement's hold" ] && [ "$why_flag" = yes ] && [ "$started" = no ]; then 67 got=refused 68 else 69 got="not refused by the flag (flag='$flag', flag reason $why_flag, started $started)" 70 fi 71 want=refused 72 fi 73 if [ "$got" = "$want" ] && [ "$want" = ran ]; then 74 line=$(printf '%s\n' "$out" | grep -E '^checks [0-9]+ failures [0-9]+$' | tail -n 1) 75 if [ "$calm" = yes ]; then 76 case "$line" in 77 "checks "*" failures 0") ;; 78 *) got="ran, but the calm-machine verdict was '$line', want failures 0" ;; 79 esac 80 else 81 echo "[~] hold='$hold': machine loaded, living run verdict not judged here ('$line'); test-r11 judges it on a calm machine" 82 fi 83 fi 84 if [ "$got" = "$want" ]; then echo "[+] hold='$hold': $got"; else echo "[-] hold='$hold': $got, want $want"; fail=$((fail + 1)); fi 85 done 86 echo "failures $fail"; [ "$fail" = 0 ]