code wiki / _hdl_build / nx_engineer_gate_runner.nx

nx_engineer_gate_runner.nx source

↩ module page · 34 lines · 1579 B

1// nx_engineer_gate_runner.nx -- the ENGINEER's full-pipeline gate (verifier organ). 2// The old runners checked only a run's exit code, so a compiler error (empty .s -> 3// garbage binary) or a SIGSEGV could read as a PASS -- the exact blind spot that hid 4// the recent crash. This runs every gate through the WHOLE pipeline and classifies it 5// honestly: COMPILE-FAIL / LINK-FAIL / CRASH(signal) / FAIL(exit) / PASS. RACI: the 6// ENGINEER is responsible for this verdict; it does not fix (Doctor) or admit (Council). 7 8import "nx_engineer_crash.nx" 9 10const EGR_PASS: i64 = 0 11const EGR_COMPILE_FAIL: i64 = 1 12const EGR_LINK_FAIL: i64 = 2 13const EGR_CRASH: i64 = 3 14const EGR_FAIL: i64 = 4 15 16// classify one gate: compile (eng_compile) -> link (eng_link) -> run (eng_run). 17// out[0] receives the signal (CRASH) or exit code (FAIL); 0 otherwise. 18func eng_gate(compiler: *u8, src: *u8, sout: *u8, eout: *u8, capf: *u8, out: *i64) -> i64 { 19 out[0] = 0 20 if eng_compile(compiler, src, sout) < 0 { return EGR_COMPILE_FAIL } 21 if eng_link(sout, eout) != 0 { return EGR_LINK_FAIL } 22 let rc: i64 = eng_run(eout, capf) 23 if eng_crashed(rc) == 1 { out[0] = eng_signal(rc); return EGR_CRASH } 24 if rc != 0 { out[0] = rc; return EGR_FAIL } 25 return EGR_PASS 26} 27 28func egr_verdict_name(v: i64) -> *u8 { 29 if v == EGR_PASS { return "PASS" as *u8 } 30 if v == EGR_COMPILE_FAIL { return "COMPILE-FAIL" as *u8 } 31 if v == EGR_LINK_FAIL { return "LINK-FAIL" as *u8 } 32 if v == EGR_CRASH { return "CRASH" as *u8 } 33 return "FAIL" as *u8 34}