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/aien-sovereign-core-mv/blob/main/om/crumb-coverage/run.sh # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / om / crumb-coverage / run.sh` 114 lines ยท 5321 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # om/crumb-coverage/run.sh: .crumb coverage of this repository (DRA-95). 3 # Builds om/crumb-coverage/crumb-coverage.om with the pinned seeded omc and feeds it `git ls-files -z` 4 # from the repository root. It prints tracked_dirs, crumb_dirs and enforced_dirs (crumb directories with 5 # at least one invariant whose "Check: ..." resolves to an existing test function or script), plus every 6 # invariant whose check does not resolve. 7 # run.sh report for this repository (exit 0 every check resolves, 1 some do not); 8 # run.sh --self-test fixture repositories with positive cases and negative controls (exit 0 PASS, 1 FAIL). 9 # The shell only sequences; every count and judgment is made by the .om program. 10 # Compiler: AIEN_OMC (OMC and OMEGA_OMC are accepted too) must hash to omega.pin, else NOT_RUN (exit 77). 11 set -u 12 here=$(cd "$(dirname "$0")" && pwd) 13 root=$(cd "$here/../.." && pwd) 14 not_run() { echo "crumb-coverage: NOT_RUN $1: $2" >&2; printf 'AIEN-OBS not_run_reason "%s"\n' "$1"; exit 77; } 15 16 omc=${AIEN_OMC:-${OMC:-${OMEGA_OMC:-}}} 17 [ -n "$omc" ] || not_run omc_missing "set AIEN_OMC to omega-mv seed/out/omc at the commit in om/crumb-coverage/omega.pin" 18 [ -x "$omc" ] || not_run omc_missing "$omc is not executable" 19 pin=$(sed -n 's/^omc_sha256: //p' "$here/omega.pin") 20 got=$(sha256sum < "$omc" | cut -d' ' -f1) 21 [ "$got" = "$pin" ] || not_run omc_unpinned "omc sha256 $got, pinned $pin" 22 23 b=$(mktemp -d) 24 trap 'rm -rf "$b"' EXIT 25 { printf 'om2\n'; cat "$root/om/vendor/json.om" "$here/crumb-coverage.om"; } | "$omc" > "$b/cc" 2> "$b/cc.err" \ 26 || { echo "crumb-coverage: compile failed: $(cat "$b/cc.err")" >&2; exit 1; } 27 chmod 700 "$b/cc" 28 echo "crumb-coverage: omc_sha256 $got" 29 echo "crumb-coverage: binary_sha256 $(sha256sum < "$b/cc" | cut -d' ' -f1)" 30 31 if [ "${1:-}" != "--self-test" ]; then 32 [ $# -eq 0 ] || { echo "usage: om/crumb-coverage/run.sh [--self-test]" >&2; exit 2; } 33 echo "crumb-coverage: tree $(git -C "$root" rev-parse HEAD) (git ls-files: the index, staged changes included)" 34 git -C "$root" ls-files -z > "$b/list" || exit 3 35 cd "$root" && exec "$b/cc" < "$b/list" 36 fi 37 38 # ---- self-test: each case is a fresh git repository ---- 39 fail=0 40 newrepo() { rm -rf "$b/r" && mkdir -p "$b/r" && git -C "$b/r" init -q; } 41 put() { mkdir -p "$(dirname "$b/r/$1")" && printf '%s\n' "$2" > "$b/r/$1"; } 42 runcase() { # name want_rc grep_pattern... 43 name=$1 want=$2; shift 2 44 git -C "$b/r" add -A 45 git -C "$b/r" ls-files -z > "$b/list" 46 out=$(cd "$b/r" && "$b/cc" < "$b/list" 2>&1); rc=$? 47 printf '%s\n' "$out" | sed "s/^/ $name| /" 48 ok=1 49 [ "$rc" = "$want" ] || ok=0 50 for pat in "$@"; do printf '%s\n' "$out" | grep -qxF -- "$pat" || { ok=0; echo " $name| missing line: $pat"; }; done 51 if [ $ok = 1 ]; then echo "ok $name: exit $rc"; else echo "FAIL $name: exit $rc, want $want"; fail=1; fi 52 } 53 fixture() { 54 newrepo 55 put crates/x/tests/t.rs '#[test] 56 fn good_test() {}' 57 put crates/x/src/m.rs '#[cfg(test)] 58 mod tests { 59 #[test] 60 fn good_lib() {} 61 }' 62 put crates/x/src/lib.rs 'mod m; 63 #[test] 64 fn good_root() {}' 65 put scripts/check.sh 'exit 0' 66 put a/b/c.txt c 67 put a/d.txt d 68 } 69 70 fixture 71 put crates/x/.crumb '{"invariants": [ 72 "T holds. Check: cargo test -p x --test t -- --exact good_test", 73 "M holds. Check: cargo test -p x --lib -- --exact m::tests::good_lib", 74 "L holds. Check: cargo test -p x --lib -- --exact good_root", 75 "S holds. Check: sh scripts/check.sh"], "name": "x"}' 76 put .crumb '{"name": "root"}' 77 runcase resolved 0 'crumb-coverage tracked_dirs 8' 'crumb-coverage crumb_dirs 2' \ 78 'crumb-coverage enforced_dirs 1' 'crumb-coverage invariants 4 resolved 4 unresolved 0' \ 79 'crumb crates/x invariants 4 resolved 4' 'crumb . invariants 0 resolved 0' 80 81 fixture 82 put crates/x/.crumb '{"invariants": [ 83 "T holds. Check: cargo test -p x --test t -- --exact no_such_test", 84 "M holds. Check: cargo test -p x --lib -- --exact other::tests::good_lib", 85 "N holds and names no check", 86 "S holds. Check: sh scripts/missing.sh", 87 "W holds. Check: cargo test -p y --test t -- --exact good_test", 88 "A holds. Check: sh /etc/passwd"]}' 89 runcase unresolved-control 1 'crumb-coverage enforced_dirs 0' \ 90 'crumb-coverage invariants 6 resolved 0 unresolved 6' \ 91 'unresolved crates/x: T holds. Check: cargo test -p x --test t -- --exact no_such_test' \ 92 'unresolved crates/x: N holds and names no check' 93 94 fixture 95 ln -s t.rs "$b/r/crates/x/tests/u.rs" 96 put crates/x/.crumb '{"invariants": ["U holds. Check: cargo test -p x --test u -- --exact good_test"]}' 97 runcase symlink-control 1 'crumb-coverage invariants 1 resolved 0 unresolved 1' 98 99 fixture 100 put crates/x/.crumb '{"invariants": ["T holds. Check: cargo test -p x --test t -- --exact good_test",]}' 101 runcase bad-json-control 4 'crumb-coverage refused 4 crumb-json' 102 103 fixture 104 put crates/x/.crumb '{"invariants": "T holds. Check: sh scripts/check.sh"}' 105 runcase not-array-control 4 'crumb-coverage refused 4 invariants-not-array-of-strings' 106 107 newrepo 108 printf 'b\0a\0' > "$b/list" 109 out=$("$b/cc" < "$b/list" 2>&1); rc=$? 110 if [ $rc = 4 ] && [ "$out" = "crumb-coverage refused 4 paths-not-in-git-order" ]; then echo "ok unsorted-control: exit 4" 111 else echo "FAIL unsorted-control: exit $rc: $out"; fail=1; fi 112 113 if [ $fail = 0 ]; then echo "crumb-coverage self-test: PASS"; else echo "crumb-coverage self-test: FAIL"; fi 114 exit $fail