From f8c708381672ec818febcabac859f90f0b2b2764 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 19 Oct 2026 14:56:01 -0500 Subject: [PATCH 1/2] tests: OMEGA-R11-OWN-HOLD judges the hold decision, not the machine load The gate failed on the shared Spark judge whenever the 1-minute load average was above 2: the program then refuses the living run for the load before it looks at the hold, so the case "QUIETLOCK_HOLD=q1-abc must run" could never pass (5 PASS in 38 judge runs, "refused, want ran") and the three "refused" cases were passing for the wrong reason. rx_r11_aien.c now decides whose quiet flag it is (none / this run's own hold / another measurement's hold) before and apart from the load, and prints it ("quiet flag: ..."). R11_LOAD_LIMIT can raise the load limit (never lower it), so the default behaviour of the program is unchanged. r11_own_hold_test.sh raises it for its own runs and requires, per case: refused cases name another measurement's hold, give the flag as the reason and never start the living run; the own-hold case reports its own hold, is not refused for the flag and starts the living run. The speed verdict of that living run is required to be "failures 0" whenever the machine was calm when it began (the condition it is specified for); on a loaded machine it is printed, not judged. Why not just judge CPU time: measured at load 25, wall clock build 4 of 20 failures; with the CPU-time clock of the R13 fix still 4 of 40 (AIEN acting on a preempted interval, "acted before anything changed"). The load limit is a real property of the living run. Red before green (Spark ~/workspace/hermes-desk/omega-lane/r11-evidence): main code and main test at load 20+: "hold='q1-abc': refused, want ran" (red-main-*.log). New code: 3 of 3 PASS under load (green-*.log). Three mutants of the new decision (flag read ignored, hold id compared by prefix, flag treated as always own) each fail 1 to 4 of the 4 cases (mut-m1..m3.log). Co-authored-by: Drake Stapleton --- tests/runtime/r11_own_hold_test.sh | 69 ++++++++++++++++++++++++++---- tests/runtime/rx_r11_aien.c | 44 +++++++++++++++---- 2 files changed, 97 insertions(+), 16 deletions(-) diff --git a/tests/runtime/r11_own_hold_test.sh b/tests/runtime/r11_own_hold_test.sh index d16128cc1..d2a833c2e 100755 --- a/tests/runtime/r11_own_hold_test.sh +++ b/tests/runtime/r11_own_hold_test.sh @@ -1,18 +1,71 @@ #!/bin/sh # R11 living run inside its own quiet hold (tests/runtime/rx_r11_aien.c -# quiet_flag_is_mine). With a fake HOME whose ~/workspace/.spark-quiet carries -# hold=q1-abc: no QUIETLOCK_HOLD, a prefix and an extension of the id must all -# refuse the living run (someone else's measurement); QUIETLOCK_HOLD=q1-abc -# must run it. usage: r11_own_hold_test.sh +# quiet_flag_state / quiet_flag_is_mine). With a fake HOME whose +# ~/workspace/.spark-quiet carries hold=q1-abc: no QUIETLOCK_HOLD, a prefix and +# an extension of the id must all be refused because of the flag (someone +# else's measurement); QUIETLOCK_HOLD=q1-abc must be let through to the living +# run. +# +# What is judged, and what is not. The program also refuses the living run +# when the machine is loaded (1-minute load average above 2). That is a second, +# unrelated reason, and on the shared Spark judge it is always true, so it +# used to hide the answer this test is about. The test therefore raises that +# limit for its own runs (R11_LOAD_LIMIT; it can only raise it) and reads +# the two decisions the program prints and takes: +# "quiet flag: " +# "[*] living run: ..." (printed when the living run starts) +# Refused cases: the flag line must say another measurement's hold, the reason +# given must be the flag, and the living run must not start. Own-hold case: the +# flag line must say this run's own hold and the living run must start. +# The physical verdict of that living run (its speed checks) is judged here +# only when the machine was calm when it began (1-minute load average <= 2, +# the condition the living run is specified for): then "checks N failures 0" +# is required, exactly as before. On a loaded machine its verdict is printed +# and not judged. Measured at load 25 with Omega's CPU-time clock (cost_ns), +# the living run still failed 4 of 40 runs (AIEN acting on a preempted +# interval), so the load limit is a real property of the living run, not noise +# in this test. A loaded machine is never a pass for that part; it is simply +# not this test's question, and test-r11 runs it where the machine is calm. +# usage: r11_own_hold_test.sh B=${1:?rx_r11_aien_test binary}; H=$(mktemp -d); fail=0 trap 'rm -rf "$H"' EXIT mkdir -p "$H/workspace" 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" +FLAG_WHY='holds ~/workspace/.spark-quiet' for hold in "" q1-ab q1-abcd q1-abc; do - out=$(HOME=$H QUIETLOCK_HOLD=$hold "$B" 2>&1) - if printf '%s\n' "$out" | grep -Fq "living run not exercised"; then got=refused; else got=ran; fi - if [ "$hold" = q1-abc ]; then want=ran; else want=refused; fi - printf '%s\n' "$out" | grep -Eq '^checks [0-9]+ failures 0$' || { got="$got+failures"; } + calm=$(awk '{ if ($1 <= 2.0) print "yes"; else print "no" }' /proc/loadavg) + out=$(HOME=$H QUIETLOCK_HOLD=$hold R11_LOAD_LIMIT=1000000 "$B" 2>&1) + flag=$(printf '%s\n' "$out" | sed -n 's/^quiet flag: //p' | head -n 1) + printf '%s\n' "$out" | grep -Fq '[*] living run:' && started=yes || started=no + printf '%s\n' "$out" | grep -Fq "$FLAG_WHY" && why_flag=yes || why_flag=no + if [ "$hold" = q1-abc ]; then + # let through: the flag is ours, the flag is not the reason, the living run starts + if [ "$flag" = "this run's own hold" ] && [ "$why_flag" = no ] && [ "$started" = yes ]; then + got=ran + else + got="refused or not started (flag='$flag', flag reason $why_flag, started $started)" + fi + want=ran + else + # refused because of the flag: it says so, gives it as the reason, and does not start + if [ "$flag" = "another measurement's hold" ] && [ "$why_flag" = yes ] && [ "$started" = no ]; then + got=refused + else + got="not refused by the flag (flag='$flag', flag reason $why_flag, started $started)" + fi + want=refused + fi + if [ "$got" = "$want" ] && [ "$want" = ran ]; then + line=$(printf '%s\n' "$out" | grep -E '^checks [0-9]+ failures [0-9]+$' | tail -n 1) + if [ "$calm" = yes ]; then + case "$line" in + "checks "*" failures 0") ;; + *) got="ran, but the calm-machine verdict was '$line', want failures 0" ;; + esac + else + echo "[~] hold='$hold': machine loaded, living run verdict not judged here ('$line'); test-r11 judges it on a calm machine" + fi + fi if [ "$got" = "$want" ]; then echo "[+] hold='$hold': $got"; else echo "[-] hold='$hold': $got, want $want"; fail=$((fail + 1)); fi done echo "failures $fail"; [ "$fail" = 0 ] diff --git a/tests/runtime/rx_r11_aien.c b/tests/runtime/rx_r11_aien.c index e1df1fdc5..6d5e2e8f2 100644 --- a/tests/runtime/rx_r11_aien.c +++ b/tests/runtime/rx_r11_aien.c @@ -668,15 +668,39 @@ static int quiet_flag_is_mine(const char *flag) { return 0; } +/* Whose measurement holds the quiet flag? Decided before and apart from the + * host load, so a loaded machine can never hide this answer: main prints it + * and tests/runtime/r11_own_hold_test.sh reads it. */ +enum { QUIET_FLAG_NONE, QUIET_FLAG_OWN, QUIET_FLAG_OTHER }; +static int quiet_flag_state(void) { + const char *home = getenv("HOME"); + char flag[512]; + snprintf(flag, sizeof flag, "%s/workspace/.spark-quiet", home ? home : ""); + if (access(flag, F_OK) != 0) return QUIET_FLAG_NONE; + return quiet_flag_is_mine(flag) ? QUIET_FLAG_OWN : QUIET_FLAG_OTHER; +} + +/* The 1-minute load average above which the living run is not started. + * R11_LOAD_LIMIT raises it (tests/runtime/r11_own_hold_test.sh does, to see + * the quiet-flag decision on a busy judge); it can never lower it, so the + * override cannot make a run pass that the default would refuse. */ +#define R11_LOAD_LIMIT_DEFAULT 2.0 +static double load_limit(void) { + const char *v = getenv("R11_LOAD_LIMIT"); + if (v && v[0]) { + char *end = NULL; + double d = strtod(v, &end); + if (end != v && *end == '\0' && d > R11_LOAD_LIMIT_DEFAULT) return d; + } + return R11_LOAD_LIMIT_DEFAULT; +} + /* A timed phase measures this host. When an R15 timed measurement is * running (its quiet flag exists or an R15 program is alive) or the machine * is already loaded, the numbers would describe the other work, so the * living run is not started. Same test as rx_plan_reuse.c. */ -static int other_load(char *why, size_t n) { - const char *home = getenv("HOME"); - char flag[512]; - snprintf(flag, sizeof flag, "%s/workspace/.spark-quiet", home ? home : ""); - if (access(flag, F_OK) == 0 && !quiet_flag_is_mine(flag)) { +static int other_load(int flag_state, char *why, size_t n) { + if (flag_state == QUIET_FLAG_OTHER) { snprintf(why, n, "an R15 timed measurement holds ~/workspace/.spark-quiet"); return 1; } @@ -706,8 +730,8 @@ static int other_load(char *why, size_t n) { if (fscanf(f, "%lf", &load) != 1) load = 0; fclose(f); } - if (load > 2.0) { - snprintf(why, n, "1-minute load average %.2f is above 2", load); + if (load > load_limit()) { + snprintf(why, n, "1-minute load average %.2f is above %.0f", load, load_limit()); return 1; } return 0; @@ -1016,7 +1040,11 @@ int main(void) { #if defined(__aarch64__) find_core_classes(); char why[128]; - if (g_nx > 0 && g_na > 0 && other_load(why, sizeof why)) { + int flag_state = quiet_flag_state(); + printf("quiet flag: %s\n", flag_state == QUIET_FLAG_NONE ? "none" + : flag_state == QUIET_FLAG_OWN ? "this run's own hold" + : "another measurement's hold"); + if (g_nx > 0 && g_na > 0 && other_load(flag_state, why, sizeof why)) { snprintf(g_b_skip_buf, sizeof g_b_skip_buf, "SKIPPED-LOADED: %s", why); g_b_skip = g_b_skip_buf; printf("[-] SKIPPED-LOADED: living run not started: %s\n", why); From a9447043ad80de640ac392d87413bf1a20ffad69 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Mon, 19 Oct 2026 14:56:14 -0500 Subject: [PATCH 2/2] crumb: recompile with the pinned tool Co-authored-by: Drake Stapleton --- .crumb | 14 +++++++------- tests/.crumb | 14 +++++++------- tests/runtime/.crumb | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.crumb b/.crumb index d121d2dad..741fd7d34 100644 --- a/.crumb +++ b/.crumb @@ -83,8 +83,8 @@ "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", - "last_commit": "88e24bdd", + "digest": "20c7c398addc23ce0f81a88be2adbc4409a2ce13b14e4aa2d300147168b31ecb", + "last_commit": "f8c70838", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, @@ -95,15 +95,15 @@ "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:e1a8c008214ad5dbc33a3e184d7e882dc56d1d50f9bd14c58f8773992961557e", - "compiled_at": "2026-10-18T21:10:38Z", + "children_root": "sha256:7e28fbba58834410aedcd83e7ea734e73628839e2a8036fbfe22d7f63fd39479", + "compiled_at": "2026-10-19T19:56:11Z", "compiler": "crumb-compile/1", - "digest": "sha256:be7220db494238bb4c33023d1df17286c35f947336bee5fc2e0405c136ec3e73", + "digest": "sha256:bd6dcee8ac4a5591126a6b429e3a5003e6e438a067a30e39a1d88a7226cba17c", "evidence_files": 11127, "evidence_root": "sha256:4528085ec1661c442b64fb5dc8def65067ea2620ff88e42bcf52d58b7642ea6e", "files": 14100, - "generated_at_commit": "f4a9849fb127f8d2d664dfc56890752ad180c507", - "source_tree": "sha256:21f93defce6c9ba159a4bd31083db787e156dfaa4afb80c3427cf88f732f8258" + "generated_at_commit": "f8c708381672ec818febcabac859f90f0b2b2764", + "source_tree": "sha256:4977dcb42e295014d0e6d7f40d8236ec189e21d8e52ddc6071b6d5e245f5b8fe" }, "owner_lane": "", "provenance": { diff --git a/tests/.crumb b/tests/.crumb index bd5535a8b..308f7e594 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -265,8 +265,8 @@ "purpose": "Reservoir tests (omega#440): Gate 1 simulator and readout checks against an independent binary64" }, { - "digest": "bc2b514054f69604a155900fb1884948a78e12b88a15852296cbea1f751055b2", - "last_commit": "501d555c", + "digest": "ec80e8f04ea208c845642747ff6919908043f94cd3f799236e3314c95fa78e22", + "last_commit": "f8c70838", "name": "runtime", "purpose": "Directory tests/runtime. Purpose not yet described by a human." }, @@ -295,15 +295,15 @@ "purpose": "Directory tests/visor. Purpose not yet described by a human." } ], - "children_root": "sha256:ddc3618190458bc5073e3bee67ffccc68a2ee9f065f2cb0d86545386a29fddf8", - "compiled_at": "2026-10-16T19:04:20Z", + "children_root": "sha256:8b1fa8de21f22614e411a10916d06409dfce97f34b5f8733ddd538963edbe2c7", + "compiled_at": "2026-10-19T19:56:11Z", "compiler": "crumb-compile/1", - "digest": "sha256:4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", + "digest": "sha256:20c7c398addc23ce0f81a88be2adbc4409a2ce13b14e4aa2d300147168b31ecb", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", "files": 1270, - "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426", - "source_tree": "sha256:e6c4f0021d383ba2e59da0d85d06a0b98170f6d188289c891b5745200548e6fc" + "generated_at_commit": "f8c708381672ec818febcabac859f90f0b2b2764", + "source_tree": "sha256:2a3b0a689f96b0d9fdc18f51255b60e213a5bbba7e7361f08438dfec0c52f5ee" }, "owner_lane": "", "provenance": { diff --git a/tests/runtime/.crumb b/tests/runtime/.crumb index 48918ae9f..669194b6c 100644 --- a/tests/runtime/.crumb +++ b/tests/runtime/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-13T02:12:57Z", + "compiled_at": "2026-10-19T19:56:11Z", "compiler": "crumb-compile/1", - "digest": "sha256:bc2b514054f69604a155900fb1884948a78e12b88a15852296cbea1f751055b2", + "digest": "sha256:ec80e8f04ea208c845642747ff6919908043f94cd3f799236e3314c95fa78e22", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 70, - "generated_at_commit": "95829f2abd7f66461b4ba153ea807f39e9d06db8", - "source_tree": "sha256:e037c5156071865094d0e60262d34ca920be2dd6f98e2603a1f0082330ba7841" + "generated_at_commit": "f8c708381672ec818febcabac859f90f0b2b2764", + "source_tree": "sha256:f15cbe419c0384fc935aafc4778099471e6c1ddf1ed4555fcf3b80bf1aae652f" }, "owner_lane": "", "provenance": {