nx_comparetree_lib_gate.nx
buildroot/runtime/nx_comparetree_lib_gate.nx
about
nx_comparetree_lib_gate.nx -- the referee for the two-tree /compare resolver (nx_comparetree_lib).
WHAT MAKES THIS GATE REAL RATHER THAN DECORATIVE:
* IN-PROCESS. It imports the lib and calls it directly, so nx_gate_bite can mutate the lib and
watch this go RED. A gate that fork/execs a deployed elf reports NOT-REACHED for every mutant and
its GREEN proves nothing about the code under test.
* REAL FILES, NOT A SIMULATION. The three resolution cases are exercised against actual fixture
files under /tmp/<gate>/, because the defect being guarded is a FILESYSTEM LOOKUP. A gate that
only tested the pure decision would pass while the resolver read the wrong path.
* THE FIXTURE IS ASSERTED BEFORE THE OUTCOME. If the fixture write failed, every "resolves to
secondary" tooth below would pass for the wrong reason -- an absent file resolves nowhere.
* ANTI-VACUITY BY CONTENT. Each case checks the BYTES RETURNED, not just the which-tree flag. A
trivial implementation that always sets the flag to PRIMARY and reads nothing cannot pass, and
that implementation is kept here as cg_wrong_pick so the claim is demonstrated, not asserted.
* cwd-INDEPENDENT. Fixtures are absolute and the production-order teeth compare constants, so this
gate cannot pass or fail because of where a runner happened to start it.
license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_comparetree_lib.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
| 22 | const CG_MODE_755: i64 = 493 |
| 23 | const CG_MODE_644: i64 = 420 |
| 24 | const CG_BUF: i64 = 4096 |
| 25 | const CG_PATH: i64 = 512 |
| 27 | const CG_ROOT: *u8 = "/tmp/nx_comparetree_lib_gate" |
| 28 | const CG_MK_P: *u8 = "/tmp/nx_comparetree_lib_gate/p" |
| 29 | const CG_MK_S: *u8 = "/tmp/nx_comparetree_lib_gate/s" |
| 31 | const CG_DIR_P: *u8 = "/tmp/nx_comparetree_lib_gate/p/" |
| 32 | const CG_DIR_S: *u8 = "/tmp/nx_comparetree_lib_gate/s/" |
| 34 | const CG_DIR_NONE: *u8 = "/tmp/nx_comparetree_lib_gate/no_such_dir/" |
| 35 | const CG_SUF: *u8 = ".matrix" |
| 39 | const CG_BODY_P_BOTH: *u8 = "PRIMARY-TREE-BOTH\n" |
| 40 | const CG_BODY_S_BOTH: *u8 = "SECONDARY-TREE-BOTH-AND-LONGER\n" |
| 41 | const CG_BODY_P_ONLY: *u8 = "PRIMARY-ONLY\n" |
| 42 | const CG_BODY_S_ONLY: *u8 = "SECONDARY-ONLY-LONGER\n" |
| 118 | const CG_OLD_CAP: i64 = 65536 |
| 119 | const CG_BIG_PAD: i64 = 3000 |
| 120 | const CG_BIG_FILL: i64 = 46 |
| 121 | const CG_BIG_TAIL: *u8 = "TAIL-PAST-THE-OLD-CAP\n" |
| 122 | const CG_BIG_DOM: *u8 = "big" |
| 195 | const CG_ST_CODE: i64 = 0 |
| 196 | const CG_ST_STR: i64 = 1 |
| 197 | const CG_ST_COMMENT: i64 = 2 |
| 199 | const CG_DQ: i64 = 34 |
| 200 | const CG_BSL: i64 = 92 |
| 201 | const CG_FSL: i64 = 47 |
| 202 | const CG_NLB: i64 = 10 |
| 208 | const CG_NEEDLE: *u8 = "knowledge/compare" |
| 209 | const CG_IMPORTMARK: *u8 = "nx_comparetree_lib" |
| 215 | const CG_SCAN_A1: *u8 = "buildroot/runtime" |
| 216 | const CG_SCAN_A2: *u8 = "runtime" |
| 217 | const CG_SCAN_B1: *u8 = "buildroot/runtime/_hdl_build" |
| 218 | const CG_SCAN_B2: *u8 = "runtime/_hdl_build" |
| 219 | const CG_NXEXT: *u8 = ".nx" |
| 224 | const CG_STATUS_1: *u8 = "knowledge/status/" |
| 225 | const CG_STATUS_2: *u8 = "../knowledge/status/" |
| 226 | const CG_BASE_FILE: *u8 = "comparetree_adoption.baseline" |
| 227 | const CG_STAMP_FILE: *u8 = "comparetree_adoption.stamp" |
| 231 | const CG_EXEMPT_1: *u8 = "nx_comparetree_lib.nx" |
| 232 | const CG_EXEMPT_2: *u8 = "nx_comparetree_lib_gate.nx" |
| 245 | const CG_FILE_BUDGET: i64 = 32000 |
| 246 | const CG_DENT_BUF: i64 = 262144 |
| 247 | const CG_NAME_CAP: i64 = 256 |
| 248 | const CG_SET_CAP: i64 = 262144 |
| 249 | const CG_FX_CAP: i64 = 512 |
| 251 | const CG_O_SCANNED: i64 = 0 |
| 252 | const CG_O_OFFENDERS: i64 = 1 |
| 253 | const CG_O_ADOPTERS: i64 = 2 |
| 254 | const CG_O_EXEMPTED: i64 = 3 |
| 255 | const CG_O_UNREAD: i64 = 4 |
| 256 | const CG_O_OVER: i64 = 5 |
| 257 | const CG_O_SETLEN: i64 = 6 |
| 258 | const CG_OUT_SLOTS: i64 = 8 |
| 259 | const CG_OUT_BYTES: i64 = 64 |
functions
| 44 | func cg_zlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 45 | func eq(a: i64, b: i64) -> i64 { if a == b { return 1 } return 0 } called by 1: main |
| 46 | func ne(a: i64, b: i64) -> i64 { if a == b { return 0 } return 1 } called by 1: main |
| 48 | func cg_say(s: *u8) -> i64 |
| 54 | func cg_num(v: i64) -> i64 |
| 68 | func cg_write(path: *u8, body: *u8) -> i64 |
| 78 | func cg_streq(a: *u8, b: *u8) -> i64 |
| 89 | func cg_bufeq(buf: *u8, n: i64, exp: *u8) -> i64 |
| 102 | func cg_wrong_pick(n1: i64, n2: i64) -> i64 { return CT_TREE_PRIMARY } called by 1: main |
| 124 | func cg_gt(a: i64, b: i64) -> i64 { if a > b { return 1 } return 0 } called by 1: main |
| 129 | func cg_write_big(path: *u8) -> i64 |
| 157 | func cg_tail_is(buf: *u8, n: i64, exp: *u8) -> i64 |
| 261 | func cg_put(d: *u8, o: i64, b: i64) -> i64 { d[o] = b as u8; return o + 1 } |
| 263 | func cg_at(src: *u8, n: i64, i: i64, ned: *u8, nl: i64) -> i64 |
| 278 | func cg_code_has(src: *u8, n: i64, ned: *u8) -> i64 |
| 314 | func cg_naive_has(src: *u8, n: i64, ned: *u8) -> i64 |
| 327 | func cg_slashstrip_has(src: *u8, n: i64, ned: *u8) -> i64 |
| 350 | func cg_exempt(name: *u8) -> i64 |
| 358 | func cg_is_offender(name: *u8, src: *u8, n: i64) -> i64 |
| 364 | func cg_ends_with(name: *u8, suf: *u8) -> i64 |
| 376 | func cg_eol(b: *u8, n: i64, i: i64) -> i64 |
| 387 | func cg_hasline(hay: *u8, hn: i64, name: *u8) -> i64 |
| 415 | func cg_should_write(have_base: i64, rises: i64, falls: i64, cov: i64) -> i64 called by 1: main |
| 424 | func cg_launder_write(have_base: i64, rises: i64, falls: i64, cov: i64) -> i64 { return 1 } called by 1: main |
| 428 | func cg_fx_clean(d: *u8) -> i64 |
| 433 | func cg_fx_code(d: *u8) -> i64 |
| 440 | func cg_fx_str(d: *u8) -> i64 |
| 449 | func cg_fx_cmt(d: *u8) -> i64 |
| 458 | func cg_fx_url(d: *u8) -> i64 |
| 477 | func cg_scan_dir(dir: *u8, set: *u8, setcap: i64, out: *i64) -> i64 called by 1: main calls 15: sys_openat_rdsys_mmapsys_getdents64dirent_reclendirent_typedirent_name+9 |
| 543 | func main(argc: i64, argv: *i64) -> i64 |