| 54 | |
| 55 | |
| 56 | def dependency_controls(context): |
| 57 | root = context.output / "native-controls" |
| 58 | root.mkdir() |
| 59 | raw = root / "raw" |
| 60 | raw.mkdir() |
| 61 | env = clean_env() |
| 62 | env["LLVM_PROFILE_FILE"] = str(root / "listing.profraw") |
| 63 | listing = context.processes.run("native-list", [context.runner, "--list-suites"], env, timeout=70) |
| 64 | require(listing["exit"] == 0 and SUITE.encode() in read(listing["stdout"]).splitlines(), |
| 65 | "real runner does not list setup fixture") |
| 66 | universe = convert(context, root / "listing.profraw", "native-list-text") |
| 67 | require(any(not any(values) for values in universe.values()), "native enumeration has no zero-record control") |
| 68 | require(any(key[0] == FUNCTION for key in universe), "native enumeration lacks exact setup identity") |
| 69 | require(not any(key[0] == b"__cbm_live_v2_test_unknown_identity__" for key in universe), |
| 70 | "administrative unknown-identity sentinel collides with native universe") |
| 71 | env["LLVM_PROFILE_FILE"] = os.devnull |
| 72 | env["CBM_TEST_COVERAGE_DIR"] = str(raw) |
| 73 | suite = context.processes.run("native-setup", [context.runner, SUITE], env, timeout=70) |
| 74 | require(suite["exit"] == 0, "real setup fixture process failed") |
| 75 | native_summary(read(suite["stdout"])) |
| 76 | events = [json.loads(line[len(b"COV_CHILD "):]) for line in read(suite["stderr"]).splitlines() |
| 77 | if line.startswith(b"COV_CHILD ")] |
| 78 | selected = [event for event in events if event.get("id") == "setup_ok"] |
| 79 | require([event.get("stage") for event in selected] == ["ready", "reaped"], |
| 80 | "setup child custody control differs") |
| 81 | require(selected[0].get("marker") == 1 and selected[1].get("marker") == 0 |
| 82 | and selected[1].get("code") == 0 and selected[0].get("pid") == selected[1].get("pid"), |
| 83 | "setup child did not successfully write, retire marker and reap") |
| 84 | child = raw / SUITE / ("_setup.child.%d.profraw" % selected[1]["pid"]) |
| 85 | child_records = convert(context, child, "native-setup-child-text") |
| 86 | require(set(child_records) == set(universe) and all(len(child_records[key]) == len(universe[key]) |
| 87 | for key in universe), "native full-record shape control") |
| 88 | require(any(any(values) for key, values in child_records.items() if key[0] == FUNCTION), |
| 89 | "genuine setup child did not hit setup counter") |
| 90 | for test in TESTS: |
| 91 | require(bool(read(raw / SUITE / (test + ".parent.profraw"))), "missing native parent control") |
| 92 | return universe, {"listing": listing, "suite": suite, "child_profile": str(child), |
| 93 | "child_sha256": digest(child), "events": selected, |
| 94 | "universe_records": len(universe), "actual_setup_hit": True} |
| 95 | |
| 96 | |
| 97 | def bundle(context, destination, registry, tests, outcome, exit_code): |