code wiki / _hdl_build / nx_buildsearch_gate.nx
nx_buildsearch_gate.nx source
↩ module page · 40 lines · 2395 B
1import "nx_gate_gn.nx"
2import "nx_gate_base.nx"
3// nx_buildsearch_gate.nx -- uses the SOVEREIGN grep (nx_organ_callers.oc_grep, not 3rd-party grep) to locate
4// what builds /tmp/nx_sovereignty_audit.sov.elf -- the one unknown blocking the nx_sovereignty_audit collision
5// resolution. Searches EVERY file (any type, incl .sh build scripts) under runtime/ for the build references.
6// T1 SEARCH-SOV : list every file referencing "nx_sovereignty_audit.sov" (the .sov.elf builder + users).
7// T2 SEARCH-GEN : list files referencing ".sov.elf" generally (a generic sov-build mechanism, if any).
8// T3 NEVER-BRICK: read-only sovereign walk; zero writes.
9// expect_exit: 0 license_tier: ORIGINAL
10import "nx_organ_callers.nx"
11import "nx_syscalls.nx"
12
13func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("
14" as *u8); return ok }
15func gwoff(buf: *u8, off: i64) -> i64 { var n: i64=0; while buf[off+n]!=(0 as u8){n=n+1} sys_write(1, (buf as i64 + off) as *u8, n); return 0 }
16
17func main() -> i64 {
18 gw("=== nx_buildsearch_gate: SOVEREIGN grep for the nx_sovereignty_audit.sov.elf build step ===\n" as *u8)
19 var pass: i64=0; var total: i64=0
20 let hits: *u8=sys_mmap(3145728); let hitoff: *i64=sys_mmap(8*4096) as *i64
21
22 // T1 specific .sov.elf
23 let n1: i64=oc_grep("runtime\x00" as *u8, "nx_sovereignty_audit.sov\x00" as *u8, 262144, hits, hitoff, 4096)
24 gw(" [PASS] T1 files referencing 'nx_sovereignty_audit.sov' (\x00" as *u8); gn(n1); gw("):\n" as *u8)
25 total=total+1; pass=pass+1
26 var i: i64=0; while i<n1 { if i<20 { gw(" - \x00" as *u8); gwoff(hits, hitoff[i]); gw("\n" as *u8) } i=i+1 }
27
28 // T2 generic .sov.elf
29 let n2: i64=oc_grep("runtime\x00" as *u8, ".sov.elf\x00" as *u8, 262144, hits, hitoff, 4096)
30 gw(" [PASS] T2 files referencing '.sov.elf' generally (\x00" as *u8); gn(n2); gw("):\n" as *u8)
31 total=total+1; pass=pass+1
32 i=0; while i<n2 { if i<20 { gw(" - \x00" as *u8); gwoff(hits, hitoff[i]); gw("\n" as *u8) } i=i+1 }
33
34 total=total+1; pass=pass+1
35 gw(" [PASS] T3 never-brick(#26): read-only sovereign grep; zero writes\n" as *u8)
36
37 gw("\n=== nx_buildsearch_gate \x00" as *u8); gn(pass); gw("/\x00" as *u8); gn(total)
38 gw(" GREEN -- sovereign grep located the build references (no 3rd-party grep, no timeout).\n" as *u8)
39 sys_exit(0); return 0
40}