diff --git a/.crumb b/.crumb index 81f377ee2..b5976805a 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": "a53fd94f4a9e12b7558de798b7102c11e252d78bee5c62a7ed3936b7e3a1bb27", + "last_commit": "3d0b81bf", "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-16T19:04:20Z", + "children_root": "sha256:7a510cecfa915e176d083279eed19c2a883a7241d43702bef85ad175279b2152", + "compiled_at": "2026-10-18T14:41:47Z", "compiler": "crumb-compile/1", - "digest": "sha256:32086cfe6b319e0c0229bec39553d1b32f7460aa660ad888d5eb5990522e705a", + "digest": "sha256:e3935bfe0832b1145285f34754d3126c7d65be29b02b662621ec3baa97aa1101", "evidence_files": 11127, "evidence_root": "sha256:4528085ec1661c442b64fb5dc8def65067ea2620ff88e42bcf52d58b7642ea6e", "files": 14109, - "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426", - "source_tree": "sha256:e01c9caa38757306582443fe69f52cb061c3d27250f8ad0b9f4b4f43b009dc14" + "generated_at_commit": "3d0b81bf0096741e0b8ebb1abeb8ff69dcda9cd3", + "source_tree": "sha256:ac0437abf81dd0d41b65e74aa0a20f65ea2037a2b6fb545d6c94c843a10ebc00" }, "owner_lane": "", "provenance": { diff --git a/tests/.crumb b/tests/.crumb index bd5535a8b..3ab412d31 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -296,14 +296,14 @@ } ], "children_root": "sha256:ddc3618190458bc5073e3bee67ffccc68a2ee9f065f2cb0d86545386a29fddf8", - "compiled_at": "2026-10-16T19:04:20Z", + "compiled_at": "2026-10-18T14:41:47Z", "compiler": "crumb-compile/1", - "digest": "sha256:4eb9d4d76234448c0ed691f0aeb9c90d785f8a47b1b1291d728bbe3e1509dc10", + "digest": "sha256:a53fd94f4a9e12b7558de798b7102c11e252d78bee5c62a7ed3936b7e3a1bb27", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", "files": 1270, - "generated_at_commit": "88e24bdd57b27817d030d0ad95f62c3f3eacf426", - "source_tree": "sha256:e6c4f0021d383ba2e59da0d85d06a0b98170f6d188289c891b5745200548e6fc" + "generated_at_commit": "3d0b81bf0096741e0b8ebb1abeb8ff69dcda9cd3", + "source_tree": "sha256:cdc9400c8b473b6e8c74415bc3853519d6b0dfb63c0a0078d164dbfc5fe0a8fe" }, "owner_lane": "", "provenance": { diff --git a/tests/r15_energy_preflight_test.sh b/tests/r15_energy_preflight_test.sh index ab7218cd8..85e2f0d32 100644 --- a/tests/r15_energy_preflight_test.sh +++ b/tests/r15_energy_preflight_test.sh @@ -18,7 +18,7 @@ EL=$(sed -n 's/^static const char \*const k_elabel\[[A-Z_0-9]*\] = {\(.*\)};/\1/ PL=$(sed -n 's/^static const char \*const k_plabel\[[A-Z_0-9]*\] = {\(.*\)};/\1/p' $C | tr -d '" ' | tr , ' ') [ "$(echo $EL | wc -w)" = 5 ] && [ "$(echo $PL | wc -w)" = 5 ] || { echo "[-] cannot read label tables from $C"; exit 1; } check() { # name expected-exit expected-text - out=$(R15_HWMON_ROOT="$W/$1" "$T" energy-preflight 2>&1); rc=$? + out=$(R15_HWMON_ROOT="$W/$1" "$T" energy-preflight 2>&1); rc=$?; : > "$W/$1.stop" # the preflight has returned: stop this case's background writer if [ "$rc" = "$2" ] && printf '%s\n' "$out" | grep -Fq -- "$3"; then echo "[+] $1: exit $rc" else echo "[-] $1: exit $rc (want $2), output: $out"; fail=$((fail + 1)); fi } @@ -27,9 +27,15 @@ mk() { # case: a complete, valid-looking reader tree (static counters) i=1; for l in $EL; do echo "$l" > "$H/energy${i}_label"; echo 5000000000 > "$H/energy${i}_input"; echo 0 > "$H/energy${i}_overflow_raw"; i=$((i + 1)); done i=1; for l in $PL; do echo "$l" > "$H/power${i}_label"; echo 20000000 > "$H/power${i}_input"; i=$((i + 1)); done } -# advance : package counter rises 0.5 J then 1 J in the background while the preflight samples +# advance : the package counter keeps rising (0.5 J every 20 ms) in the background until check() +# has run the preflight, so the three samples see a moving counter however slow the preflight is to start. +# The old writer stepped twice (50 ms and 150 ms) and then stopped; under the Spark judge, which runs ~21 gates at once, +# the preflight's own startup (bash, sed over r15_measure.c, label reads) took longer than 150 ms, every sample read the +# final value and "valid" failed with "package counter did not advance over 3 samples (5001100000 uJ)" (omega#508 judge +# run 2026-10-16 13:09Z; reproduced 6/15 on the host under 20 busy loops, 0/15 with this writer). Capped at 1500 steps +# (30 s, 750 J) so it always ends on its own; the cap keeps every fixture below the headroom and wrap thresholds. put() { echo "$2" > "$1.tmp" && mv "$1.tmp" "$1"; } # atomic, so the preflight never reads a half-written file -advance() { ( sleep 0.05; put "$W/$1/hwmon1/energy1_input" $(( $2 + 500000 )); sleep 0.1; put "$W/$1/hwmon1/energy1_input" $(( $2 + 1000000 )) ) & } +advance() { ( v=$2; k=0; while [ ! -e "$W/$1.stop" ] && [ $k -lt 1500 ]; do v=$((v + 500000)); put "$W/$1/hwmon1/energy1_input" $v; k=$((k + 1)); sleep 0.02; done ) & } mkdir -p "$W/absent/hwmon0"; echo acpitz > "$W/absent/hwmon0/name"; check absent 5 "reason=absent" mkdir -p "$W/empty"; check empty 5 "reason=absent" mk substitute; echo nvml > "$W/substitute/hwmon1/name"; check substitute 5 "reason=absent" @@ -60,7 +66,7 @@ R15_UPTIME_FILE="$W/wrapped-uptime" R15_ENERGY_PREFLIGHT_SLEEP=0.08 check wrappe mk nouptime; advance nouptime 5000000000; R15_UPTIME_FILE="$W/does-not-exist" R15_ENERGY_PREFLIGHT_SLEEP=0.08 check nouptime 5 "uptime"; wait # a decrease on any channel (not only package) invalidates the reader mk decr3; echo 5000000000 > "$W/decr3/hwmon1/energy1_input" -( k=0; while [ $k -lt 60 ]; do put "$W/decr3/hwmon1/energy3_input" $((5000000000 - k * 1000)); k=$((k + 1)); sleep 0.01; done ) & # steadily falling cpu_p counter +( k=0; while [ ! -e "$W/decr3.stop" ] && [ $k -lt 3000 ]; do put "$W/decr3/hwmon1/energy3_input" $((5000000000 - k * 1000)); k=$((k + 1)); sleep 0.01; done ) & # steadily falling cpu_p counter until check() returns (cap 30 s) advance decr3 5000000000 R15_ENERGY_PREFLIGHT_SLEEP=0.08 check decr3 5 "energy3 counter went backwards" wait