nx_rigfloor_gate.nx
buildroot/runtime/nx_rigfloor_gate.nx
about
nx_rigfloor_gate.nx -- THE GATE FOR THE DERIVED ASSET FLOOR.
SUBJECT: the nx_rigfloor ELF, forked for real. The organ's whole contract is its FOUR-STATE EXIT
(0 OK / 1 OUT-OF-BAND / 2 usage / 3 UNOBSERVABLE), and /api/gate_run derives its verdict from an
exit code, so a gate that inspected only stdout would test the least load-bearing half. Every
tooth here asserts an EXIT CODE, and the content teeth additionally read the conf that was
actually written.
FIXTURES ARE ASSEMBLED AT RUNTIME, IN /tmp/nx_rigfloor_gate/. Two reasons, both measured in this
estate: a detector that scans source will find its own test fixture (writing the pattern in a
COMMENT re-arms the trap), and a gate that shares scratch with a production beat reports on the
FIXTURE rather than the code -- segguard folded a real store mid-run and the gate blamed the
subject. Scratch is created by sys_mkdir at SETUP, because a teardown does not run when a run
crashes.
THE ANTI-VACUITY TOOTH IS T2, AND IT IS THE POINT. T1 only proves the organ exited 0. A floor
organ that wrote a hardcoded conf and exited 0 would pass T1 forever. T2 asserts the fixture
REACHED THE CONDITION (n_read equals the rows the roster declared) and T3 asserts the emitted
band actually SPANS the fixture values -- i.e. that the number was MEASURED, not emitted. A
green here without T2/T3 would be the gates-green-on-garbage class.
THE NEGATIVE CONTROL IS T5, PAIRED WITH T4 THROUGH gv_bite: an asset inside the band must score
IN-BAND and an asset outside it must score OUT-OF-BAND. A guard that refuses everything passes
every deny-test, so the ALLOW case is not decoration -- it is the half that catches it.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 32 | const RG_SUBJECT_DEFAULT: *u8 = "_offc/nx_rigfloor.elf" |
| 35 | const RG_EXIT_OK: i64 = 0 |
| 36 | const RG_EXIT_OUT_OF_BAND: i64 = 1 |
| 37 | const RG_EXIT_UNOBSERVABLE: i64 = 3 |
| 40 | const RG_HDR_BYTES: i64 = 32 |
| 41 | const RG_SECHDR_BYTES: i64 = 32 |
| 42 | const RG_SEC_OFF_FIELD: i64 = 8 |
| 43 | const RG_NSEC_FIELD: i64 = 16 |
| 44 | const RG_VERSION_FIELD: i64 = 8 |
| 45 | const RG_WORD_BYTES: i64 = 8 |
| 46 | const RG_TAG_BYTES: i64 = 4 |
| 47 | const RG_NXA_VERSION: i64 = 1 |
| 48 | const RG_SECTIONS: i64 = 3 // VERT, TRIS, SKEL -- the three this organ measures |
| 49 | const RG_BYTE_RADIX: i64 = 256 |
| 50 | const RG_BYTE_MASK: i64 = 255 |
| 55 | const RG_A_VERTS: i64 = 5000 |
| 56 | const RG_A_TRIS: i64 = 9000 |
| 57 | const RG_A_JOINTS: i64 = 50 |
| 58 | const RG_B_VERTS: i64 = 7000 |
| 59 | const RG_B_TRIS: i64 = 13000 |
| 60 | const RG_B_JOINTS: i64 = 60 |
| 61 | const RG_C_VERTS: i64 = 9000 |
| 62 | const RG_C_TRIS: i64 = 17000 |
| 63 | const RG_C_JOINTS: i64 = 70 |
| 65 | const RG_IN_VERTS: i64 = 7000 |
| 66 | const RG_IN_TRIS: i64 = 13000 |
| 67 | const RG_IN_JOINTS: i64 = 60 |
| 69 | const RG_OUT_VERTS: i64 = 900000 |
| 70 | const RG_OUT_TRIS: i64 = 1700000 |
| 71 | const RG_OUT_JOINTS: i64 = 65 |
| 73 | const RG_CAPTURE_CAP: i64 = 262144 |
| 74 | const RG_PATH_CAP: i64 = 4096 |
| 75 | const RG_ARGV_SLOTS: i64 = 8 |
| 76 | const RG_MODE_DIR: i64 = 493 // 0755 |
| 77 | const RG_ASCII_NL: i64 = 10 |
| 78 | const RG_ASCII_EQ: i64 = 61 |
| 79 | const RG_ASCII_ZERO: i64 = 48 |
| 80 | const RG_ASCII_NINE: i64 = 57 |
| 81 | const RG_DECIMAL: i64 = 10 |
| 82 | const RG_MISS: i64 = 0 - 999999 |
| 84 | const RG_DIR: *u8 = "/tmp/nx_rigfloor_gate" |
| 85 | const RG_A: *u8 = "/tmp/nx_rigfloor_gate/a.nxa" |
| 86 | const RG_B: *u8 = "/tmp/nx_rigfloor_gate/b.nxa" |
| 87 | const RG_C: *u8 = "/tmp/nx_rigfloor_gate/c.nxa" |
| 88 | const RG_IN: *u8 = "/tmp/nx_rigfloor_gate/in.nxa" |
| 89 | const RG_OUT: *u8 = "/tmp/nx_rigfloor_gate/out.nxa" |
| 90 | const RG_ROSTER_OK: *u8 = "/tmp/nx_rigfloor_gate/ok.roster" |
| 91 | const RG_ROSTER_ONE: *u8 = "/tmp/nx_rigfloor_gate/one.roster" |
| 92 | const RG_ROSTER_BAD: *u8 = "/tmp/nx_rigfloor_gate/bad.roster" |
| 93 | const RG_CONF: *u8 = "/tmp/nx_rigfloor_gate/floor.conf" |
| 94 | const RG_CONF_ONE: *u8 = "/tmp/nx_rigfloor_gate/one.conf" |
| 95 | const RG_CONF_BAD: *u8 = "/tmp/nx_rigfloor_gate/bad.conf" |
| 96 | const RG_CONF_HOLED: *u8 = "/tmp/nx_rigfloor_gate/holed.conf" |
| 97 | const RG_NOSUCH: *u8 = "/tmp/nx_rigfloor_gate/no_such_roster_at_all" |
| 98 | const RG_ROSTER_SAME: *u8 = "/tmp/nx_rigfloor_gate/same.roster" |
| 99 | const RG_CONF_SAME: *u8 = "/tmp/nx_rigfloor_gate/same.conf" |
| 100 | const RG_CONF_XCONT: *u8 = "/tmp/nx_rigfloor_gate/xcont.conf" |
| 102 | const RG_U32_BYTES: i64 = 4 |
| 103 | const RG_MSH_MAGIC_LEN: i64 = 6 // "NXMSH2"; bytes +6/+7 stay zero |
| 104 | const RG_MSH_HDR: i64 = 16 |
| 105 | const RG_MSH_LAYROW: i64 = 24 |
| 106 | const RG_MSH_TRIREC: i64 = 84 // 21 float32: 9 position + 9 normal + 3 per-tri colour |
| 107 | const RG_MSH_NLAY_OFF: i64 = 8 |
| 108 | const RG_MSH_NTRI_OFF: i64 = 12 |
| 109 | const RG_MSH_LAY_OFF_FIELD: i64 = 16 |
| 110 | const RG_MSH_LAY_CNT_FIELD: i64 = 20 |
| 111 | const RG_MSH_A_TRIS: i64 = 400 |
| 112 | const RG_MSH_A_LAYS: i64 = 4 |
| 113 | const RG_MSH_B_TRIS: i64 = 900 |
| 114 | const RG_MSH_B_LAYS: i64 = 9 |
| 115 | const RG_MSH_Z_TRIS: i64 = 500 // the ZERO-LAYER case |
| 116 | const RG_MSH_A: *u8 = "/tmp/nx_rigfloor_gate/m_a.nxmesh" |
| 117 | const RG_MSH_B: *u8 = "/tmp/nx_rigfloor_gate/m_b.nxmesh" |
| 118 | const RG_MSH_Z: *u8 = "/tmp/nx_rigfloor_gate/m_zero.nxmesh" |
| 119 | const RG_ROSTER_MSH: *u8 = "/tmp/nx_rigfloor_gate/msh.roster" |
| 120 | const RG_ROSTER_ZERO: *u8 = "/tmp/nx_rigfloor_gate/zero.roster" |
| 121 | const RG_ROSTER_MIX: *u8 = "/tmp/nx_rigfloor_gate/mix.roster" |
| 122 | const RG_CONF_MSH: *u8 = "/tmp/nx_rigfloor_gate/msh.conf" |
| 123 | const RG_CONF_ZERO: *u8 = "/tmp/nx_rigfloor_gate/zero.conf" |
| 124 | const RG_CONF_MIX: *u8 = "/tmp/nx_rigfloor_gate/mix.conf" |
functions
| 126 | func rg_wr32(b: *u8, off: i64, v: i64) -> i64 called by 1: rg_write_msh |
| 137 | func rg_wr64(b: *u8, off: i64, v: i64) -> i64 called by 1: rg_write_nxa |
| 148 | func rg_tag(b: *u8, off: i64, t: *u8) -> i64 called by 1: rg_write_nxa |
| 154 | func rg_write_nxa(path: *u8, nv: i64, nt: i64, nj: i64) -> i64 |
| 188 | func rg_write_msh(path: *u8, nlay: i64, ntri: i64) -> i64 |
| 212 | func rg_write_text(path: *u8, s: *u8) -> i64 |
| 223 | func rg_run(subject: *u8, verb: *u8, a2: *u8, a3: *u8, out: *u8, outlen: *i64) -> i64 |
| 234 | func rg_conf(buf: *u8, n: i64, key: *u8) -> i64 called by 1: rg_conf_of |
| 274 | func rg_conf_of(path: *u8, key: *u8) -> i64 |
| 280 | func rg_exists(path: *u8) -> i64 |
| 287 | func main(argc: i64, argv: *i64) -> i64 |